summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/LICENSE205
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/META-INF/MANIFEST.MF41
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/NOTICE6
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/pom.xml70
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/context/JMSBindingContext.java141
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/headers/HeaderReferenceInterceptor.java175
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/headers/HeaderServiceInterceptor.java83
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/host/DefaultJMSHostExtensionPoint.java40
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/host/DefaultJMSServiceListener.java283
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/host/DefaultJMSServiceListenerFactory.java55
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/host/DefaultServiceInvoker.java106
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/host/JMSHostExtensionPoint.java27
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/host/JMSServiceListener.java29
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/host/JMSServiceListenerDetails.java37
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/host/JMSServiceListenerFactory.java27
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/runtime/OperationSelectorJMSDefaultProviderFactory.java60
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/runtime/OperationSelectorJMSDefaultServiceInterceptor.java198
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/runtime/OperationSelectorJMSDefaultServiceProvider.java53
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsuserprop/runtime/OperationSelectorJMSUserPropProviderFactory.java56
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsuserprop/runtime/OperationSelectorJMSUserPropServiceInterceptor.java107
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsuserprop/runtime/OperationSelectorJMSUserPropServiceProvider.java47
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/provider/JMSTokenAuthenticationPolicyProviderFactory.java74
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/provider/JMSTokenAuthenticationReferencePolicyInterceptor.java104
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/provider/JMSTokenAuthenticationReferencePolicyProvider.java57
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/provider/JMSTokenAuthenticationServicePolicyInterceptor.java106
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/provider/JMSTokenAuthenticationServicePolicyProvider.java57
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/policy/header/provider/JMSHeaderPolicyProviderFactory.java83
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/policy/header/provider/JMSHeaderReferencePolicyInterceptor.java88
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/policy/header/provider/JMSHeaderReferencePolicyProvider.java58
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/AbstractMessageProcessor.java161
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/BytesMessageProcessor.java120
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/DefaultJMSResourceFactoryExtensionPoint.java30
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/DefaultMessageProcessor.java302
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingProviderFactory.java76
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingReferenceBindingProvider.java172
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingServiceBindingProvider.java246
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSMessageProcessor.java55
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSMessageProcessorUtil.java109
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSResourceFactory.java99
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSResourceFactoryExtensionPoint.java28
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSResourceFactoryImpl.java300
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/ObjectMessageProcessor.java231
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/RRBJMSBindingInvoker.java269
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/TextMessageProcessor.java80
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/XMLBytesMessageProcessor.java136
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/XMLTextMessageProcessor.java132
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/transport/TransportReferenceInterceptor.java168
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/transport/TransportServiceInterceptor.java207
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wire/CallbackDestinationInterceptor.java109
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wire/OperationPropertiesInterceptor.java69
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesProviderFactory.java60
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesReferenceInterceptor.java123
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesReferenceProvider.java92
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesServiceInterceptor.java115
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesServiceProvider.java96
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytesxml/runtime/WireFormatJMSBytesXMLProviderFactory.java64
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytesxml/runtime/WireFormatJMSBytesXMLReferenceInterceptor.java123
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytesxml/runtime/WireFormatJMSBytesXMLReferenceProvider.java100
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytesxml/runtime/WireFormatJMSBytesXMLServiceInterceptor.java109
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytesxml/runtime/WireFormatJMSBytesXMLServiceProvider.java108
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/runtime/WireFormatJMSDefaultProviderFactory.java66
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/runtime/WireFormatJMSDefaultReferenceInterceptor.java175
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/runtime/WireFormatJMSDefaultReferenceProvider.java204
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/runtime/WireFormatJMSDefaultServiceInterceptor.java187
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/runtime/WireFormatJMSDefaultServiceProvider.java198
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectProviderFactory.java60
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectReferenceInterceptor.java142
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectReferenceProvider.java113
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectServiceInterceptor.java139
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectServiceProvider.java119
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextProviderFactory.java60
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextReferenceInterceptor.java124
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextReferenceProvider.java101
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextServiceInterceptor.java115
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextServiceProvider.java103
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLProviderFactory.java66
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLReferenceInterceptor.java129
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLReferenceProvider.java113
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLServiceInterceptor.java116
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLServiceProvider.java108
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory20
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.OperationSelectorProviderFactory21
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory19
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.WireFormatProviderFactory25
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/test/java/org/apache/tuscany/sca/binding/jms/HelloWorldClientImpl.java43
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/test/java/org/apache/tuscany/sca/binding/jms/HelloWorldService.java31
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/test/java/org/apache/tuscany/sca/binding/jms/HelloWorldServiceImpl.java32
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/test/java/org/apache/tuscany/sca/binding/jms/OperationSelectionTestCaseFIXME.java229
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/test/resources/simple/client.composite38
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/test/resources/simple/service.composite35
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/LICENSE205
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/META-INF/MANIFEST.MF62
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/NOTICE6
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/pom.xml51
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/BindingProperty.java72
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/JMSBinding.java1094
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/JMSBindingConstants.java75
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/JMSBindingException.java45
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/JMSBindingProcessor.java1706
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/OperationSelectorJMSDefault.java45
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/OperationSelectorJMSDefaultProcessor.java76
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/OperationSelectorJMSUserProp.java57
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/OperationSelectorJMSUserPropProcessor.java87
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/JMSTokenAuthenticationPolicy.java55
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/JMSTokenAuthenticationPolicyProcessor.java111
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/policy/header/JMSHeaderPolicy.java130
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/policy/header/JMSHeaderPolicyProcessor.java206
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/WireFormatJMSBytes.java45
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/WireFormatJMSBytesProcessor.java75
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/WireFormatJMSBytesXML.java40
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/WireFormatJMSBytesXMLProcessor.java72
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/WireFormatJMSDefault.java64
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/WireFormatJMSDefaultProcessor.java89
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/WireFormatJMSObject.java57
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/WireFormatJMSObjectProcessor.java88
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/WireFormatJMSText.java45
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/WireFormatJMSTextProcessor.java75
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/WireFormatJMSTextXML.java48
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/WireFormatJMSTextXMLProcessor.java75
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor30
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/resources/META-INF/services/org.apache.tuscany.sca.definitions.xml.Definitions17
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/resources/binding-jms-policy-validation-messages.properties23
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/resources/binding-jms-validation-messages.properties61
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/resources/org/apache/tuscany/sca/binding/jms/policy/definitions.xml29
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/JMSBindingProcessorTestCase.java773
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/JMSBindingProcessorWriteTestCase.java438
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/policy/PolicyProcessorTestCase.java95
127 files changed, 0 insertions, 15815 deletions
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/LICENSE b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/LICENSE
deleted file mode 100644
index 8aa906c321..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/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/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/META-INF/MANIFEST.MF b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/META-INF/MANIFEST.MF
deleted file mode 100644
index a16f0c48ca..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,41 +0,0 @@
-Manifest-Version: 1.0
-SCA-Version: 1.1
-Bundle-Name: Apache Tuscany SCA JMS Binding Runtime
-Bundle-Vendor: The Apache Software Foundation
-Bundle-Version: 2.0.0
-Bundle-ManifestVersion: 2
-Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
-Bundle-Description: Apache Tuscany SCA JMS Binding Runtime
-Import-Package: javax.jms,
- javax.naming,
- javax.resource.spi,
- javax.security.auth,
- javax.xml.namespace,
- javax.xml.stream,
- org.apache.axiom.om,
- org.apache.axiom.om.impl.builder,
- org.apache.tuscany.sca.assembly;version="2.0.0",
- org.apache.tuscany.sca.binding.jms;version="2.0.0",
- org.apache.tuscany.sca.binding.jms.operationselector;version="2.0.0",
- org.apache.tuscany.sca.binding.jms.policy.authentication.token;version="2.0.0",
- org.apache.tuscany.sca.binding.jms.policy.header;version="2.0.0",
- org.apache.tuscany.sca.binding.jms.wireformat;version="2.0.0",
- org.apache.tuscany.sca.binding.ws;version="2.0.0",
- org.apache.tuscany.sca.binding.ws.wsdlgen;version="2.0.0",
- org.apache.tuscany.sca.core;version="2.0.0",
- org.apache.tuscany.sca.interfacedef;version="2.0.0",
- org.apache.tuscany.sca.interfacedef.impl;version="2.0.0",
- org.apache.tuscany.sca.interfacedef.util;version="2.0.0",
- org.apache.tuscany.sca.invocation;version="2.0.0",
- org.apache.tuscany.sca.monitor;version="2.0.0",
- org.apache.tuscany.sca.policy;version="2.0.0",
- org.apache.tuscany.sca.policy.authentication.token;version="2.0.0",
- org.apache.tuscany.sca.policy.security;version="2.0.0",
- org.apache.tuscany.sca.provider;version="2.0.0",
- org.apache.tuscany.sca.runtime;version="2.0.0",
- org.apache.tuscany.sca.work;version="2.0.0",
- org.oasisopen.sca;version="2.0.0",
- org.oasisopen.sca.annotation;version="2.0.0"
-Bundle-SymbolicName: org.apache.tuscany.sca.binding.jms.runtime
-Bundle-DocURL: http://www.apache.org/
-Bundle-RequiredExecutionEnvironment: J2SE-1.5,JavaSE-1.6
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/NOTICE b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/NOTICE
deleted file mode 100644
index fdfa0e9faa..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2008 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/pom.xml b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/pom.xml
deleted file mode 100644
index f4d295d649..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-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>2.0-Beta2-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-base-runtime-pom</artifactId>
- <type>pom</type>
- <version>2.0-Beta2-SNAPSHOT</version>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-binding-jms</artifactId>
- <version>2.0-Beta2-SNAPSHOT</version>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-jms_1.1_spec</artifactId>
- <version>1.1.1</version>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-j2ee-connector_1.5_spec</artifactId>
- <version>2.0.0</version>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.8.1</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
-</project>
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/context/JMSBindingContext.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/context/JMSBindingContext.java
deleted file mode 100644
index e38a9d0c60..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/context/JMSBindingContext.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.jms.context;
-
-import javax.jms.Destination;
-import javax.jms.Message;
-import javax.jms.Session;
-
-import org.apache.tuscany.sca.binding.jms.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/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/headers/HeaderReferenceInterceptor.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/headers/HeaderReferenceInterceptor.java
deleted file mode 100644
index 61c5dc8263..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/headers/HeaderReferenceInterceptor.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.jms.headers;
-
-
-
-
-import java.util.Map;
-import java.util.UUID;
-
-import javax.jms.DeliveryMode;
-import javax.jms.Destination;
-import javax.jms.JMSException;
-import javax.naming.NamingException;
-
-import org.apache.tuscany.sca.binding.jms.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.JMSBindingConstants;
-import org.apache.tuscany.sca.binding.jms.JMSBindingException;
-import org.apache.tuscany.sca.binding.jms.context.JMSBindingContext;
-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.core.ExtensionPointRegistry;
-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.RuntimeEndpoint;
-import org.apache.tuscany.sca.runtime.RuntimeEndpointReference;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class HeaderReferenceInterceptor implements Interceptor {
-
- private Invoker next;
- private RuntimeEndpointReference runtimeWire;
- private JMSBinding jmsBinding;
- private JMSMessageProcessor requestMessageProcessor;
-
-
- public HeaderReferenceInterceptor(ExtensionPointRegistry extensions, JMSBinding jmsBinding, JMSResourceFactory jmsResourceFactory, RuntimeEndpointReference runtimeWire) {
- super();
- this.jmsBinding = jmsBinding;
- this.runtimeWire = runtimeWire;
- this.requestMessageProcessor = JMSMessageProcessorUtil.getRequestMessageProcessor(extensions, jmsBinding);
-
- }
-
- 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();
- RuntimeEndpointReference reference = runtimeWire;
-
- // 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.getEffectiveJMSDeliveryMode(operationName) != null) {
- if (jmsBinding.getEffectiveJMSDeliveryMode(operationName)) {
- jmsMsg.setJMSDeliveryMode(DeliveryMode.PERSISTENT);
- } else {
- jmsMsg.setJMSDeliveryMode(DeliveryMode.NON_PERSISTENT);
- }
- }
-
- if (jmsBinding.getEffectiveJMSPriority(operationName) != null) {
- jmsMsg.setJMSPriority(jmsBinding.getEffectiveJMSPriority(operationName));
- }
-
- if ( jmsBinding.getEffectiveJMSType(operationName) != null ) {
- jmsMsg.setJMSType(jmsBinding.getEffectiveJMSType(operationName));
- }
-
- if ( jmsBinding.getEffectiveJMSTimeToLive(operationName) != null ) {
- jmsMsg.setJMSExpiration(jmsBinding.getEffectiveJMSTimeToLive(operationName));
- }
-
- if (jmsBinding.getOperationJMSCorrelationId(operationName) != null) {
- jmsMsg.setJMSCorrelationID(jmsBinding.getOperationJMSCorrelationId(operationName));
- } else if (JMSBindingConstants.CORRELATE_CORRELATION_ID.equals(jmsBinding.getCorrelationScheme())) {
- jmsMsg.setJMSCorrelationID(UUID.randomUUID().toString());
- }
-
- if (tuscanyMsg.getFrom().getCallbackEndpoint() != null) {
-
- String callbackDestName = getCallbackDestinationName(reference);
- if (callbackDestName != null) {
- jmsMsg.setStringProperty(JMSBindingConstants.CALLBACK_Q_PROPERTY, "jms:jndi:" + callbackDestName);
- if (operation.isNonBlocking()) {
- Destination dest = context.getJmsResourceFactory().lookupDestination(callbackDestName);
- jmsMsg.setJMSReplyTo(dest);
- }
- }
- }
-
- 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.getEffectiveJMSTimeToLive(operationName) != null) {
- context.setTimeToLive(jmsBinding.getEffectiveJMSTimeToLive(operationName) * 2);
- } else {
- context.setTimeToLive(JMSBindingConstants.DEFAULT_TIME_TO_LIVE);
- }
-
- return tuscanyMsg;
- } catch (JMSException e) {
- throw new JMSBindingException(e);
- } catch (NamingException e) {
- throw new JMSBindingException(e);
- }
- }
-
-
- protected String getCallbackDestinationName(RuntimeEndpointReference reference) {
- RuntimeEndpoint endpoint = (RuntimeEndpoint) reference.getCallbackEndpoint();
- if (endpoint != null) {
- JMSBindingServiceBindingProvider bp = (JMSBindingServiceBindingProvider)endpoint.getBindingProvider();
- return bp.getDestinationName();
- }
- return null;
- }
-
-
- public Invoker getNext() {
- return next;
- }
-
- public void setNext(Invoker next) {
- this.next = next;
- }
-
-
-}
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/headers/HeaderServiceInterceptor.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/headers/HeaderServiceInterceptor.java
deleted file mode 100644
index 178a87a53f..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/headers/HeaderServiceInterceptor.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.jms.headers;
-
-import java.util.Map;
-
-import javax.jms.JMSException;
-
-import org.apache.tuscany.sca.binding.jms.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.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;
-
-public class HeaderServiceInterceptor implements Interceptor {
-
- private Invoker next;
- private JMSBinding jmsBinding;
-
- public HeaderServiceInterceptor(JMSBinding jmsBinding) {
- super();
- this.jmsBinding = jmsBinding;
- }
-
- public Message invoke(Message msg) {
- return invokeResponse(next.invoke(msg));
- }
-
- public Message invokeResponse(Message tuscanyMsg) {
- try {
-
- javax.jms.Message jmsMsg = tuscanyMsg.getBody();
-
- Operation operation = tuscanyMsg.getOperation();
- String operationName = operation.getName();
-
- 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);
- }
- }
-
- return tuscanyMsg;
-
- } catch (JMSException e) {
- throw new JMSBindingException(e);
- }
- }
-
- public Invoker getNext() {
- return next;
- }
-
- public void setNext(Invoker next) {
- this.next = next;
- }
-
-
-}
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/host/DefaultJMSHostExtensionPoint.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/host/DefaultJMSHostExtensionPoint.java
deleted file mode 100644
index cac346adf4..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/host/DefaultJMSHostExtensionPoint.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.host;
-
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.core.UtilityExtensionPoint;
-import org.apache.tuscany.sca.work.WorkScheduler;
-
-public class DefaultJMSHostExtensionPoint implements JMSHostExtensionPoint {
-
- private JMSServiceListenerFactory jmsServiceListenerFactory;
-
- public DefaultJMSHostExtensionPoint(ExtensionPointRegistry extensionPoints) {
- UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
- WorkScheduler workScheduler = utilities.getUtility(WorkScheduler.class);
- this.jmsServiceListenerFactory = new DefaultJMSServiceListenerFactory(workScheduler);
- }
-
- public JMSServiceListenerFactory getJMSServiceListenerFactory() {
- return jmsServiceListenerFactory;
- }
-
-}
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/host/DefaultJMSServiceListener.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/host/DefaultJMSServiceListener.java
deleted file mode 100644
index 94728699a2..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/host/DefaultJMSServiceListener.java
+++ /dev/null
@@ -1,283 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, 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.host;
-
-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 javax.resource.spi.ActivationSpec;
-
-import org.apache.tuscany.sca.binding.jms.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.JMSBindingConstants;
-import org.apache.tuscany.sca.binding.jms.JMSBindingException;
-import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory;
-import org.apache.tuscany.sca.work.WorkScheduler;
-
-/**
- * Implementation of the JMS service binding provider.
- *
- * @version $Rev$ $Date$
- */
-public class DefaultJMSServiceListener implements JMSServiceListener {
- private static final Logger logger = Logger.getLogger(DefaultJMSServiceListener.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 DefaultJMSServiceListener(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 {
- registerListener();
- } catch (Exception e) {
- if (e instanceof JMSBindingException) throw (JMSBindingException)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 ((e.getMessage() == null) || !e.getMessage().contains("disposed")) {
- throw new JMSBindingException("Error stopping JMSServiceBinding", e);
- }
- }
- }
-
- private void registerListener() throws NamingException, JMSException {
-
- Session session = jmsResourceFactory.createSession();
- lookupActivationSpec();
- 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()));
- }
-
- // Stub code for ActivationSpec support that throws appropriate errors
- private void lookupActivationSpec() {
- if ( jmsBinding.getActivationSpecName() != null ) {
- String createMode = jmsBinding.getActivationSpecCreate();
- if ( JMSBindingConstants.CREATE_ALWAYS.equals(createMode) ) {
- ActivationSpec spec = jmsResourceFactory.lookupActivationSpec(jmsBinding.getActivationSpecName());
- if ( spec != null ) {
- throw new JMSBindingException("ActivationSpec specifies create mode of \"always\" but resource already exists.");
- }
- throw new JMSBindingException("Can not create ActivationSpec");
- } else if ( JMSBindingConstants.CREATE_IF_NOT_EXIST.equals(createMode)) {
- ActivationSpec spec = jmsResourceFactory.lookupActivationSpec(jmsBinding.getActivationSpecName());
- if ( spec == null ) {
- throw new JMSBindingException("Can not create ActivationSpec");
- }
- } else if ( JMSBindingConstants.CREATE_NEVER.equals(createMode)) {
- ActivationSpec spec = jmsResourceFactory.lookupActivationSpec(jmsBinding.getActivationSpecName());
- if ( spec == null )
- throw new JMSBindingException("ActivationSpec specifies create mode of \"never\" but resource does not exist at jndiName " + jmsBinding.getActivationSpecName());
-
- }
-
-
- }
- }
-
- /**
- * 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
- // but don't create when using jms:jndi uri format
- if (destination == null && !"jndi".equals(jmsBinding.getDestinationType())) {
- 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");
- }
-
- // Make sure its the expected type (queue or topic)
- String type = (destination instanceof Queue) ? JMSBindingConstants.DESTINATION_TYPE_QUEUE : JMSBindingConstants.DESTINATION_TYPE_TOPIC;
- if ("jndi".equals(jmsBinding.getDestinationType())) {
- jmsBinding.setDestinationType(type);
- } else {
- if (!type.equals(jmsBinding.getDestinationType())) {
- throw new JMSBindingException("JMS Destination " + jmsBinding.getDestinationName()
- + " expecting type of "
- + jmsBinding.getDestinationType()
- + " but found "
- + type
- + " 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/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/host/DefaultJMSServiceListenerFactory.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/host/DefaultJMSServiceListenerFactory.java
deleted file mode 100644
index 1976d687b6..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/host/DefaultJMSServiceListenerFactory.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.host;
-
-import javax.jms.MessageListener;
-import javax.naming.NamingException;
-
-import org.apache.tuscany.sca.binding.jms.JMSBindingException;
-import org.apache.tuscany.sca.binding.jms.provider.JMSBindingServiceBindingProvider;
-import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-import org.apache.tuscany.sca.work.WorkScheduler;
-
-public class DefaultJMSServiceListenerFactory implements JMSServiceListenerFactory {
-
- private WorkScheduler workScheduler;
-
- public DefaultJMSServiceListenerFactory(WorkScheduler workScheduler) {
- this.workScheduler = workScheduler;
- }
-
- public JMSServiceListener createJMSServiceListener(JMSServiceListenerDetails jmsSLD) {
- try {
-
- JMSResourceFactory rf = ((JMSBindingServiceBindingProvider)jmsSLD).getResourceFactory();
-
- RuntimeComponentService service = (RuntimeComponentService) jmsSLD.getEndpoint().getService();
- MessageListener listener = new DefaultServiceInvoker(jmsSLD.getEndpoint(), jmsSLD.getTargetBinding(), jmsSLD.getMessageFactory(), rf);
-
-// return new ASFListener(listener, service.getName(), service.isCallback(), jmsSLD.getJmsBinding(), workScheduler, rf);
-// TODO: 2.x migration, service.isCallback()
- return new DefaultJMSServiceListener(listener, service.getName(), false, jmsSLD.getJmsBinding(), workScheduler, rf);
-
- } catch (NamingException e) {
- throw new JMSBindingException(e);
- }
- }
-}
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/host/DefaultServiceInvoker.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/host/DefaultServiceInvoker.java
deleted file mode 100644
index 9f3062f065..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/host/DefaultServiceInvoker.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.host;
-
-import java.lang.reflect.InvocationTargetException;
-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.assembly.Endpoint;
-import org.apache.tuscany.sca.binding.jms.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.context.JMSBindingContext;
-import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory;
-import org.apache.tuscany.sca.invocation.MessageFactory;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
-
-/**
- * TODO RRB experiement
- * Listener for the JMSBinding.
- *
- * @version $Rev$ $Date$
- */
-public class DefaultServiceInvoker implements MessageListener {
-
- private static final Logger logger = Logger.getLogger(DefaultServiceInvoker.class.getName());
-
- private RuntimeEndpoint endpoint;
- private JMSBinding jmsBinding;
- private Binding targetBinding;
- private JMSResourceFactory jmsResourceFactory;
- private RuntimeComponentService service;
- private MessageFactory messageFactory;
-
- public DefaultServiceInvoker(RuntimeEndpoint endpoint, Binding targetBinding, MessageFactory messageFactory, JMSResourceFactory rf) throws NamingException {
- this.endpoint = endpoint;
- this.jmsBinding = (JMSBinding) endpoint.getBinding();
- this.jmsResourceFactory = rf;
- this.service = (RuntimeComponentService) endpoint.getService();
- 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
- getEndpoint(targetBinding).invoke(tuscanyMsg);
-
- }
-
- private RuntimeEndpoint getEndpoint(Binding targetBinding) {
- for(Endpoint ep: service.getEndpoints()) {
- if(ep.getBinding() == targetBinding) {
- return (RuntimeEndpoint) ep;
- }
- }
- return endpoint;
- }
-
-}
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/host/JMSHostExtensionPoint.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/host/JMSHostExtensionPoint.java
deleted file mode 100644
index a15a84b60e..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/host/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.binding.jms.host;
-
-
-public interface JMSHostExtensionPoint {
-
- JMSServiceListenerFactory getJMSServiceListenerFactory();
-
-}
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/host/JMSServiceListener.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/host/JMSServiceListener.java
deleted file mode 100644
index 444d796b12..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/host/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.binding.jms.host;
-
-public interface JMSServiceListener {
-
- void start();
-
- void stop();
-
- String getDestinationName();
-}
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/host/JMSServiceListenerDetails.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/host/JMSServiceListenerDetails.java
deleted file mode 100644
index 451f3680d6..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/host/JMSServiceListenerDetails.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.jms.host;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.binding.jms.JMSBinding;
-import org.apache.tuscany.sca.invocation.MessageFactory;
-import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
-
-public interface JMSServiceListenerDetails {
-
- JMSBinding getJmsBinding();
-
- Binding getTargetBinding();
-
- RuntimeEndpoint getEndpoint();
-
- MessageFactory getMessageFactory();
-
-}
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/host/JMSServiceListenerFactory.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/host/JMSServiceListenerFactory.java
deleted file mode 100644
index 9dc23f1d8d..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/host/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.binding.jms.host;
-
-
-public interface JMSServiceListenerFactory {
-
- JMSServiceListener createJMSServiceListener(JMSServiceListenerDetails jmsServiceBindingProvider);
-
-}
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/runtime/OperationSelectorJMSDefaultProviderFactory.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/runtime/OperationSelectorJMSDefaultProviderFactory.java
deleted file mode 100644
index 61a2a076de..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/runtime/OperationSelectorJMSDefaultProviderFactory.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.jms.operationselector.jmsdefault.runtime;
-
-import org.apache.tuscany.sca.binding.jms.operationselector.OperationSelectorJMSDefault;
-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.RuntimeEndpoint;
-import org.apache.tuscany.sca.runtime.RuntimeEndpointReference;
-
-/**
- * @version $Rev$ $Date$
- */
-public class OperationSelectorJMSDefaultProviderFactory implements OperationSelectorProviderFactory<OperationSelectorJMSDefault> {
- private ExtensionPointRegistry registry;
-
- public OperationSelectorJMSDefaultProviderFactory(ExtensionPointRegistry registry) {
- super();
- this.registry = registry;
- }
-
- /**
- */
- public OperationSelectorProvider createReferenceOperationSelectorProvider(RuntimeEndpointReference endpointReference) {
- return null;
- }
-
- /**
- */
- public OperationSelectorProvider createServiceOperationSelectorProvider(RuntimeEndpoint endpoint) {
- return new OperationSelectorJMSDefaultServiceProvider(registry, endpoint);
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.ProviderFactory#getModelType()
- */
- public Class getModelType() {
- // TODO Auto-generated method stub
- return null;
- }
-
-}
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/runtime/OperationSelectorJMSDefaultServiceInterceptor.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/runtime/OperationSelectorJMSDefaultServiceInterceptor.java
deleted file mode 100644
index aae81fbac1..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/runtime/OperationSelectorJMSDefaultServiceInterceptor.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.binding.jms.operationselector.jmsdefault.runtime;
-
-import java.io.IOException;
-import java.util.List;
-
-import javax.jms.BytesMessage;
-import javax.jms.JMSException;
-import javax.jms.TextMessage;
-
-import org.apache.tuscany.sca.binding.jms.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.JMSBindingException;
-import org.apache.tuscany.sca.binding.jms.context.JMSBindingContext;
-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.WireFormatJMSDefault;
-import org.apache.tuscany.sca.binding.jms.wireformat.WireFormatJMSTextXML;
-import org.apache.tuscany.sca.common.xml.dom.DOMHelper;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-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.RuntimeEndpoint;
-import org.w3c.dom.Node;
-import org.xml.sax.SAXException;
-
-/**
- * Policy handler to handle PolicySet related to Logging with the QName
- * {http://tuscany.apache.org/xmlns/sca/1.1/impl/java}LoggingPolicy
- *
- * @version $Rev$ $Date$
- */
-public class OperationSelectorJMSDefaultServiceInterceptor implements Interceptor {
-
- private static final String ON_MESSAGE_METHOD_NAME = "onMessage";
-
- private Invoker next;
- private RuntimeEndpoint endpint;
- private JMSResourceFactory jmsResourceFactory;
- private JMSBinding jmsBinding;
- private JMSMessageProcessor requestMessageProcessor;
- private JMSMessageProcessor responseMessageProcessor;
- private RuntimeComponentService service;
- private List<Operation> serviceOperations;
- private DOMHelper domHelper;
-
- public OperationSelectorJMSDefaultServiceInterceptor(ExtensionPointRegistry registry, JMSResourceFactory jmsResourceFactory, RuntimeEndpoint endpoint) {
- super();
- this.endpint = endpoint;
- this.jmsBinding = (JMSBinding) endpoint.getBinding();
- this.jmsResourceFactory = jmsResourceFactory;
- this.requestMessageProcessor = JMSMessageProcessorUtil.getRequestMessageProcessor(registry, jmsBinding);
- this.responseMessageProcessor = JMSMessageProcessorUtil.getResponseMessageProcessor(registry, jmsBinding);
- this.service = (RuntimeComponentService)endpoint.getService();
- this.serviceOperations = service.getInterfaceContract().getInterface().getOperations();
- this.domHelper = DOMHelper.getInstance(registry);
- }
-
- 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 {
- String nativeName = jmsBinding.getNativeOperationName(op.getName());
- if (( nativeName != null ) && ( nativeName.equals(operationName)) ) {
- operation = op;
- break;
- }
- }
- }
- } else if (jmsBinding.getRequestWireFormat() instanceof WireFormatJMSDefault
- || jmsBinding.getRequestWireFormat() instanceof WireFormatJMSTextXML) {
-
- Node rootElement;
- String operationFromPayload;
-
- try {
- if (jmsMsg instanceof TextMessage) {
- String xmlPayload = ((TextMessage) jmsMsg).getText();
-
- if (xmlPayload != null) {
- rootElement = domHelper.load(xmlPayload);
- Node firstChild = rootElement.getFirstChild();
- if (firstChild != null) {
- operationFromPayload = firstChild.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) {
- rootElement = domHelper.load(new String(bytes));
- Node firstChild = rootElement.getFirstChild();
- if (firstChild != null) {
- operationFromPayload = firstChild.getLocalName();
- for (Operation op : serviceOperations) {
- if (op.getName().equals(operationFromPayload)) {
- operation = op;
- break;
- }
- }
- }
- }
- }
-
- } catch (IOException e) {
- //let's ignore this in case the client doesn't want to use a wrapped xml message
- } catch (SAXException 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("Cannot determine service operation");
- }
-
- return operation;
- }
-
- public Invoker getNext() {
- return next;
- }
-
- public void setNext(Invoker next) {
- this.next = next;
- }
-
-}
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/runtime/OperationSelectorJMSDefaultServiceProvider.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/runtime/OperationSelectorJMSDefaultServiceProvider.java
deleted file mode 100644
index da120ac6c1..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/runtime/OperationSelectorJMSDefaultServiceProvider.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.jms.operationselector.jmsdefault.runtime;
-
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-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.RuntimeEndpoint;
-
-/**
- * @version $Rev$ $Date$
- */
-public class OperationSelectorJMSDefaultServiceProvider implements OperationSelectorProvider {
- private RuntimeEndpoint endpoint;
- private ExtensionPointRegistry registry;
-
- public OperationSelectorJMSDefaultServiceProvider(ExtensionPointRegistry registry, RuntimeEndpoint endpoint) {
- super();
- this.endpoint = endpoint;
- this.registry = registry;
- }
-
- /**
- */
- public Interceptor createInterceptor() {
- return new OperationSelectorJMSDefaultServiceInterceptor(registry, null, endpoint);
- }
-
- /**
- */
- public String getPhase() {
- return Phase.SERVICE_BINDING_OPERATION_SELECTOR;
- }
-
-}
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsuserprop/runtime/OperationSelectorJMSUserPropProviderFactory.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsuserprop/runtime/OperationSelectorJMSUserPropProviderFactory.java
deleted file mode 100644
index 4352f5d416..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsuserprop/runtime/OperationSelectorJMSUserPropProviderFactory.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.operationselector.jmsuserprop.runtime;
-
-import org.apache.tuscany.sca.binding.jms.operationselector.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.RuntimeEndpoint;
-import org.apache.tuscany.sca.runtime.RuntimeEndpointReference;
-
-public class OperationSelectorJMSUserPropProviderFactory implements OperationSelectorProviderFactory<OperationSelectorJMSUserProp> {
- private ExtensionPointRegistry registry;
-
- public OperationSelectorJMSUserPropProviderFactory(ExtensionPointRegistry registry) {
- super();
- this.registry = registry;
- }
-
- /**
- */
- public OperationSelectorProvider createReferenceOperationSelectorProvider(RuntimeEndpointReference endpointReference) {
- return null;
- }
-
- /**
- */
- public OperationSelectorProvider createServiceOperationSelectorProvider(RuntimeEndpoint endpoint) {
- return new OperationSelectorJMSUserPropServiceProvider(endpoint);
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.ProviderFactory#getModelType()
- */
- public Class getModelType() {
- return null;
- }
-
-}
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsuserprop/runtime/OperationSelectorJMSUserPropServiceInterceptor.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsuserprop/runtime/OperationSelectorJMSUserPropServiceInterceptor.java
deleted file mode 100644
index 343aa8d52a..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/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.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.JMSBindingException;
-import org.apache.tuscany.sca.binding.jms.context.JMSBindingContext;
-import org.apache.tuscany.sca.binding.jms.operationselector.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.RuntimeEndpoint;
-
-/**
- * Interceptor for user property based operation selection
- *
- * <operationSelector.jmsUser propertName="MyHeaderProperty"/>
- *
- */
-public class OperationSelectorJMSUserPropServiceInterceptor implements Interceptor {
-
- private Invoker next;
- private RuntimeEndpoint endpoint;
- private JMSBinding jmsBinding;
- private OperationSelectorJMSUserProp operationSelector;
- private RuntimeComponentService service;
- private List<Operation> serviceOperations;
-
- public OperationSelectorJMSUserPropServiceInterceptor(RuntimeEndpoint endpoint) {
- super();
- this.jmsBinding = (JMSBinding) endpoint.getBinding();
- this.operationSelector = (OperationSelectorJMSUserProp)jmsBinding.getOperationSelector();
- this.endpoint = endpoint;
- this.service = (RuntimeComponentService) endpoint.getService();
- 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/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsuserprop/runtime/OperationSelectorJMSUserPropServiceProvider.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsuserprop/runtime/OperationSelectorJMSUserPropServiceProvider.java
deleted file mode 100644
index a151688c36..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsuserprop/runtime/OperationSelectorJMSUserPropServiceProvider.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.jms.operationselector.jmsuserprop.runtime;
-
-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.RuntimeEndpoint;
-
-public class OperationSelectorJMSUserPropServiceProvider implements OperationSelectorProvider {
- private RuntimeEndpoint endpoint;
-
- public OperationSelectorJMSUserPropServiceProvider(RuntimeEndpoint endpoint) {
- super();
- this.endpoint = endpoint;
- }
-
- /**
- */
- public Interceptor createInterceptor() {
- return new OperationSelectorJMSUserPropServiceInterceptor(endpoint);
- }
-
- /**
- */
- public String getPhase() {
- return Phase.SERVICE_BINDING_OPERATION_SELECTOR;
- }
-
-}
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/provider/JMSTokenAuthenticationPolicyProviderFactory.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/provider/JMSTokenAuthenticationPolicyProviderFactory.java
deleted file mode 100644
index edecc18d2d..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/provider/JMSTokenAuthenticationPolicyProviderFactory.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.jms.policy.authentication.token.provider;
-
-import org.apache.tuscany.sca.assembly.Endpoint;
-import org.apache.tuscany.sca.assembly.EndpointReference;
-import org.apache.tuscany.sca.assembly.Implementation;
-import org.apache.tuscany.sca.binding.jms.policy.authentication.token.JMSTokenAuthenticationPolicy;
-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;
-
-/**
- * @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(EndpointReference endpointReference) {
- return new JMSTokenAuthenticationReferencePolicyProvider(endpointReference);
- }
-
- /**
- * @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(Endpoint endpoint) {
- return new JMSTokenAuthenticationServicePolicyProvider(endpoint);
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.ProviderFactory#getModelType()
- */
- public Class getModelType() {
- return null;
- }
-
- public PolicyProvider createImplementationPolicyProvider(RuntimeComponent arg0) {
- return null;
- }
-
-}
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/provider/JMSTokenAuthenticationReferencePolicyInterceptor.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/provider/JMSTokenAuthenticationReferencePolicyInterceptor.java
deleted file mode 100644
index c5d0705eb6..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/provider/JMSTokenAuthenticationReferencePolicyInterceptor.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.jms.policy.authentication.token.provider;
-
-
-import javax.jms.JMSException;
-import javax.security.auth.Subject;
-
-import org.apache.tuscany.sca.binding.jms.JMSBindingException;
-import org.apache.tuscany.sca.binding.jms.policy.authentication.token.JMSTokenAuthenticationPolicy;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.invocation.PhasedInterceptor;
-import org.apache.tuscany.sca.policy.PolicySet;
-import org.apache.tuscany.sca.policy.authentication.token.TokenPrincipal;
-import org.apache.tuscany.sca.policy.security.SecurityUtil;
-
-/**
- * Policy handler to handle PolicySet related to Logging with the QName
- * {http://tuscany.apache.org/xmlns/sca/1.1/impl/java}LoggingPolicy
- *
- * @version $Rev$ $Date$
- */
-public class JMSTokenAuthenticationReferencePolicyInterceptor implements PhasedInterceptor {
-
- private Invoker next;
- private PolicySet policySet = null;
- private String context;
- private JMSTokenAuthenticationPolicy policy;
- private String phase;
-
- public JMSTokenAuthenticationReferencePolicyInterceptor(String context, PolicySet policySet, String phase) {
- super();
- this.policySet = policySet;
- this.context = context;
- this.phase = phase;
- 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;
- }
-
- public String getPhase() {
- return phase;
- }
-}
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/provider/JMSTokenAuthenticationReferencePolicyProvider.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/provider/JMSTokenAuthenticationReferencePolicyProvider.java
deleted file mode 100644
index b3c7f40c55..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/provider/JMSTokenAuthenticationReferencePolicyProvider.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.policy.authentication.token.provider;
-
-import org.apache.tuscany.sca.assembly.EndpointReference;
-import org.apache.tuscany.sca.binding.jms.policy.authentication.token.JMSTokenAuthenticationPolicy;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Phase;
-import org.apache.tuscany.sca.invocation.PhasedInterceptor;
-import org.apache.tuscany.sca.policy.PolicySet;
-import org.apache.tuscany.sca.provider.BasePolicyProvider;
-
-/**
- * @version $Rev$ $Date$
- */
-public class JMSTokenAuthenticationReferencePolicyProvider extends BasePolicyProvider<JMSTokenAuthenticationPolicy> {
- private EndpointReference endpointReference;
-
- public JMSTokenAuthenticationReferencePolicyProvider(EndpointReference endpointReference) {
- super(JMSTokenAuthenticationPolicy.class, endpointReference);
- this.endpointReference = endpointReference;
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.PolicyProvider#createInterceptor(org.apache.tuscany.sca.interfacedef.Operation)
- */
- public PhasedInterceptor createInterceptor(Operation operation) {
- PolicySet ps = findPolicySet();
- return ps == null ? null : new JMSTokenAuthenticationReferencePolicyInterceptor(getContext(), ps, getPhase());
-
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.PolicyProvider#getPhase()
- */
- public String getPhase() {
- return Phase.REFERENCE_BINDING_POLICY;
- }
-
-}
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/provider/JMSTokenAuthenticationServicePolicyInterceptor.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/provider/JMSTokenAuthenticationServicePolicyInterceptor.java
deleted file mode 100644
index c570354981..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/provider/JMSTokenAuthenticationServicePolicyInterceptor.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.policy.authentication.token.provider;
-
-
-
-import javax.jms.JMSException;
-import javax.security.auth.Subject;
-
-import org.apache.tuscany.sca.binding.jms.JMSBindingException;
-import org.apache.tuscany.sca.binding.jms.context.JMSBindingContext;
-import org.apache.tuscany.sca.binding.jms.policy.authentication.token.JMSTokenAuthenticationPolicy;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.invocation.PhasedInterceptor;
-import org.apache.tuscany.sca.policy.PolicySet;
-import org.apache.tuscany.sca.policy.authentication.token.TokenPrincipal;
-import org.apache.tuscany.sca.policy.security.SecurityUtil;
-
-/**
- * Policy handler to handle token based authentication
- * {http://tuscany.apache.org/xmlns/sca/1.1/impl/java}LoggingPolicy
- *
- * @version $Rev$ $Date$
- */
-public class JMSTokenAuthenticationServicePolicyInterceptor implements PhasedInterceptor {
- private Invoker next;
- private PolicySet policySet = null;
- private String context;
- private JMSTokenAuthenticationPolicy policy;
- private String phase;
-
- public JMSTokenAuthenticationServicePolicyInterceptor(String context, PolicySet policySet, String phase) {
- super();
- this.policySet = policySet;
- this.context = context;
- this.phase = phase;
- 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;
- }
-
- public String getPhase() {
- return phase;
- }
-}
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/provider/JMSTokenAuthenticationServicePolicyProvider.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/provider/JMSTokenAuthenticationServicePolicyProvider.java
deleted file mode 100644
index 351b1c3f0f..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/provider/JMSTokenAuthenticationServicePolicyProvider.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.policy.authentication.token.provider;
-
-import org.apache.tuscany.sca.assembly.Endpoint;
-import org.apache.tuscany.sca.binding.jms.policy.authentication.token.JMSTokenAuthenticationPolicy;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Phase;
-import org.apache.tuscany.sca.invocation.PhasedInterceptor;
-import org.apache.tuscany.sca.policy.PolicySet;
-import org.apache.tuscany.sca.provider.BasePolicyProvider;
-
-/**
- * @version $Rev$ $Date$
- */
-public class JMSTokenAuthenticationServicePolicyProvider extends BasePolicyProvider<JMSTokenAuthenticationPolicy> {
-
- private Endpoint endpoint;
-
- public JMSTokenAuthenticationServicePolicyProvider(Endpoint endpoint) {
- super(JMSTokenAuthenticationPolicy.class, endpoint);
- this.endpoint = endpoint;
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.PolicyProvider#createInterceptor(org.apache.tuscany.sca.interfacedef.Operation)
- */
- public PhasedInterceptor createInterceptor(Operation operation) {
- PolicySet ps = findPolicySet();
- return ps == null ? null : new JMSTokenAuthenticationServicePolicyInterceptor(getContext(), ps, getPhase());
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.PolicyProvider#getPhase()
- */
- public String getPhase() {
- return Phase.SERVICE_BINDING_POLICY;
- }
-
-}
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/policy/header/provider/JMSHeaderPolicyProviderFactory.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/policy/header/provider/JMSHeaderPolicyProviderFactory.java
deleted file mode 100644
index 4a199bcdff..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/policy/header/provider/JMSHeaderPolicyProviderFactory.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.jms.policy.header.provider;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.Endpoint;
-import org.apache.tuscany.sca.assembly.EndpointReference;
-import org.apache.tuscany.sca.assembly.Implementation;
-import org.apache.tuscany.sca.binding.jms.policy.header.JMSHeaderPolicy;
-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.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(EndpointReference endpointReference) {
- return new JMSHeaderReferencePolicyProvider(endpointReference);
- }
-
- /**
- * @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;
- }
-
- public PolicyProvider createImplementationPolicyProvider(RuntimeComponent arg0) {
- return null; // Not used for a Binding
- }
-
- public PolicyProvider createServicePolicyProvider(Endpoint arg0) {
- // TODO Auto-generated method stub
- return null;
- }
-
-}
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/policy/header/provider/JMSHeaderReferencePolicyInterceptor.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/policy/header/provider/JMSHeaderReferencePolicyInterceptor.java
deleted file mode 100644
index 967614f9b9..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/policy/header/provider/JMSHeaderReferencePolicyInterceptor.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.header.provider;
-
-
-import org.apache.tuscany.sca.assembly.EndpointReference;
-import org.apache.tuscany.sca.binding.jms.context.JMSBindingContext;
-import org.apache.tuscany.sca.binding.jms.policy.header.JMSHeaderPolicy;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.invocation.PhasedInterceptor;
-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.1/impl/java}LoggingPolicy
- *
- * @version $Rev$ $Date$
- */
-public class JMSHeaderReferencePolicyInterceptor implements PhasedInterceptor {
-
- private Invoker next;
- private PolicySet policySet = null;
- private String context;
- private JMSHeaderPolicy jmsHeaderPolicy;
- private String phase;
- private EndpointReference endpointReference;
-
- public JMSHeaderReferencePolicyInterceptor(String context, EndpointReference endpointReference, PolicySet policySet, String phase) {
- super();
- this.endpointReference = endpointReference;
- this.policySet = policySet;
- this.context = context;
- this.phase = phase;
-
- 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;
- }
-
- public String getPhase() {
- return phase;
- }
-}
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/policy/header/provider/JMSHeaderReferencePolicyProvider.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/policy/header/provider/JMSHeaderReferencePolicyProvider.java
deleted file mode 100644
index b3d7b584aa..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/policy/header/provider/JMSHeaderReferencePolicyProvider.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.jms.policy.header.provider;
-
-import org.apache.tuscany.sca.assembly.EndpointReference;
-import org.apache.tuscany.sca.binding.jms.policy.header.JMSHeaderPolicy;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Phase;
-import org.apache.tuscany.sca.invocation.PhasedInterceptor;
-import org.apache.tuscany.sca.policy.PolicySet;
-import org.apache.tuscany.sca.provider.BasePolicyProvider;
-
-/**
- * @version $Rev$ $Date$
- */
-public class JMSHeaderReferencePolicyProvider extends BasePolicyProvider<JMSHeaderPolicy> {
-
- private EndpointReference endpointReference;
-
- public JMSHeaderReferencePolicyProvider(EndpointReference endpointReference) {
- super(JMSHeaderPolicy.class, endpointReference);
- this.endpointReference = endpointReference;
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.PolicyProvider#createInterceptor(org.apache.tuscany.sca.interfacedef.Operation)
- */
- public PhasedInterceptor createInterceptor(Operation operation) {
- PolicySet ps = findPolicySet();
- return ps == null ? null : new JMSHeaderReferencePolicyInterceptor(getContext(), endpointReference, ps, getPhase());
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.PolicyProvider#getPhase()
- */
- public String getPhase() {
- return Phase.REFERENCE_BINDING_POLICY;
- }
-
-
-}
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/AbstractMessageProcessor.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/AbstractMessageProcessor.java
deleted file mode 100644
index 6c6339c88e..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/AbstractMessageProcessor.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.binding.jms.provider;
-
-import java.io.PrintWriter;
-import java.io.StringWriter;
-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.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.JMSBindingConstants;
-import org.apache.tuscany.sca.binding.jms.JMSBindingException;
-import org.oasisopen.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();
- if (o instanceof RuntimeException || o instanceof Error) {
- int recursionKlugeDetector = 20;
- Throwable rootCause = o;
- Throwable deepRootCause = rootCause.getCause();
- do {
- if (rootCause == deepRootCause) {
- break;
- } else if (deepRootCause != null) {
- rootCause = deepRootCause;
- }
-
- if (recursionKlugeDetector-- <= 0) {
- break;
- }
- } while (deepRootCause != null);
-
- final StringWriter sw = new StringWriter();
- final PrintWriter pw = new PrintWriter(sw);
- pw.print("Message = " + o.getMessage());
- StackTraceElement[] stackElements = o.getStackTrace();
- for (int i = 0; i < stackElements.length; i++) {
- pw.print("\t>> \t at ");
- pw.println(stackElements[i].toString());
- }
- pw.flush();
-
- message.setObject(new RuntimeException( sw.toString() ));
- } else {
- 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/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/BytesMessageProcessor.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/BytesMessageProcessor.java
deleted file mode 100644
index 7b14d29dfa..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/BytesMessageProcessor.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.jms.provider;
-
-import java.util.logging.Logger;
-
-import javax.jms.BytesMessage;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.Session;
-
-import org.apache.tuscany.sca.binding.jms.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.JMSBindingException;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-
-/**
- * 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, ExtensionPointRegistry registry) {
- 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/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/DefaultJMSResourceFactoryExtensionPoint.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/DefaultJMSResourceFactoryExtensionPoint.java
deleted file mode 100644
index 32531fa6c3..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/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.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/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/DefaultMessageProcessor.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/DefaultMessageProcessor.java
deleted file mode 100644
index c538dd01da..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/DefaultMessageProcessor.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.binding.jms.provider;
-
-import java.io.IOException;
-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.namespace.QName;
-
-import org.apache.tuscany.sca.binding.jms.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.JMSBindingConstants;
-import org.apache.tuscany.sca.binding.jms.JMSBindingException;
-import org.apache.tuscany.sca.common.xml.dom.DOMHelper;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.interfacedef.util.FaultException;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.xml.sax.SAXException;
-
-/**
- * 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());
-
- private DOMHelper domHelper;
-
- public DefaultMessageProcessor(JMSBinding jmsBinding, ExtensionPointRegistry registry) {
- super(jmsBinding);
- this.domHelper = DOMHelper.getInstance(registry);
- }
-
- // 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, Node wrapper) {
- if (msg instanceof TextMessage) {
- try {
- String xml = ((TextMessage) msg).getText();
-
- Object os;
- if (xml != null && xml.length() > 0) {
- os = domHelper.load(xml);
- } else {
- os = null;
- }
-
- if (wrapper != null){
- //don't modify the original wrapper since it will be reused
- //clone the wrapper
- Node node = ((Node)os);
- if (node == null) {
- node = domHelper.newDocument();
- }
- Element newWrapper = DOMHelper.createElement((Document)node, new QName(wrapper.getNamespaceURI(), wrapper.getLocalName()));
- if (os != null){
- Node child = node.getFirstChild();
- newWrapper.appendChild(child);
- }
- return newWrapper;
- }
-
- return os;
-
- } catch (JMSException e) {
- throw new JMSBindingException(e);
- } catch (IOException e) {
- throw new JMSBindingException(e);
- } catch (SAXException 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 Node) {
-
- if (unwrap){
- Node firstElement = ((Node)o).getFirstChild();
- if (firstElement == null ) {
- message.setText("");
- } else {
- message.setText(domHelper.saveAsString(firstElement));
- }
- }else {
- message.setText(domHelper.saveAsString((Node)o));
- }
- } else if ((o instanceof Object[]) && ((Object[]) o)[0] instanceof Node) {
- if (unwrap){
- Node firstElement = ((Node)((Object[]) o)[0]).getFirstChild();
- if (firstElement == null ) {
- message.setText(null);
- } else {
- message.setText(domHelper.saveAsString(firstElement));
- }
- }else {
- message.setText(domHelper.saveAsString((Node)((Object[])o)[0]));
- }
- } else if (o != null) {
- throw new IllegalStateException("expecting Node 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(domHelper.saveAsString((Node)((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, Node 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)) {
- os = domHelper.load(new String(bytes));
- } else {
- os = null;
- }
-
- if (wrapper != null){
- //don't modify the original wrapper since it will be reused
- //clone the wrapper
- Node node = ((Node)os);
- if (node == null) {
- node = domHelper.newDocument();
- }
- Element newWrapper = DOMHelper.createElement((Document)node, new QName(wrapper.getNamespaceURI(), wrapper.getLocalName()));
- if (os != null){
- Node child = node.getFirstChild();
- newWrapper.appendChild(child);
- }
- return newWrapper;
- }
-
- return os;
-
- } catch (JMSException e) {
- throw new JMSBindingException(e);
- } catch (IOException e) {
- throw new JMSBindingException(e);
- } catch (SAXException 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 Node) {
- if (unwrap) {
- Node firstElement = ((Node)o).getFirstChild();
- if (firstElement == null ) {
- //do nothing, the message will just be set with a byte[0]
- } else {
- message.writeBytes(domHelper.saveAsString(firstElement).getBytes());
- }
-
- } else {
- message.writeBytes(domHelper.saveAsString((Node)o).getBytes());
- }
-
- } else if ((o instanceof Object[]) && ((Object[]) o)[0] instanceof Node) {
- if (unwrap){
- Node firstElement = ((Node)((Object[]) o)[0]).getFirstChild();
- if (firstElement == null ) {
- //do nothing, the message will just be set with a byte[0]
- } else {
- message.writeBytes(domHelper.saveAsString(firstElement).getBytes());
- }
-
- }else {
- message.writeBytes(domHelper.saveAsString((Node)((Object[]) o)[0]).getBytes());
- }
- } else if (o != null) {
- throw new IllegalStateException("expecting Node 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();
- String s = domHelper.saveAsString((Node)((FaultException)o).getFaultInfo());
- message.writeBytes(s.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/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingProviderFactory.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingProviderFactory.java
deleted file mode 100644
index 15bd8713f2..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingProviderFactory.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.provider;
-
-import org.apache.tuscany.sca.binding.jms.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.host.DefaultJMSHostExtensionPoint;
-import org.apache.tuscany.sca.binding.jms.host.JMSHostExtensionPoint;
-import org.apache.tuscany.sca.binding.jms.host.JMSServiceListenerFactory;
-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.RuntimeEndpoint;
-import org.apache.tuscany.sca.runtime.RuntimeEndpointReference;
-
-/**
- * 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);
- if (jmsHostExtensionPoint == null) {
- jmsHostExtensionPoint = new DefaultJMSHostExtensionPoint(extensionPoints);
- extensionPoints.addExtensionPoint(jmsHostExtensionPoint);
- }
- serviceListenerFactory = jmsHostExtensionPoint.getJMSServiceListenerFactory();
- }
-
- public ReferenceBindingProvider createReferenceBindingProvider(RuntimeEndpointReference endpointReference) {
- JMSResourceFactory jmsRF = jmsRFEP.createJMSResourceFactory((JMSBinding)endpointReference.getBinding());
- return new JMSBindingReferenceBindingProvider(endpointReference, extensionPoints, jmsRF);
- }
-
- public ServiceBindingProvider createServiceBindingProvider(RuntimeEndpoint endpoint) {
- JMSBinding binding = (JMSBinding)endpoint.getBinding();
- JMSResourceFactory jmsRF = jmsRFEP.createJMSResourceFactory(binding);
- return new JMSBindingServiceBindingProvider(extensionPoints, endpoint, serviceListenerFactory, extensionPoints, jmsRF);
- }
-
- public Class<JMSBinding> getModelType() {
- return JMSBinding.class;
- }
-
-}
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingReferenceBindingProvider.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingReferenceBindingProvider.java
deleted file mode 100644
index 4ee0719707..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingReferenceBindingProvider.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.jms.provider;
-
-import javax.jms.JMSException;
-
-import org.apache.tuscany.sca.binding.jms.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.JMSBindingException;
-import org.apache.tuscany.sca.binding.jms.headers.HeaderReferenceInterceptor;
-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.EndpointReferenceProvider;
-import org.apache.tuscany.sca.provider.ProviderFactoryExtensionPoint;
-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.RuntimeEndpointReference;
-
-/**
- * Implementation of the JMS reference binding provider.
- *
- * @version $Rev$ $Date$
- */
-public class JMSBindingReferenceBindingProvider implements EndpointReferenceProvider {
-
- private RuntimeEndpointReference endpointReference;
- 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(RuntimeEndpointReference endpointReference, ExtensionPointRegistry extensions, JMSResourceFactory jmsResourceFactory) {
- this.endpointReference = endpointReference;
- this.reference = (RuntimeComponentReference) endpointReference.getReference();
- this.jmsBinding = (JMSBinding) endpointReference.getBinding();
- this.extensions = extensions;
- this.component = (RuntimeComponent) endpointReference.getComponent();
- 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(endpointReference);
- }
-
- this.responseWireFormatProviderFactory =
- (WireFormatProviderFactory)providerFactories.getProviderFactory(jmsBinding.getResponseWireFormat().getClass());
- if (this.responseWireFormatProviderFactory != null){
- this.responseWireFormatProvider = responseWireFormatProviderFactory.createReferenceWireFormatProvider(endpointReference);
- }
-
- // 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()) { // TODO: 2.x migration, is this check needed?
- throw new JMSBindingException("No destination specified for reference " + reference.getName());
-// }
- }
-
- if ( jmsBinding.getActivationSpecName() != null ) {
- throw new JMSBindingException("Activation spec can not be specified on an SCA reference binding.");
- }
- Invoker invoker = null;
- invoker = new RRBJMSBindingInvoker(operation, jmsResourceFactory, endpointReference);
-
- 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 configure() {
-
- InvocationChain bindingChain = endpointReference.getBindingInvocationChain();
-
- // add transport interceptor
- bindingChain.addInterceptor(Phase.REFERENCE_BINDING_TRANSPORT,
- new TransportReferenceInterceptor(jmsBinding,
- jmsResourceFactory,
- endpointReference) );
-
- // 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(extensions,
- jmsBinding,
- jmsResourceFactory,
- endpointReference) );
- }
-
-}
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingServiceBindingProvider.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingServiceBindingProvider.java
deleted file mode 100644
index 8428a45c6e..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingServiceBindingProvider.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.binding.jms.provider;
-
-import java.util.logging.Logger;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.binding.jms.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.JMSBindingException;
-import org.apache.tuscany.sca.binding.jms.headers.HeaderServiceInterceptor;
-import org.apache.tuscany.sca.binding.jms.host.JMSServiceListener;
-import org.apache.tuscany.sca.binding.jms.host.JMSServiceListenerDetails;
-import org.apache.tuscany.sca.binding.jms.host.JMSServiceListenerFactory;
-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.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.core.FactoryExtensionPoint;
-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.EndpointProvider;
-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.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.RuntimeEndpoint;
-
-/**
- * Implementation of the JMS service binding provider.
- *
- * @version $Rev$ $Date$
- */
-public class JMSBindingServiceBindingProvider implements EndpointProvider, JMSServiceListenerDetails {
- private static final Logger logger = Logger.getLogger(JMSBindingServiceBindingProvider.class.getName());
-
- private ExtensionPointRegistry registry;
- private RuntimeEndpoint endpoint;
- 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 FactoryExtensionPoint modelFactories;
-
- private MessageFactory messageFactory;
-
- private OperationSelectorProviderFactory operationSelectorProviderFactory;
- private OperationSelectorProvider operationSelectorProvider;
-
- private WireFormatProviderFactory requestWireFormatProviderFactory;
- private WireFormatProvider requestWireFormatProvider;
-
- private WireFormatProviderFactory responseWireFormatProviderFactory;
- private WireFormatProvider responseWireFormatProvider;
-
- public JMSBindingServiceBindingProvider(ExtensionPointRegistry registry, RuntimeEndpoint endpoint, JMSServiceListenerFactory serviceListenerFactory, ExtensionPointRegistry extensionPoints, JMSResourceFactory jmsResourceFactory) {
- this.endpoint = endpoint;
- this.component = (RuntimeComponent) endpoint.getComponent();
- this.service = (RuntimeComponentService) endpoint.getService();
- this.jmsBinding = (JMSBinding) endpoint.getBinding();
- this.serviceListenerFactory = serviceListenerFactory;
- this.targetBinding = jmsBinding;
- this.jmsResourceFactory = jmsResourceFactory;
- this.registry = registry;
-
- if (jmsBinding.getResponseActivationSpecName() != null && jmsBinding.getResponseActivationSpecName().length() > 0) {
- throw new JMSBindingException("[BJM30023] response/activationSpec element MUST NOT be present when the binding is being used for an SCA service");
- }
-
- // 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()) { // TODO: 2.x migration, is this check needed?
- // use the SCA service name as the default destination name
- jmsBinding.setDestinationName(service.getName());
-// }
- }
-
- // Get Message factory
- modelFactories = extensionPoints.getExtensionPoint(FactoryExtensionPoint.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(endpoint);
- }
-
- // Get the factories/providers for wire format
- this.requestWireFormatProviderFactory =
- (WireFormatProviderFactory)providerFactories.getProviderFactory(jmsBinding.getRequestWireFormat().getClass());
- if (this.requestWireFormatProviderFactory != null){
- this.requestWireFormatProvider = requestWireFormatProviderFactory.createServiceWireFormatProvider(endpoint);
- }
-
- this.responseWireFormatProviderFactory =
- (WireFormatProviderFactory)providerFactories.getProviderFactory(jmsBinding.getResponseWireFormat().getClass());
- if (this.responseWireFormatProviderFactory != null){
- this.responseWireFormatProvider = responseWireFormatProviderFactory.createServiceWireFormatProvider(endpoint);
- }
-
- // 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) {
- if (e instanceof JMSBindingException) throw (JMSBindingException)e;
- throw new JMSBindingException("Error starting JMSServiceBinding", e);
- }
- }
-
- public void stop() {
- try {
- serviceListener.stop();
- } catch (Exception e) {
- if (e instanceof JMSBindingException) throw (JMSBindingException)e;
- throw new JMSBindingException("Error stopping JMSServiceBinding", e);
- }
- }
-
- public String getDestinationName() {
- return serviceListener.getDestinationName();
- }
-
- /*
- * Adds JMS specific interceptors to the binding chain
- */
- public void configure() {
-
- InvocationChain bindingChain = endpoint.getBindingInvocationChain();
-
- // add transport interceptor
- bindingChain.addInterceptor(Phase.SERVICE_BINDING_TRANSPORT,
- new TransportServiceInterceptor(registry, jmsBinding,
- jmsResourceFactory,
- endpoint) );
-
- // 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, endpoint));
-
- // add callback destination interceptor after operation selector
- bindingChain.addInterceptor(Phase.SERVICE_BINDING_WIREFORMAT,
- new CallbackDestinationInterceptor(endpoint));
-
- bindingChain.addInterceptor(Phase.SERVICE_BINDING_WIREFORMAT, new HeaderServiceInterceptor(jmsBinding));
-
- // 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;
- }
-
- public RuntimeEndpoint getEndpoint() {
- return endpoint;
- }
-
-}
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSMessageProcessor.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSMessageProcessor.java
deleted file mode 100644
index 821b9d7873..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/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/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSMessageProcessorUtil.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSMessageProcessorUtil.java
deleted file mode 100644
index b7622c942e..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSMessageProcessorUtil.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.provider;
-
-import java.lang.reflect.Constructor;
-
-import org.apache.tuscany.sca.binding.jms.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.JMSBindingException;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-
-/**
- * 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);
-// }
-//
- private static Object instantiate(ClassLoader cl, String className, JMSBinding binding, ExtensionPointRegistry registry) {
- 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, ExtensionPointRegistry.class});
- instance = constructor.newInstance(binding, registry);
-
- } catch (Throwable e) {
- throw new JMSBindingException("Exception instantiating OperationAndDataBinding class", e);
- }
-
- return instance;
- }
-
- public static JMSMessageProcessor getRequestMessageProcessor(ExtensionPointRegistry registry, JMSBinding binding) {
- return (JMSMessageProcessor)instantiate(null, binding.getRequestMessageProcessorName(), binding, registry);
- }
-
- public static JMSMessageProcessor getResponseMessageProcessor(ExtensionPointRegistry registry, JMSBinding binding) {
- return (JMSMessageProcessor)instantiate(null, binding.getResponseMessageProcessorName(), binding, registry);
- }
-
-}
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSResourceFactory.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSResourceFactory.java
deleted file mode 100644
index 5aaeca4ebc..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSResourceFactory.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.jms.provider;
-
-import javax.jms.Connection;
-import javax.jms.Destination;
-import javax.jms.JMSException;
-import javax.jms.Session;
-import javax.naming.NamingException;
-import javax.resource.spi.ActivationSpec;
-
-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();
-
- public abstract ActivationSpec lookupActivationSpec(
- String activationSpecName);
-}
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSResourceFactoryExtensionPoint.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSResourceFactoryExtensionPoint.java
deleted file mode 100644
index afd2508043..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/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.JMSBinding;
-
-public interface JMSResourceFactoryExtensionPoint {
-
- JMSResourceFactory createJMSResourceFactory(JMSBinding binding);
-
-}
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSResourceFactoryImpl.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSResourceFactoryImpl.java
deleted file mode 100644
index 9c1a384c7a..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSResourceFactoryImpl.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.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 javax.resource.spi.ActivationSpec;
-
-import org.apache.tuscany.sca.binding.jms.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 {
- Object o = jndiLookUp(connectionFactoryName);
- if (o == null) {
- throw new JMSBindingException("connection factory not found: " + connectionFactoryName);
- }
- if (!(o instanceof ConnectionFactory)) {
- throw new JMSBindingException("JNDI resource '" + connectionFactoryName +"' is not a JMS ConnectionFactory");
- }
- ConnectionFactory connectionFactory = (ConnectionFactory)o;
- 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 {
- if ( jndiName == null )
- return null;
-
- 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;
- }
-
- public ActivationSpec lookupActivationSpec(String activationSpecName) {
- Object o = jndiLookUp(activationSpecName);
- if ( o == null )
- return null;
- else if (o instanceof ActivationSpec)
- return (ActivationSpec) o;
-
- throw new JMSBindingException("Incorrect resource type for ActivationSpec: " + o.getClass().getName());
- }
-
-}
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/ObjectMessageProcessor.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/ObjectMessageProcessor.java
deleted file mode 100644
index db0b94dce1..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/ObjectMessageProcessor.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.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.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.JMSBindingException;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.oasisopen.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, ExtensionPointRegistry registry) {
- 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/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/RRBJMSBindingInvoker.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/RRBJMSBindingInvoker.java
deleted file mode 100644
index 098bdde3ae..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/RRBJMSBindingInvoker.java
+++ /dev/null
@@ -1,269 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, 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.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.JMSBindingConstants;
-import org.apache.tuscany.sca.binding.jms.JMSBindingException;
-import org.apache.tuscany.sca.binding.jms.context.JMSBindingContext;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.util.FaultException;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.runtime.RuntimeEndpointReference;
-import org.oasisopen.sca.ServiceRuntimeException;
-
-/**
- * Invoker for the JMS binding.
- *
- * @version $Rev$ $Date$
- */
-public class RRBJMSBindingInvoker implements Invoker {
-
- protected Operation operation;
- protected String operationName;
-
- protected JMSBinding jmsBinding;
- protected JMSResourceFactory jmsResourceFactory;
- protected Destination bindingRequestDest;
- protected Destination bindingReplyDest;
- protected RuntimeEndpointReference endpointReference;
-
- public RRBJMSBindingInvoker(Operation operation, JMSResourceFactory jmsResourceFactory, RuntimeEndpointReference epr) {
-
- this.operation = operation;
- operationName = operation.getName();
-
- this.endpointReference = epr;
- this.jmsBinding = (JMSBinding) epr.getBinding();
- this.jmsResourceFactory = jmsResourceFactory;
-
- 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()) { // TODO: 2.x migration, is this check needed?
- 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();
- }
-
- // FIXME: [rfeng] A hack to remove jms:jndi: prefix
- if (queueName.startsWith("jms:jndi:")) {
- queueName = queueName.substring("jms:jndi:".length());
- }
-
- 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
- // but don't create when using jms:jndi uri format
- if (dest == null && !"jndi".equals(jmsBinding.getDestinationType())) {
- 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 = endpointReference.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()) { // TODO: 2.x migration, is this check needed?
-// 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;
- // [rfeng] If the oneway operation is part of bi-directional interface, the JMSReplyTo should be set
- if (operation.isNonBlocking() && endpointReference.getComponentReferenceInterfaceContract()
- .getCallbackInterface() == null) {
- replyToDest = null;
- } else {
- if (bindingReplyDest != null) {
- replyToDest = bindingReplyDest;
- } else {
- replyToDest = session.createTemporaryQueue();
- }
- }
- return replyToDest;
- }
-
-}
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/TextMessageProcessor.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/TextMessageProcessor.java
deleted file mode 100644
index b468c73e7a..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/TextMessageProcessor.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.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.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.JMSBindingException;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-
-/**
- * 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, ExtensionPointRegistry registry) {
- 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/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/XMLBytesMessageProcessor.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/XMLBytesMessageProcessor.java
deleted file mode 100644
index 69a69064d0..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/XMLBytesMessageProcessor.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.io.IOException;
-import java.util.logging.Logger;
-
-import javax.jms.BytesMessage;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.Session;
-
-import org.apache.tuscany.sca.binding.jms.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.JMSBindingConstants;
-import org.apache.tuscany.sca.binding.jms.JMSBindingException;
-import org.apache.tuscany.sca.common.xml.dom.DOMHelper;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.interfacedef.util.FaultException;
-import org.w3c.dom.Node;
-import org.xml.sax.SAXException;
-
-/**
- * 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());
-
- private DOMHelper domHelper;
-
- public XMLBytesMessageProcessor(JMSBinding jmsBinding, ExtensionPointRegistry registry) {
- super(jmsBinding);
- this.domHelper = DOMHelper.getInstance(registry);
- }
-
- @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) {
- os = domHelper.load(new String(bytes));
- } else {
- os = null;
- }
- return os;
- } catch (JMSException e) {
- throw new JMSBindingException(e);
- } catch (IOException e) {
- throw new JMSBindingException(e);
- } catch (SAXException 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 Node) {
- message.writeBytes(domHelper.saveAsString((Node)o).getBytes());
- } else if ((o instanceof Object[]) && ((Object[])o)[0] instanceof Node) {
- message.writeBytes(domHelper.saveAsString((Node)((Object[])o)[0]).getBytes());
- } else if (o != null) {
- throw new IllegalStateException("expecting Node 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(domHelper.saveAsString((Node)((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/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/XMLTextMessageProcessor.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/XMLTextMessageProcessor.java
deleted file mode 100644
index 5031f55c6b..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/XMLTextMessageProcessor.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.jms.provider;
-
-import java.io.IOException;
-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.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.JMSBindingConstants;
-import org.apache.tuscany.sca.binding.jms.JMSBindingException;
-import org.apache.tuscany.sca.common.xml.dom.DOMHelper;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.interfacedef.util.FaultException;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.xml.sax.SAXException;
-
-/**
- * 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());
-
- private DOMHelper domHelper;
-
- public XMLTextMessageProcessor(JMSBinding jmsBinding, ExtensionPointRegistry registry) {
- super(jmsBinding);
- this.domHelper = DOMHelper.getInstance(registry);
- }
-
- @Override
- protected Object extractPayload(Message msg) {
- try {
-
- String xml = ((TextMessage)msg).getText();
- Object os;
- if (xml != null) {
- os = domHelper.load(xml);
- } else {
- os = null;
- }
- return os;
-
- } catch (IOException e) {
- throw new JMSBindingException(e);
- } catch (JMSException e) {
- throw new JMSBindingException(e);
- } catch (SAXException 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 Element) {
- message.setText(domHelper.saveAsString((Node)o));
- } else if ((o instanceof Object[]) && ((Object[])o)[0] instanceof Node) {
- message.setText(domHelper.saveAsString((Node)((Object[])o)[0]));
- } else if (o != null) {
- throw new IllegalStateException("expecting Node 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(domHelper.saveAsString((Node)((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/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/transport/TransportReferenceInterceptor.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/transport/TransportReferenceInterceptor.java
deleted file mode 100644
index 3ed8021107..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/transport/TransportReferenceInterceptor.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.jms.transport;
-
-import javax.jms.DeliveryMode;
-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.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.JMSBindingConstants;
-import org.apache.tuscany.sca.binding.jms.JMSBindingException;
-import org.apache.tuscany.sca.binding.jms.context.JMSBindingContext;
-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.RuntimeEndpointReference;
-
-/**
- * Policy handler to handle PolicySet related to Logging with the QName
- * {http://tuscany.apache.org/xmlns/sca/1.1/impl/java}LoggingPolicy
- *
- * @version $Rev$ $Date$
- */
-public class TransportReferenceInterceptor implements Interceptor {
-
- private Invoker next;
- private JMSResourceFactory jmsResourceFactory;
- private JMSBinding jmsBinding;
-
- public TransportReferenceInterceptor(JMSBinding jmsBinding, JMSResourceFactory jmsResourceFactory, RuntimeEndpointReference runtimeWire) {
- super();
- this.jmsBinding = jmsBinding;
- this.jmsResourceFactory = jmsResourceFactory;
- }
-
- public Message invoke(Message msg) {
- Message responseMsg = invokeRequest(msg);
-
- // get the jms context
- JMSBindingContext context = msg.getBindingContext();
-
- // [rfeng] For oneway operation as part of the bi-directional interface, the JMSReplyTo is present
- if (context.getReplyToDestination() == null || msg.getOperation().isNonBlocking()) {
- 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.getEffectiveJMSTimeToLive(opName) != null) {
- producer.setTimeToLive(jmsBinding.getEffectiveJMSTimeToLive(msg.getOperation().getName()).longValue());
- }
-
- Integer priority = jmsBinding.getEffectiveJMSPriority(opName);
- if (priority != null) {
- producer.setPriority(priority.intValue());
- }
-
- Boolean deliveryModePersistent = jmsBinding.getEffectiveJMSDeliveryMode(opName);
- if (deliveryModePersistent != null) {
- producer.setDeliveryMode( deliveryModePersistent ? DeliveryMode.PERSISTENT : 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 = null;
- String correlationScheme = jmsBinding.getCorrelationScheme();
- if (correlationScheme == null || JMSBindingConstants.CORRELATE_MSG_ID.equalsIgnoreCase(correlationScheme)) {
- msgSelector = "JMSCorrelationID = '" + requestMessage.getJMSMessageID() + "'";
- } else if (JMSBindingConstants.CORRELATE_CORRELATION_ID.equalsIgnoreCase(correlationScheme)) {
- msgSelector = "JMSCorrelationID = '" + requestMessage.getJMSCorrelationID() + "'";
- }
-
- MessageConsumer consumer;
- if (msgSelector != null) {
- consumer = session.createConsumer(context.getReplyToDestination(), msgSelector);
- } else {
- consumer = session.createConsumer(context.getReplyToDestination());
- }
-
- 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/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/transport/TransportServiceInterceptor.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/transport/TransportServiceInterceptor.java
deleted file mode 100644
index d371bbba86..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/transport/TransportServiceInterceptor.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.jms.transport;
-
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import javax.jms.DeliveryMode;
-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.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.Endpoint;
-import org.apache.tuscany.sca.assembly.EndpointReference;
-import org.apache.tuscany.sca.binding.jms.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.JMSBindingConstants;
-import org.apache.tuscany.sca.binding.jms.JMSBindingException;
-import org.apache.tuscany.sca.binding.jms.context.JMSBindingContext;
-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.ExtensionPointRegistry;
-import org.apache.tuscany.sca.core.FactoryExtensionPoint;
-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.RuntimeEndpoint;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class TransportServiceInterceptor implements Interceptor {
- private static final Logger logger = Logger.getLogger(TransportServiceInterceptor.class.getName());
-
- private Invoker next;
- private JMSResourceFactory jmsResourceFactory;
- private JMSBinding jmsBinding;
- private JMSMessageProcessor responseMessageProcessor;
- private RuntimeComponentService service;
- private String correlationScheme;
- private AssemblyFactory assemblyFactory;
-
-
- public TransportServiceInterceptor(ExtensionPointRegistry registry, JMSBinding jmsBinding, JMSResourceFactory jmsResourceFactory, RuntimeEndpoint endpoint) {
- super();
- this.jmsBinding = jmsBinding;
- this.jmsResourceFactory = jmsResourceFactory;
- this.responseMessageProcessor = JMSMessageProcessorUtil.getResponseMessageProcessor(registry, jmsBinding);
- this.service = (RuntimeComponentService)endpoint.getService();
- this.correlationScheme = jmsBinding.getCorrelationScheme();
- FactoryExtensionPoint factories = registry.getExtensionPoint(FactoryExtensionPoint.class);
- this.assemblyFactory = factories.getFactory(AssemblyFactory.class);
- }
-
- 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 {
-
- EndpointReference from = assemblyFactory.createEndpointReference();
- Endpoint fromEndpoint = assemblyFactory.createEndpoint();
- from.setTargetEndpoint(fromEndpoint);
- from.setStatus(EndpointReference.Status.WIRED_TARGET_FOUND_AND_MATCHED);
- msg.setFrom(from);
- Endpoint callbackEndpoint = assemblyFactory.createEndpoint();
-// callbackEndpoint.setURI(callbackAddress); // TODO: is this needed? Seems to work without it
- callbackEndpoint.setUnresolved(true);
- from.setCallbackEndpoint(callbackEndpoint);
-
- return msg;
-// } catch (JMSException e) {
-// throw new JMSBindingException(e);
-// }
- }
-
- public Message invokeResponse(Message msg) {
- JMSBindingContext context = msg.getBindingContext();
- try {
-
- //if operation is oneway, return back.
- Operation operation = msg.getOperation();
- if (operation != null && operation.isNonBlocking()) {
- return msg;
- }
-
- 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;
- }
-
- if ((msg.getOperation() != null)) {
- String operationName = msg.getOperation().getName();
- if (jmsBinding.getEffectiveJMSPriority(operationName) != null) {
- responseJMSMsg.setJMSPriority(jmsBinding.getEffectiveJMSPriority(operationName));
- }
-
- if ( jmsBinding.getEffectiveJMSType(operationName) != null) {
- responseJMSMsg.setJMSType(jmsBinding.getEffectiveJMSType(operationName));
- }
-
- if ((jmsBinding.getEffectiveJMSDeliveryMode(operationName) != null)) {
- responseJMSMsg.setJMSDeliveryMode(jmsBinding.getEffectiveJMSDeliveryMode(operationName) ? DeliveryMode.PERSISTENT : DeliveryMode.NON_PERSISTENT);
- }
-
- if ((jmsBinding.getEffectiveJMSTimeToLive(operationName) != null)) {
- responseJMSMsg.setJMSExpiration(jmsBinding.getEffectiveJMSTimeToLive(operationName).longValue());
- }
- }
-
- 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);
- long timeToLive = requestJMSMsg.getJMSExpiration();
- producer.setTimeToLive(timeToLive);
-
- producer.send((javax.jms.Message)msg.getBody());
-
- producer.close();
-
- return msg;
-
- } catch (JMSException e) {
- throw new JMSBindingException(e);
- } finally {
- context.closeJmsResponseSession();
- }
- }
-
- public Invoker getNext() {
- return next;
- }
-
- public void setNext(Invoker next) {
- this.next = next;
- }
-
-}
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wire/CallbackDestinationInterceptor.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wire/CallbackDestinationInterceptor.java
deleted file mode 100644
index 0678f1edaa..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wire/CallbackDestinationInterceptor.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.wire;
-
-import java.util.List;
-
-import javax.jms.Destination;
-import javax.jms.JMSException;
-import javax.jms.Queue;
-import javax.jms.Topic;
-
-import org.apache.tuscany.sca.assembly.EndpointReference;
-import org.apache.tuscany.sca.binding.jms.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.JMSBindingConstants;
-import org.apache.tuscany.sca.binding.jms.JMSBindingException;
-import org.apache.tuscany.sca.binding.jms.context.JMSBindingContext;
-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.RuntimeEndpoint;
-
-public class CallbackDestinationInterceptor implements Interceptor {
- private Invoker next;
- private RuntimeComponentService service;
- private RuntimeEndpoint endpoint;
-
- public CallbackDestinationInterceptor(RuntimeEndpoint endpoint) {
- super();
- this.service = (RuntimeComponentService) endpoint.getService();
- this.endpoint = endpoint;
- }
-
- 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();
-
-
- if (service.getInterfaceContract().getCallbackInterface() != null) {
-
- String callbackdestName = jmsMsg.getStringProperty(JMSBindingConstants.CALLBACK_Q_PROPERTY);
- if (( callbackdestName == null) && ( jmsMsg.getJMSReplyTo() != null ) && msg.getOperation().isNonBlocking() ) {
- Destination replyTo = jmsMsg.getJMSReplyTo();
- if (replyTo != null) {
- callbackdestName = (replyTo instanceof Queue) ? ((Queue) replyTo).getQueueName() : ((Topic) replyTo).getTopicName();
- }
- } else {
- if (callbackdestName != null) {
- if (!callbackdestName.startsWith("jms:jndi:")) {
- throw new JMSBindingException("message property " + JMSBindingConstants.CALLBACK_Q_PROPERTY + " does not start with 'jms:jndi:' found: " + callbackdestName);
- } else {
- callbackdestName = callbackdestName.substring(9);
- }
- }
- }
-
- if (callbackdestName != null) {
- List<EndpointReference> refs = endpoint.getCallbackEndpointReferences();
- for (EndpointReference ref : refs ) {
- if (ref.getBinding() instanceof JMSBinding ) {
- JMSBinding callbackBinding = (JMSBinding) ref.getBinding();
- callbackBinding.setDestinationName(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/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wire/OperationPropertiesInterceptor.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wire/OperationPropertiesInterceptor.java
deleted file mode 100644
index bf046b473e..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wire/OperationPropertiesInterceptor.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.wire;
-
-import java.util.List;
-
-import org.apache.tuscany.sca.binding.jms.JMSBinding;
-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.RuntimeEndpoint;
-
-public class OperationPropertiesInterceptor implements Interceptor {
- private Invoker next;
- private JMSBinding jmsBinding;
- private RuntimeComponentService service;
- private List<Operation> serviceOperations;
-
- public OperationPropertiesInterceptor(JMSBinding jmsBinding, RuntimeEndpoint endpoint) {
- super();
- this.jmsBinding = jmsBinding;
- this.service = (RuntimeComponentService) endpoint.getService();
- 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/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesProviderFactory.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesProviderFactory.java
deleted file mode 100644
index 7675698cc7..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesProviderFactory.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.jms.wireformat.jmsbytes.runtime;
-
-import org.apache.tuscany.sca.binding.jms.wireformat.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.RuntimeEndpoint;
-import org.apache.tuscany.sca.runtime.RuntimeEndpointReference;
-
-/**
- * @version $Rev$ $Date$
- */
-public class WireFormatJMSBytesProviderFactory implements WireFormatProviderFactory<WireFormatJMSBytes> {
- private ExtensionPointRegistry registry;
-
- public WireFormatJMSBytesProviderFactory(ExtensionPointRegistry registry) {
- super();
- this.registry = registry;
- }
-
- /**
- */
- public WireFormatProvider createReferenceWireFormatProvider(RuntimeEndpointReference endpointReference) {
- return new WireFormatJMSBytesReferenceProvider(registry, endpointReference);
- }
-
- /**
- */
- public WireFormatProvider createServiceWireFormatProvider(RuntimeEndpoint endpoint) {
- return new WireFormatJMSBytesServiceProvider(registry, endpoint);
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.ProviderFactory#getModelType()
- */
- public Class getModelType() {
- // TODO Auto-generated method stub
- return null;
- }
-
-}
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesReferenceInterceptor.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesReferenceInterceptor.java
deleted file mode 100644
index 4620063076..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/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.binding.jms.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.JMSBindingException;
-import org.apache.tuscany.sca.binding.jms.context.JMSBindingContext;
-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.WireFormatJMSBytes;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-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.RuntimeEndpointReference;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class WireFormatJMSBytesReferenceInterceptor implements Interceptor {
-
- private Invoker next;
- private RuntimeEndpointReference endpointReference;
- private JMSResourceFactory jmsResourceFactory;
- private JMSBinding jmsBinding;
- private JMSMessageProcessor requestMessageProcessor;
- private JMSMessageProcessor responseMessageProcessor;
-
- public WireFormatJMSBytesReferenceInterceptor(ExtensionPointRegistry registry, JMSResourceFactory jmsResourceFactory, RuntimeEndpointReference endpointReference) {
- super();
- this.endpointReference = endpointReference;
- this.jmsBinding = (JMSBinding) endpointReference.getBinding();
- this.jmsResourceFactory = jmsResourceFactory;
- this.requestMessageProcessor = JMSMessageProcessorUtil.getRequestMessageProcessor(registry, jmsBinding);
- this.responseMessageProcessor = JMSMessageProcessorUtil.getResponseMessageProcessor(registry, 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/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesReferenceProvider.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesReferenceProvider.java
deleted file mode 100644
index 3d2c8ec18c..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesReferenceProvider.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.jms.wireformat.jmsbytes.runtime;
-
-import org.apache.tuscany.sca.binding.jms.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.JMSBindingConstants;
-import org.apache.tuscany.sca.binding.jms.wireformat.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.RuntimeEndpointReference;
-
-/**
- * @version $Rev$ $Date$
- */
-public class WireFormatJMSBytesReferenceProvider implements WireFormatProvider {
- private ExtensionPointRegistry registry;
- private RuntimeEndpointReference endpointReference;
- private JMSBinding binding;
- private InterfaceContract interfaceContract;
-
- public WireFormatJMSBytesReferenceProvider(ExtensionPointRegistry registry,
- RuntimeEndpointReference endpointReference) {
- super();
- this.registry = registry;
- this.endpointReference = endpointReference;
- this.binding = (JMSBinding) endpointReference.getBinding();
-
- // 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 = endpointReference.getReference().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(registry, null, endpointReference);
- }
-
- public String getPhase() {
- return Phase.REFERENCE_BINDING_WIREFORMAT;
- }
-
- public InterfaceContract getWireFormatInterfaceContract() {
- return interfaceContract;
- }
-}
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesServiceInterceptor.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesServiceInterceptor.java
deleted file mode 100644
index 506d47f8a3..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesServiceInterceptor.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.jmsbytes.runtime;
-
-import javax.jms.Session;
-
-import org.apache.tuscany.sca.binding.jms.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.context.JMSBindingContext;
-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.WireFormatJMSBytes;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-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.RuntimeEndpoint;
-
-/**
- * Policy handler to handle PolicySet related to Logging with the QName
- * {http://tuscany.apache.org/xmlns/sca/1.1/impl/java}LoggingPolicy
- *
- * @version $Rev$ $Date$
- */
-public class WireFormatJMSBytesServiceInterceptor implements Interceptor {
- private Invoker next;
- private RuntimeEndpoint endpoint;
- private JMSResourceFactory jmsResourceFactory;
- private JMSBinding jmsBinding;
- private JMSMessageProcessor requestMessageProcessor;
- private JMSMessageProcessor responseMessageProcessor;
-
- public WireFormatJMSBytesServiceInterceptor(ExtensionPointRegistry registry, JMSResourceFactory jmsResourceFactory, RuntimeEndpoint endpoint) {
- super();
- this.endpoint = endpoint;
- this.jmsBinding = (JMSBinding) endpoint.getBinding();
- this.jmsResourceFactory = jmsResourceFactory;
- this.requestMessageProcessor = JMSMessageProcessorUtil.getRequestMessageProcessor(registry, jmsBinding);
- this.responseMessageProcessor = JMSMessageProcessorUtil.getResponseMessageProcessor(registry, 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/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesServiceProvider.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesServiceProvider.java
deleted file mode 100644
index ef3530640f..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesServiceProvider.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.wireformat.jmsbytes.runtime;
-
-import org.apache.tuscany.sca.binding.jms.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.JMSBindingConstants;
-import org.apache.tuscany.sca.binding.jms.wireformat.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.RuntimeEndpoint;
-
-/**
- * @version $Rev$ $Date$
- */
-public class WireFormatJMSBytesServiceProvider implements WireFormatProvider {
- private ExtensionPointRegistry registry;
- private RuntimeEndpoint endpoint;
- private JMSBinding binding;
- private InterfaceContract interfaceContract;
-
- public WireFormatJMSBytesServiceProvider(ExtensionPointRegistry registry,
- RuntimeEndpoint endpoint) {
- super();
- this.registry = registry;
- this.endpoint = endpoint;
- this.binding = (JMSBinding) endpoint.getBinding();
-
- // 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 = endpoint.getService().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(registry, null, endpoint);
- }
-
- /**
- */
- public String getPhase() {
- return Phase.SERVICE_BINDING_WIREFORMAT;
- }
-
- public InterfaceContract getWireFormatInterfaceContract() {
- return interfaceContract;
- }
-}
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytesxml/runtime/WireFormatJMSBytesXMLProviderFactory.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytesxml/runtime/WireFormatJMSBytesXMLProviderFactory.java
deleted file mode 100644
index a791c5f0b9..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytesxml/runtime/WireFormatJMSBytesXMLProviderFactory.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.jmsbytesxml.runtime;
-
-import org.apache.tuscany.sca.binding.jms.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.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.RuntimeEndpoint;
-import org.apache.tuscany.sca.runtime.RuntimeEndpointReference;
-
-
-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(RuntimeEndpointReference endpointReference) {
- return new WireFormatJMSBytesXMLReferenceProvider(registry, endpointReference);
- }
-
- /**
- */
- public WireFormatProvider createServiceWireFormatProvider(RuntimeEndpoint endpoint) {
- JMSResourceFactory jmsRF = jmsRFEP.createJMSResourceFactory((JMSBinding)endpoint.getBinding());
- return new WireFormatJMSBytesXMLServiceProvider(registry, endpoint, jmsRF);
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.ProviderFactory#getModelType()
- */
- public Class getModelType() {
- // TODO Auto-generated method stub
- return null;
- }
-
-}
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytesxml/runtime/WireFormatJMSBytesXMLReferenceInterceptor.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytesxml/runtime/WireFormatJMSBytesXMLReferenceInterceptor.java
deleted file mode 100644
index e453940d30..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytesxml/runtime/WireFormatJMSBytesXMLReferenceInterceptor.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.jmsbytesxml.runtime;
-
-import javax.jms.JMSException;
-import javax.jms.Session;
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.binding.jms.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.JMSBindingConstants;
-import org.apache.tuscany.sca.binding.jms.JMSBindingException;
-import org.apache.tuscany.sca.binding.jms.context.JMSBindingContext;
-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.WireFormatJMSBytesXML;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-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.RuntimeEndpointReference;
-import org.w3c.dom.Node;
-
-
-public class WireFormatJMSBytesXMLReferenceInterceptor implements Interceptor {
-
- private Invoker next;
- private RuntimeEndpointReference endpointReference;
- private JMSResourceFactory jmsResourceFactory;
- private JMSBinding jmsBinding;
- private JMSMessageProcessor requestMessageProcessor;
- private JMSMessageProcessor responseMessageProcessor;
-
- public WireFormatJMSBytesXMLReferenceInterceptor(ExtensionPointRegistry registry, JMSResourceFactory jmsResourceFactory, RuntimeEndpointReference endpointReference) {
- super();
- this.jmsBinding = (JMSBinding) endpointReference.getBinding();
- this.endpointReference = endpointReference;
- this.jmsResourceFactory = jmsResourceFactory;
- this.requestMessageProcessor = JMSMessageProcessorUtil.getRequestMessageProcessor(registry, jmsBinding);
- this.responseMessageProcessor = JMSMessageProcessorUtil.getResponseMessageProcessor(registry, 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);
- Node om = ((Node)response).getFirstChild();
- e.setFaultName(new QName(om.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/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytesxml/runtime/WireFormatJMSBytesXMLReferenceProvider.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytesxml/runtime/WireFormatJMSBytesXMLReferenceProvider.java
deleted file mode 100644
index e0f928de12..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytesxml/runtime/WireFormatJMSBytesXMLReferenceProvider.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.wireformat.jmsbytesxml.runtime;
-
-import org.apache.tuscany.sca.binding.jms.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.JMSBindingConstants;
-import org.apache.tuscany.sca.binding.jms.wireformat.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.databinding.xml.DOMDataBinding;
-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.RuntimeEndpointReference;
-
-public class WireFormatJMSBytesXMLReferenceProvider implements WireFormatProvider {
- private ExtensionPointRegistry registry;
- private RuntimeEndpointReference endpointReference;
- private JMSBinding binding;
- private InterfaceContract interfaceContract;
-
- public WireFormatJMSBytesXMLReferenceProvider(ExtensionPointRegistry registry,
- RuntimeEndpointReference endpointReference) {
- super();
- this.registry = registry;
- this.endpointReference = endpointReference;
- this.binding = (JMSBinding)endpointReference.getBinding();
-
- // 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(endpointReference.getComponent(), endpointReference.getContract(), wsBinding, registry, null);
- interfaceContract = wsBinding.getBindingInterfaceContract();
- interfaceContract.getInterface().resetDataBinding(DOMDataBinding.NAME);
- }
-
- 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(registry, null, endpointReference);
- }
-
- public String getPhase() {
- return Phase.REFERENCE_BINDING_WIREFORMAT;
- }
-
- public InterfaceContract getWireFormatInterfaceContract() {
- return interfaceContract;
- }
-}
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytesxml/runtime/WireFormatJMSBytesXMLServiceInterceptor.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytesxml/runtime/WireFormatJMSBytesXMLServiceInterceptor.java
deleted file mode 100644
index c1e97a93d0..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/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.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.context.JMSBindingContext;
-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.WireFormatJMSBytesXML;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-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.RuntimeEndpoint;
-
-public class WireFormatJMSBytesXMLServiceInterceptor implements Interceptor {
- private Invoker next;
- private RuntimeEndpoint endpoint;
- private JMSResourceFactory jmsResourceFactory;
- private JMSBinding jmsBinding;
- private JMSMessageProcessor requestMessageProcessor;
- private JMSMessageProcessor responseMessageProcessor;
-
- public WireFormatJMSBytesXMLServiceInterceptor(ExtensionPointRegistry registry, JMSResourceFactory jmsResourceFactory, RuntimeEndpoint endpoint) {
- super();
- this.jmsBinding = (JMSBinding) endpoint.getBinding();
- this.endpoint = endpoint;
- this.jmsResourceFactory = jmsResourceFactory;
- this.requestMessageProcessor = JMSMessageProcessorUtil.getRequestMessageProcessor(registry, jmsBinding);
- this.responseMessageProcessor = JMSMessageProcessorUtil.getResponseMessageProcessor(registry, 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/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytesxml/runtime/WireFormatJMSBytesXMLServiceProvider.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytesxml/runtime/WireFormatJMSBytesXMLServiceProvider.java
deleted file mode 100644
index d2ff153227..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytesxml/runtime/WireFormatJMSBytesXMLServiceProvider.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.jmsbytesxml.runtime;
-
-import org.apache.tuscany.sca.binding.jms.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.JMSBindingConstants;
-import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory;
-import org.apache.tuscany.sca.binding.jms.wireformat.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.databinding.xml.DOMDataBinding;
-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.RuntimeEndpoint;
-
-public class WireFormatJMSBytesXMLServiceProvider implements WireFormatProvider {
- private ExtensionPointRegistry registry;
- private RuntimeEndpoint endpoint;
- private JMSBinding binding;
- private JMSResourceFactory jmsResourceFactory;
- private InterfaceContract interfaceContract;
-
- public WireFormatJMSBytesXMLServiceProvider(ExtensionPointRegistry registry,
- RuntimeEndpoint endpoint,
- JMSResourceFactory jmsResourceFactory) {
- super();
- this.registry = registry;
- this.endpoint = endpoint;
- this.binding = (JMSBinding)endpoint.getBinding();
- 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(endpoint.getComponent(), endpoint.getService(), wsBinding, registry, null);
- interfaceContract = wsBinding.getBindingInterfaceContract();
- interfaceContract.getInterface().resetDataBinding(DOMDataBinding.NAME);
- }
-
- 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(registry, jmsResourceFactory, endpoint);
- }
-
- /**
- */
- public String getPhase() {
- return Phase.SERVICE_BINDING_WIREFORMAT;
- }
-
- public InterfaceContract getWireFormatInterfaceContract() {
- return interfaceContract;
- }
-}
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/runtime/WireFormatJMSDefaultProviderFactory.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/runtime/WireFormatJMSDefaultProviderFactory.java
deleted file mode 100644
index adf8c03c10..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/runtime/WireFormatJMSDefaultProviderFactory.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.jmsdefault.runtime;
-
-import org.apache.tuscany.sca.binding.jms.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.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.RuntimeEndpoint;
-import org.apache.tuscany.sca.runtime.RuntimeEndpointReference;
-
-/**
- * @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(RuntimeEndpointReference endpointReference) {
- return new WireFormatJMSDefaultReferenceProvider(registry, endpointReference);
- }
-
- /**
- */
- public WireFormatProvider createServiceWireFormatProvider(RuntimeEndpoint endpoint) {
- JMSResourceFactory jmsRF = jmsRFEP.createJMSResourceFactory((JMSBinding) endpoint.getBinding());
- return new WireFormatJMSDefaultServiceProvider(registry, endpoint, jmsRF);
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.ProviderFactory#getModelType()
- */
- public Class getModelType() {
- // TODO Auto-generated method stub
- return null;
- }
-
-}
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/runtime/WireFormatJMSDefaultReferenceInterceptor.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/runtime/WireFormatJMSDefaultReferenceInterceptor.java
deleted file mode 100644
index 87d99a014e..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/runtime/WireFormatJMSDefaultReferenceInterceptor.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.jms.wireformat.jmsdefault.runtime;
-
-import java.util.HashMap;
-
-import javax.jms.BytesMessage;
-import javax.jms.JMSException;
-import javax.jms.Session;
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.binding.jms.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.JMSBindingConstants;
-import org.apache.tuscany.sca.binding.jms.JMSBindingException;
-import org.apache.tuscany.sca.binding.jms.context.JMSBindingContext;
-import org.apache.tuscany.sca.binding.jms.provider.DefaultMessageProcessor;
-import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory;
-import org.apache.tuscany.sca.binding.jms.wireformat.WireFormatJMSDefault;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-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.RuntimeEndpointReference;
-import org.w3c.dom.Node;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class WireFormatJMSDefaultReferenceInterceptor implements Interceptor {
-
- private Invoker next;
- private RuntimeEndpointReference endpointReference;
- private JMSResourceFactory jmsResourceFactory;
- private JMSBinding jmsBinding;
- private DefaultMessageProcessor requestMessageProcessor;
- private DefaultMessageProcessor responseMessageProcessor;
- private HashMap<String, Boolean> inputWrapperMap;
- private HashMap<String, Node> outputWrapperMap;
-
- public WireFormatJMSDefaultReferenceInterceptor(ExtensionPointRegistry registry, JMSResourceFactory jmsResourceFactory, RuntimeEndpointReference endpointReference, HashMap<String, Boolean> inputWrapperMap,
- HashMap<String, Node> outputWrapperMap) {
- super();
- this.jmsBinding = (JMSBinding) endpointReference.getBinding();
- this.endpointReference = endpointReference;
- 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, registry);
- this.responseMessageProcessor = new DefaultMessageProcessor(jmsBinding, registry);
- 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 {
-
- Node 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);
- Node om = ((Node)response).getFirstChild();
- e.setFaultName(new QName(om.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/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/runtime/WireFormatJMSDefaultReferenceProvider.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/runtime/WireFormatJMSDefaultReferenceProvider.java
deleted file mode 100644
index 127680c283..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/runtime/WireFormatJMSDefaultReferenceProvider.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.jms.wireformat.jmsdefault.runtime;
-
-import java.util.HashMap;
-import java.util.List;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.ComponentReference;
-import org.apache.tuscany.sca.binding.jms.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.JMSBindingConstants;
-import org.apache.tuscany.sca.binding.jms.wireformat.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.common.xml.dom.DOMHelper;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.databinding.xml.DOMDataBinding;
-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.RuntimeEndpointReference;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
-/**
- * @version $Rev$ $Date$
- */
-public class WireFormatJMSDefaultReferenceProvider implements WireFormatProvider {
- private ExtensionPointRegistry registry;
- private RuntimeEndpointReference endpointReference;
- private ComponentReference reference;
- private JMSBinding binding;
- private InterfaceContract interfaceContract;
- private DOMHelper domHelper;
- private HashMap<String, Boolean> inputWrapperMap;
- private HashMap<String, Node> outputWrapperMap;
-
- public WireFormatJMSDefaultReferenceProvider(ExtensionPointRegistry registry, RuntimeEndpointReference endpointReference) {
- super();
- this.registry = registry;
- this.endpointReference = endpointReference;
- this.binding = (JMSBinding) endpointReference.getBinding();
-
- this.domHelper = DOMHelper.getInstance(registry);
- this.inputWrapperMap = new HashMap<String, Boolean>();
- this.outputWrapperMap = new HashMap<String, Node>();
-
- // 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);
- }
-
- this.reference = endpointReference.getReference();
- // 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
-
- // 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(endpointReference.getComponent(), reference, wsBinding, registry, null);
- interfaceContract = wsBinding.getBindingInterfaceContract();
- interfaceContract.getInterface().resetDataBinding(DOMDataBinding.NAME);
-
- 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.isWrapperStyle()) {
- 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.isWrapperStyle()) {
- // 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.getWrapper().getOutputWrapperElement();
- String namespace = ei.getQName().getNamespaceURI();
- String opName = ei.getQName().getLocalPart();
- Document document = domHelper.newDocument();
- Element wrapper = DOMHelper.createElement(document, new QName(namespace, opName));
- 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(registry, null, endpointReference, inputWrapperMap, outputWrapperMap);
- }
-
- public String getPhase() {
- return Phase.REFERENCE_BINDING_WIREFORMAT;
- }
-
- public InterfaceContract getWireFormatInterfaceContract() {
- return interfaceContract;
- }
-}
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/runtime/WireFormatJMSDefaultServiceInterceptor.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/runtime/WireFormatJMSDefaultServiceInterceptor.java
deleted file mode 100644
index da6f283ff9..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/runtime/WireFormatJMSDefaultServiceInterceptor.java
+++ /dev/null
@@ -1,187 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, 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 org.apache.tuscany.sca.binding.jms.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.JMSBindingConstants;
-import org.apache.tuscany.sca.binding.jms.JMSBindingException;
-import org.apache.tuscany.sca.binding.jms.context.JMSBindingContext;
-import org.apache.tuscany.sca.binding.jms.provider.DefaultMessageProcessor;
-import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory;
-import org.apache.tuscany.sca.binding.jms.wireformat.WireFormatJMSDefault;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-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.RuntimeEndpoint;
-import org.w3c.dom.Node;
-
-/**
- * Policy handler to handle PolicySet related to Logging with the QName {http://tuscany.apache.org/xmlns/sca/1.1/impl/java}LoggingPolicy
- *
- * @version $Rev$ $Date$
- */
-public class WireFormatJMSDefaultServiceInterceptor implements Interceptor {
- private Invoker next;
- private RuntimeEndpoint endpoint;
- private JMSResourceFactory jmsResourceFactory;
- private JMSBinding jmsBinding;
- private DefaultMessageProcessor requestMessageProcessor;
- private DefaultMessageProcessor responseMessageProcessor;
- private HashMap<String, Node> inputWrapperMap;
- private HashMap<String, Boolean> outputWrapperMap;
-
- public WireFormatJMSDefaultServiceInterceptor(ExtensionPointRegistry registry, JMSResourceFactory jmsResourceFactory, RuntimeEndpoint endpoint, HashMap<String, Node> inputWrapperMap,
- HashMap<String, Boolean> outputWrapperMap) {
- super();
- this.jmsBinding = (JMSBinding) endpoint.getBinding();
- this.endpoint = endpoint;
- 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, registry);
- this.responseMessageProcessor = new DefaultMessageProcessor(jmsBinding, registry);
- 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
- Node 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);
- }
- }
-
-
- try {
- responseJMSMsg.setStringProperty(JMSBindingConstants.DEFAULT_OPERATION_PROP_NAME, msg.getOperation().getName());
- } catch (JMSException e) {
- // Not sure what to do at this point.. it doesn't make sense to create a fault message.
- // Throwing a runtime exception for now.
- throw new JMSBindingException(e);
- }
-
- msg.setBody(responseJMSMsg);
-
- return msg;
- }
-
- public Invoker getNext() {
- return next;
- }
-
- public void setNext(Invoker next) {
- this.next = next;
- }
-}
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/runtime/WireFormatJMSDefaultServiceProvider.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/runtime/WireFormatJMSDefaultServiceProvider.java
deleted file mode 100644
index 3541666007..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/runtime/WireFormatJMSDefaultServiceProvider.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.binding.jms.wireformat.jmsdefault.runtime;
-
-import java.util.HashMap;
-import java.util.List;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.ComponentService;
-import org.apache.tuscany.sca.binding.jms.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.JMSBindingConstants;
-import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory;
-import org.apache.tuscany.sca.binding.jms.wireformat.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.common.xml.dom.DOMHelper;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.databinding.xml.DOMDataBinding;
-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.RuntimeEndpoint;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
-/**
- * @version $Rev$ $Date$
- */
-public class WireFormatJMSDefaultServiceProvider implements WireFormatProvider {
- private ExtensionPointRegistry registry;
- private RuntimeEndpoint endpoint;
- private ComponentService service;
- private JMSBinding binding;
- private JMSResourceFactory jmsResourceFactory;
- private InterfaceContract interfaceContract;
- private DOMHelper domHelper;
- private HashMap<String, Node> inputWrapperMap;
- private HashMap<String, Boolean> outputWrapperMap;
-
- public WireFormatJMSDefaultServiceProvider(ExtensionPointRegistry registry, RuntimeEndpoint endpoint, JMSResourceFactory jmsResourceFactory) {
- super();
- this.registry = registry;
- this.endpoint = endpoint;
- this.binding = (JMSBinding) endpoint.getBinding();
- this.service = endpoint.getService();
- this.jmsResourceFactory = jmsResourceFactory;
-
- this.domHelper = DOMHelper.getInstance(registry);
- this.inputWrapperMap = new HashMap<String, Node>();
- 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
-
- // 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(endpoint.getComponent(), service, wsBinding, registry, null);
- interfaceContract = wsBinding.getBindingInterfaceContract();
- interfaceContract.getInterface().resetDataBinding(DOMDataBinding.NAME);
-
- 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.isWrapperStyle()) {
- 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.getWrapper().getInputWrapperElement();
- String namespace = ei.getQName().getNamespaceURI();
- String opName = ei.getQName().getLocalPart();
- Document document = domHelper.newDocument();
- Element wrapper = DOMHelper.createElement(document, new QName(namespace, opName));
- this.inputWrapperMap.put(name, wrapper);
- }
- }
-
- if (matchingWsdlOp.isWrapperStyle()) {
- 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(registry, jmsResourceFactory, endpoint, this.inputWrapperMap, this.outputWrapperMap);
- }
-
- public String getPhase() {
- return Phase.SERVICE_BINDING_WIREFORMAT;
- }
-
- public InterfaceContract getWireFormatInterfaceContract() {
- return interfaceContract;
- }
-}
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectProviderFactory.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectProviderFactory.java
deleted file mode 100644
index 1e445f1b11..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectProviderFactory.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.jms.wireformat.jmsobject.runtime;
-
-import org.apache.tuscany.sca.binding.jms.wireformat.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.RuntimeEndpoint;
-import org.apache.tuscany.sca.runtime.RuntimeEndpointReference;
-
-/**
- * @version $Rev$ $Date$
- */
-public class WireFormatJMSObjectProviderFactory implements WireFormatProviderFactory<WireFormatJMSObject> {
- private ExtensionPointRegistry registry;
-
- public WireFormatJMSObjectProviderFactory(ExtensionPointRegistry registry) {
- super();
- this.registry = registry;
- }
-
- /**
- */
- public WireFormatProvider createReferenceWireFormatProvider(RuntimeEndpointReference endpointReference) {
- return new WireFormatJMSObjectReferenceProvider(registry, endpointReference);
- }
-
- /**
- */
- public WireFormatProvider createServiceWireFormatProvider(RuntimeEndpoint endpoint) {
- return new WireFormatJMSObjectServiceProvider(registry, endpoint);
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.ProviderFactory#getModelType()
- */
- public Class getModelType() {
- // TODO Auto-generated method stub
- return null;
- }
-
-}
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectReferenceInterceptor.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectReferenceInterceptor.java
deleted file mode 100644
index ec110ea0d2..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectReferenceInterceptor.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.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.binding.jms.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.JMSBindingException;
-import org.apache.tuscany.sca.binding.jms.context.JMSBindingContext;
-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.WireFormatJMSObject;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-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.RuntimeEndpointReference;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class WireFormatJMSObjectReferenceInterceptor implements Interceptor {
-
- private Invoker next;
- private RuntimeEndpointReference endpointReference;
- private JMSResourceFactory jmsResourceFactory;
- private JMSBinding jmsBinding;
- private JMSMessageProcessor requestMessageProcessor;
- private JMSMessageProcessor responseMessageProcessor;
-
- private HashMap<String, String> singleArgMap;
-
- public WireFormatJMSObjectReferenceInterceptor(ExtensionPointRegistry registry, JMSResourceFactory jmsResourceFactory, RuntimeEndpointReference endpointReference, HashMap<String, String> hashMap) {
- super();
- this.jmsBinding = (JMSBinding) endpointReference.getBinding();
- this.endpointReference = endpointReference;
- this.jmsResourceFactory = jmsResourceFactory;
- this.requestMessageProcessor = JMSMessageProcessorUtil.getRequestMessageProcessor(registry, jmsBinding);
- this.responseMessageProcessor = JMSMessageProcessorUtil.getResponseMessageProcessor(registry, 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/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectReferenceProvider.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectReferenceProvider.java
deleted file mode 100644
index 44e59a0226..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectReferenceProvider.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.binding.jms.wireformat.jmsobject.runtime;
-
-import java.util.HashMap;
-import java.util.List;
-
-import org.apache.tuscany.sca.assembly.ComponentReference;
-import org.apache.tuscany.sca.binding.jms.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.JMSBindingConstants;
-import org.apache.tuscany.sca.binding.jms.wireformat.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.RuntimeEndpointReference;
-
-/**
- * @version $Rev$ $Date$
- */
-public class WireFormatJMSObjectReferenceProvider implements WireFormatProvider {
- private ExtensionPointRegistry registry;
- private RuntimeEndpointReference endpointReference;
- 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,
- RuntimeEndpointReference endpointReference) {
- super();
- this.registry = registry;
- this.endpointReference = endpointReference;
- this.binding = (JMSBinding)endpointReference.getBinding();
-
- this.singleArgMap = new HashMap<String,String>();
- ComponentReference reference = endpointReference.getReference();
-
- // 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(registry, null, endpointReference, this.singleArgMap);
- }
-
- public String getPhase() {
- return Phase.REFERENCE_BINDING_WIREFORMAT;
- }
-
- public InterfaceContract getWireFormatInterfaceContract() {
- return interfaceContract;
- }
-}
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectServiceInterceptor.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectServiceInterceptor.java
deleted file mode 100644
index 19baddd9da..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectServiceInterceptor.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.jms.wireformat.jmsobject.runtime;
-
-import java.util.HashMap;
-
-import javax.jms.Session;
-
-import org.apache.tuscany.sca.binding.jms.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.context.JMSBindingContext;
-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.WireFormatJMSObject;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-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.RuntimeEndpoint;
-
-/**
- * Policy handler to handle PolicySet related to Logging with the QName
- * {http://tuscany.apache.org/xmlns/sca/1.1/impl/java}LoggingPolicy
- *
- * @version $Rev$ $Date$
- */
-public class WireFormatJMSObjectServiceInterceptor implements Interceptor {
- private Invoker next;
- private RuntimeEndpoint endpoint;
- private JMSResourceFactory jmsResourceFactory;
- private JMSBinding jmsBinding;
- private JMSMessageProcessor requestMessageProcessor;
- private JMSMessageProcessor responseMessageProcessor;
- private HashMap<String,Class<?>> singleArgMap;
- private boolean wrapSingle;
-
- public WireFormatJMSObjectServiceInterceptor(ExtensionPointRegistry registry, JMSResourceFactory jmsResourceFactory,
- RuntimeEndpoint endpoint, HashMap<String, Class<?>> singleArgMap, boolean wrapSingle) {
- super();
- this.jmsBinding = (JMSBinding) endpoint.getBinding();
- this.endpoint = endpoint;
- this.jmsResourceFactory = jmsResourceFactory;
- this.requestMessageProcessor = JMSMessageProcessorUtil.getRequestMessageProcessor(registry, jmsBinding);
- this.responseMessageProcessor = JMSMessageProcessorUtil.getResponseMessageProcessor(registry, 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/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectServiceProvider.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectServiceProvider.java
deleted file mode 100644
index 2e50f27a47..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectServiceProvider.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.jms.wireformat.jmsobject.runtime;
-
-
-import java.util.HashMap;
-import java.util.List;
-
-import org.apache.tuscany.sca.assembly.ComponentService;
-import org.apache.tuscany.sca.binding.jms.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.JMSBindingConstants;
-import org.apache.tuscany.sca.binding.jms.wireformat.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.RuntimeEndpoint;
-
-/**
- * @version $Rev$ $Date$
- */
-public class WireFormatJMSObjectServiceProvider implements WireFormatProvider {
- private ExtensionPointRegistry registry;
- private RuntimeEndpoint endpoint;
- private JMSBinding binding;
- private InterfaceContract interfaceContract;
- private HashMap<String,Class<?>> singleArgMap;
- private boolean wrapSingle = true;
-
- public WireFormatJMSObjectServiceProvider(ExtensionPointRegistry registry, RuntimeEndpoint endpoint) {
- super();
- this.registry = registry;
- this.endpoint = endpoint;
- this.binding = (JMSBinding)endpoint.getBinding();
- this.singleArgMap = new HashMap<String,Class<?>>();
-
- ComponentService service = endpoint.getService();
- // 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(registry, null, endpoint, this.singleArgMap, wrapSingle);
- }
-
- /**
- */
- public String getPhase() {
- return Phase.SERVICE_BINDING_WIREFORMAT;
- }
-
- public InterfaceContract getWireFormatInterfaceContract() {
- return interfaceContract;
- }
-}
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextProviderFactory.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextProviderFactory.java
deleted file mode 100644
index e3522616c0..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextProviderFactory.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.jms.wireformat.jmstext.runtime;
-
-import org.apache.tuscany.sca.binding.jms.wireformat.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.RuntimeEndpoint;
-import org.apache.tuscany.sca.runtime.RuntimeEndpointReference;
-
-/**
- * @version $Rev$ $Date$
- */
-public class WireFormatJMSTextProviderFactory implements WireFormatProviderFactory<WireFormatJMSText> {
- private ExtensionPointRegistry registry;
-
- public WireFormatJMSTextProviderFactory(ExtensionPointRegistry registry) {
- super();
- this.registry = registry;
- }
-
- /**
- */
- public WireFormatProvider createReferenceWireFormatProvider(RuntimeEndpointReference endpointReference) {
- return new WireFormatJMSTextReferenceProvider(registry, endpointReference);
- }
-
- /**
- */
- public WireFormatProvider createServiceWireFormatProvider(RuntimeEndpoint endpoint) {
- return new WireFormatJMSTextServiceProvider(registry, endpoint);
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.ProviderFactory#getModelType()
- */
- public Class getModelType() {
- // TODO Auto-generated method stub
- return null;
- }
-
-}
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextReferenceInterceptor.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextReferenceInterceptor.java
deleted file mode 100644
index fd512f7d27..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextReferenceInterceptor.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.wireformat.jmstext.runtime;
-
-
-import java.lang.reflect.InvocationTargetException;
-
-import javax.jms.JMSException;
-import javax.jms.Session;
-
-import org.apache.tuscany.sca.binding.jms.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.JMSBindingException;
-import org.apache.tuscany.sca.binding.jms.context.JMSBindingContext;
-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.WireFormatJMSText;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-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.RuntimeEndpointReference;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class WireFormatJMSTextReferenceInterceptor implements Interceptor {
-
- private Invoker next;
- private RuntimeEndpointReference endpointReference;
- private JMSResourceFactory jmsResourceFactory;
- private JMSBinding jmsBinding;
- private JMSMessageProcessor requestMessageProcessor;
- private JMSMessageProcessor responseMessageProcessor;
-
- public WireFormatJMSTextReferenceInterceptor(ExtensionPointRegistry registry, JMSResourceFactory jmsResourceFactory, RuntimeEndpointReference endpointReference) {
- super();
- this.jmsBinding = (JMSBinding) endpointReference.getBinding();
- this.endpointReference = endpointReference;
- this.jmsResourceFactory = jmsResourceFactory;
- this.requestMessageProcessor = JMSMessageProcessorUtil.getRequestMessageProcessor(registry, jmsBinding);
- this.responseMessageProcessor = JMSMessageProcessorUtil.getResponseMessageProcessor(registry, 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/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextReferenceProvider.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextReferenceProvider.java
deleted file mode 100644
index 5baffd48dd..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextReferenceProvider.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.jmstext.runtime;
-
-
-import org.apache.tuscany.sca.binding.jms.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.JMSBindingConstants;
-import org.apache.tuscany.sca.binding.jms.wireformat.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.RuntimeEndpointReference;
-
-/**
- * @version $Rev$ $Date$
- */
-public class WireFormatJMSTextReferenceProvider implements WireFormatProvider {
- private ExtensionPointRegistry registry;
- private RuntimeEndpointReference endpointReference;
- private JMSBinding binding;
- private InterfaceContract interfaceContract;
-
- public WireFormatJMSTextReferenceProvider(ExtensionPointRegistry registry,
- RuntimeEndpointReference endpointReference) {
- super();
- this.registry = registry;
- this.endpointReference = endpointReference;
- this.binding = (JMSBinding)endpointReference.getBinding();
-
- // 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 = endpointReference.getReference().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(registry, null, endpointReference);
- }
-
- public String getPhase() {
- return Phase.REFERENCE_BINDING_WIREFORMAT;
- }
-
- public InterfaceContract getWireFormatInterfaceContract() {
- return interfaceContract;
- }
-}
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextServiceInterceptor.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextServiceInterceptor.java
deleted file mode 100644
index c3f3660211..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextServiceInterceptor.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.jmstext.runtime;
-
-import javax.jms.Session;
-
-import org.apache.tuscany.sca.binding.jms.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.context.JMSBindingContext;
-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.WireFormatJMSText;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-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.RuntimeEndpoint;
-
-/**
- * Policy handler to handle PolicySet related to Logging with the QName
- * {http://tuscany.apache.org/xmlns/sca/1.1/impl/java}LoggingPolicy
- *
- * @version $Rev$ $Date$
- */
-public class WireFormatJMSTextServiceInterceptor implements Interceptor {
- private Invoker next;
- private RuntimeEndpoint endpoint;
- private JMSResourceFactory jmsResourceFactory;
- private JMSBinding jmsBinding;
- private JMSMessageProcessor requestMessageProcessor;
- private JMSMessageProcessor responseMessageProcessor;
-
- public WireFormatJMSTextServiceInterceptor(ExtensionPointRegistry registry, JMSResourceFactory jmsResourceFactory, RuntimeEndpoint endpoint) {
- super();
- this.jmsBinding = (JMSBinding) endpoint.getBinding();
- this.endpoint = endpoint;
- this.jmsResourceFactory = jmsResourceFactory;
- this.requestMessageProcessor = JMSMessageProcessorUtil.getRequestMessageProcessor(registry, jmsBinding);
- this.responseMessageProcessor = JMSMessageProcessorUtil.getResponseMessageProcessor(registry, 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/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextServiceProvider.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextServiceProvider.java
deleted file mode 100644
index f4ee1226c5..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextServiceProvider.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.jms.wireformat.jmstext.runtime;
-
-import org.apache.tuscany.sca.binding.jms.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.JMSBindingConstants;
-import org.apache.tuscany.sca.binding.jms.wireformat.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.RuntimeEndpoint;
-
-/**
- * @version $Rev$ $Date$
- */
-public class WireFormatJMSTextServiceProvider implements WireFormatProvider {
- private ExtensionPointRegistry registry;
- private RuntimeEndpoint endpoint;
- private JMSBinding binding;
- private InterfaceContract interfaceContract;
-
- public WireFormatJMSTextServiceProvider(ExtensionPointRegistry registry,
- RuntimeEndpoint endpoint) {
- super();
- this.registry = registry;
- this.endpoint = endpoint;
- this.binding = (JMSBinding)endpoint.getBinding();
-
- // 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 = endpoint.getService().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(registry, null, endpoint);
- }
-
- /**
- */
- public String getPhase() {
- return Phase.SERVICE_BINDING_WIREFORMAT;
- }
-
- public InterfaceContract getWireFormatInterfaceContract() {
- return interfaceContract;
- }
-}
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLProviderFactory.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLProviderFactory.java
deleted file mode 100644
index fb119078d1..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLProviderFactory.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.jmstextxml.runtime;
-
-import org.apache.tuscany.sca.binding.jms.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.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.RuntimeEndpoint;
-import org.apache.tuscany.sca.runtime.RuntimeEndpointReference;
-
-/**
- * @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(RuntimeEndpointReference endpointReference) {
- return new WireFormatJMSTextXMLReferenceProvider(registry, endpointReference);
- }
-
- /**
- */
- public WireFormatProvider createServiceWireFormatProvider(RuntimeEndpoint endpoint) {
- JMSResourceFactory jmsRF = jmsRFEP.createJMSResourceFactory((JMSBinding)endpoint.getBinding());
- return new WireFormatJMSTextXMLServiceProvider(registry, endpoint, jmsRF);
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.ProviderFactory#getModelType()
- */
- public Class getModelType() {
- // TODO Auto-generated method stub
- return null;
- }
-
-}
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLReferenceInterceptor.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLReferenceInterceptor.java
deleted file mode 100644
index 4d62022196..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLReferenceInterceptor.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.wireformat.jmstextxml.runtime;
-
-
-
-
-import javax.jms.JMSException;
-import javax.jms.Session;
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.binding.jms.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.JMSBindingConstants;
-import org.apache.tuscany.sca.binding.jms.JMSBindingException;
-import org.apache.tuscany.sca.binding.jms.context.JMSBindingContext;
-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.WireFormatJMSTextXML;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-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.RuntimeEndpointReference;
-import org.w3c.dom.Node;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class WireFormatJMSTextXMLReferenceInterceptor implements Interceptor {
-
- private Invoker next;
- private RuntimeEndpointReference endpointReference;
- private JMSResourceFactory jmsResourceFactory;
- private JMSBinding jmsBinding;
- private JMSMessageProcessor requestMessageProcessor;
- private JMSMessageProcessor responseMessageProcessor;
-
-
- public WireFormatJMSTextXMLReferenceInterceptor(ExtensionPointRegistry registry, JMSResourceFactory jmsResourceFactory, RuntimeEndpointReference endpointReference) {
- super();
- this.jmsBinding = (JMSBinding) endpointReference.getBinding();
- this.endpointReference = endpointReference;
- this.jmsResourceFactory = jmsResourceFactory;
- this.requestMessageProcessor = JMSMessageProcessorUtil.getRequestMessageProcessor(registry, jmsBinding);
- this.responseMessageProcessor = JMSMessageProcessorUtil.getResponseMessageProcessor(registry, 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);
- Node node = ((Node)response).getFirstChild();
- e.setFaultName(new QName(node.getNamespaceURI(), node.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/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLReferenceProvider.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLReferenceProvider.java
deleted file mode 100644
index 957994a146..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLReferenceProvider.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.binding.jms.wireformat.jmstextxml.runtime;
-
-import org.apache.tuscany.sca.binding.jms.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.JMSBindingConstants;
-import org.apache.tuscany.sca.binding.jms.wireformat.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.databinding.xml.DOMDataBinding;
-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.RuntimeEndpointReference;
-
-/**
- * @version $Rev$ $Date$
- */
-public class WireFormatJMSTextXMLReferenceProvider implements WireFormatProvider {
- private ExtensionPointRegistry registry;
- private RuntimeEndpointReference endpointReference;
- private JMSBinding binding;
- private InterfaceContract interfaceContract;
-
- public WireFormatJMSTextXMLReferenceProvider(ExtensionPointRegistry registry,
- RuntimeEndpointReference endpointReference) {
- super();
- this.registry = registry;
- this.endpointReference = endpointReference;
- this.binding = (JMSBinding)endpointReference.getBinding();
-
- // 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(endpointReference.getComponent(), endpointReference.getReference(), wsBinding, registry, null);
- interfaceContract = wsBinding.getBindingInterfaceContract();
- interfaceContract.getInterface().resetDataBinding(DOMDataBinding.NAME);
- }
-
- protected boolean isOnMessage() {
- InterfaceContract ic = endpointReference.getReference().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(registry, null, endpointReference);
- }
-
- public String getPhase() {
- return Phase.REFERENCE_BINDING_WIREFORMAT;
- }
-
- public InterfaceContract getWireFormatInterfaceContract() {
- return interfaceContract;
- }
-
-}
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLServiceInterceptor.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLServiceInterceptor.java
deleted file mode 100644
index 8e4f8fb90b..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLServiceInterceptor.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.jmstextxml.runtime;
-
-import javax.jms.Session;
-
-import org.apache.tuscany.sca.binding.jms.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.context.JMSBindingContext;
-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.WireFormatJMSTextXML;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-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.RuntimeEndpoint;
-
-/**
- * Policy handler to handle PolicySet related to Logging with the QName
- * {http://tuscany.apache.org/xmlns/sca/1.1/impl/java}LoggingPolicy
- *
- * @version $Rev$ $Date$
- */
-public class WireFormatJMSTextXMLServiceInterceptor implements Interceptor {
- private Invoker next;
- private RuntimeEndpoint endpoint;
- private JMSResourceFactory jmsResourceFactory;
- private JMSBinding jmsBinding;
- private JMSMessageProcessor requestMessageProcessor;
- private JMSMessageProcessor responseMessageProcessor;
-
- public WireFormatJMSTextXMLServiceInterceptor(ExtensionPointRegistry registry, JMSResourceFactory jmsResourceFactory, RuntimeEndpoint endpoint) {
- super();
- this.jmsBinding = (JMSBinding) endpoint.getBinding();
- this.endpoint = endpoint;
- this.jmsResourceFactory = jmsResourceFactory;
- this.requestMessageProcessor = JMSMessageProcessorUtil.getRequestMessageProcessor(registry, jmsBinding);
- this.responseMessageProcessor = JMSMessageProcessorUtil.getResponseMessageProcessor(registry, 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/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLServiceProvider.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLServiceProvider.java
deleted file mode 100644
index c56a9e0e50..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLServiceProvider.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.jmstextxml.runtime;
-
-import org.apache.tuscany.sca.binding.jms.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.JMSBindingConstants;
-import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory;
-import org.apache.tuscany.sca.binding.jms.wireformat.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.databinding.xml.DOMDataBinding;
-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.RuntimeEndpoint;
-
-/**
- * @version $Rev$ $Date$
- */
-public class WireFormatJMSTextXMLServiceProvider implements WireFormatProvider {
- private ExtensionPointRegistry registry;
- private RuntimeEndpoint endpoint;
- private JMSBinding binding;
- private JMSResourceFactory jmsResourceFactory;
- private InterfaceContract interfaceContract;
-
- public WireFormatJMSTextXMLServiceProvider(ExtensionPointRegistry registry,
- RuntimeEndpoint endpoint,
- JMSResourceFactory jmsResourceFactory) {
- super();
- this.endpoint = endpoint;
- this.binding = (JMSBinding)endpoint.getBinding();
- this.jmsResourceFactory = jmsResourceFactory;
- this.registry = registry;
-
- // 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(endpoint.getComponent(), endpoint.getService(), wsBinding, registry, null);
- interfaceContract = wsBinding.getBindingInterfaceContract();
- interfaceContract.getInterface().resetDataBinding(DOMDataBinding.NAME);
- }
-
- 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(registry, jmsResourceFactory, endpoint);
- }
-
- public String getPhase() {
- return Phase.SERVICE_BINDING_WIREFORMAT;
- }
-
- public InterfaceContract getWireFormatInterfaceContract() {
- return interfaceContract;
- }
-
-}
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory
deleted file mode 100644
index 1781985232..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory
+++ /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.provider.JMSBindingProviderFactory;model=org.apache.tuscany.sca.binding.jms.JMSBinding
-
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.OperationSelectorProviderFactory b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.OperationSelectorProviderFactory
deleted file mode 100644
index b5d5117b84..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.OperationSelectorProviderFactory
+++ /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 binding extension
-org.apache.tuscany.sca.binding.jms.operationselector.jmsdefault.runtime.OperationSelectorJMSDefaultProviderFactory;model=org.apache.tuscany.sca.binding.jms.operationselector.OperationSelectorJMSDefault
-org.apache.tuscany.sca.binding.jms.operationselector.jmsuserprop.runtime.OperationSelectorJMSUserPropProviderFactory;model=org.apache.tuscany.sca.binding.jms.operationselector.OperationSelectorJMSUserProp
-
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory
deleted file mode 100644
index a54b133da6..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/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.provider.JMSTokenAuthenticationPolicyProviderFactory;model=org.apache.tuscany.sca.binding.jms.policy.authentication.token.JMSTokenAuthenticationPolicy
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.WireFormatProviderFactory b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.WireFormatProviderFactory
deleted file mode 100644
index 4baf7ff14e..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.WireFormatProviderFactory
+++ /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 class for the binding extension
-org.apache.tuscany.sca.binding.jms.wireformat.jmsdefault.runtime.WireFormatJMSDefaultProviderFactory;model=org.apache.tuscany.sca.binding.jms.wireformat.WireFormatJMSDefault
-org.apache.tuscany.sca.binding.jms.wireformat.jmstextxml.runtime.WireFormatJMSTextXMLProviderFactory;model=org.apache.tuscany.sca.binding.jms.wireformat.WireFormatJMSTextXML
-org.apache.tuscany.sca.binding.jms.wireformat.jmsbytes.runtime.WireFormatJMSBytesProviderFactory;model=org.apache.tuscany.sca.binding.jms.wireformat.WireFormatJMSBytes
-org.apache.tuscany.sca.binding.jms.wireformat.jmsbytesxml.runtime.WireFormatJMSBytesXMLProviderFactory;model=org.apache.tuscany.sca.binding.jms.wireformat.WireFormatJMSBytesXML
-org.apache.tuscany.sca.binding.jms.wireformat.jmstext.runtime.WireFormatJMSTextProviderFactory;model=org.apache.tuscany.sca.binding.jms.wireformat.WireFormatJMSText
-org.apache.tuscany.sca.binding.jms.wireformat.jmsobject.runtime.WireFormatJMSObjectProviderFactory;model=org.apache.tuscany.sca.binding.jms.wireformat.WireFormatJMSObject
-
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/test/java/org/apache/tuscany/sca/binding/jms/HelloWorldClientImpl.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/test/java/org/apache/tuscany/sca/binding/jms/HelloWorldClientImpl.java
deleted file mode 100644
index a3a2f0bf1e..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/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.oasisopen.sca.annotation.Reference;
-import org.oasisopen.sca.annotation.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/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/test/java/org/apache/tuscany/sca/binding/jms/HelloWorldService.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/test/java/org/apache/tuscany/sca/binding/jms/HelloWorldService.java
deleted file mode 100644
index d68270f7df..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/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.oasisopen.sca.annotation.Remotable;
-
-/**
- * Interface for the HelloWorld Service.
- *
- * @version $Rev$ $Date$
- */
-@Remotable
-public interface HelloWorldService {
- String sayHello(String name);
-}
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/test/java/org/apache/tuscany/sca/binding/jms/HelloWorldServiceImpl.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/test/java/org/apache/tuscany/sca/binding/jms/HelloWorldServiceImpl.java
deleted file mode 100644
index a8808c1bd1..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/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/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/test/java/org/apache/tuscany/sca/binding/jms/OperationSelectionTestCaseFIXME.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/test/java/org/apache/tuscany/sca/binding/jms/OperationSelectionTestCaseFIXME.java
deleted file mode 100644
index 5b59389a18..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/test/java/org/apache/tuscany/sca/binding/jms/OperationSelectionTestCaseFIXME.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.jms;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.impl.OperationImpl;
-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/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/test/resources/simple/client.composite b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/test/resources/simple/client.composite
deleted file mode 100644
index dcea428493..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/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/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/test/resources/simple/service.composite b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms-runtime/src/test/resources/simple/service.composite
deleted file mode 100644
index 44b7b29610..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/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/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/LICENSE b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/LICENSE
deleted file mode 100644
index 8aa906c321..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/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/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/META-INF/MANIFEST.MF b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/META-INF/MANIFEST.MF
deleted file mode 100644
index 9b6da67343..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,62 +0,0 @@
-Manifest-Version: 1.0
-Export-Package: org.apache.tuscany.sca.binding.jms;version="2.0.0";
- uses:="javax.xml.stream,
- org.apache.tuscany.sca.assembly,
- org.apache.tuscany.sca.contribution.resolver,
- org.apache.tuscany.sca.contribution.processor,
- org.apache.tuscany.sca.core,
- org.apache.tuscany.sca.policy,
- org.apache.tuscany.sca.monitor,
- javax.xml.namespace",
- org.apache.tuscany.sca.binding.jms.operationselector;version="2.0.0";
- uses:="javax.xml.stream,
- org.apache.tuscany.sca.assembly,
- org.apache.tuscany.sca.contribution.resolver,
- org.apache.tuscany.sca.contribution.processor,
- org.apache.tuscany.sca.core,
- org.apache.tuscany.sca.monitor,
- javax.xml.namespace",
- org.apache.tuscany.sca.binding.jms.policy;version="2.0.0",
- org.apache.tuscany.sca.binding.jms.policy.authentication.token;version="2.0.0";
- uses:="javax.xml.stream,
- org.apache.tuscany.sca.contribution.resolver,
- org.apache.tuscany.sca.contribution.processor,
- org.apache.tuscany.sca.core,
- org.apache.tuscany.sca.monitor,
- javax.xml.namespace",
- org.apache.tuscany.sca.binding.jms.policy.header;version="2.0.0";
- uses:="javax.xml.stream,
- org.apache.tuscany.sca.contribution.resolver,
- org.apache.tuscany.sca.contribution.processor,
- org.apache.tuscany.sca.core,
- org.apache.tuscany.sca.monitor,
- javax.xml.namespace",
- org.apache.tuscany.sca.binding.jms.wireformat;version="2.0.0";
- uses:="javax.xml.stream,
- org.apache.tuscany.sca.assembly,
- org.apache.tuscany.sca.contribution.resolver,
- org.apache.tuscany.sca.contribution.processor,
- org.apache.tuscany.sca.core,
- org.apache.tuscany.sca.monitor,
- javax.xml.namespace"
-Private-Package: org.apache.tuscany.sca.binding.jms.impl;version="2.0.0"
-SCA-Version: 1.1
-Bundle-Name: Apache Tuscany SCA JMS Binding Model
-Bundle-Vendor: The Apache Software Foundation
-Bundle-Version: 2.0.0
-Bundle-ManifestVersion: 2
-Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
-Bundle-Description: Apache Tuscany SCA JMS Binding Model
-Import-Package: javax.xml.namespace,
- javax.xml.stream,
- org.apache.tuscany.sca.assembly;version="2.0.0",
- org.apache.tuscany.sca.assembly.xml;version="2.0.0";resolution:=optional,
- org.apache.tuscany.sca.binding.jms;version="2.0.0",
- org.apache.tuscany.sca.contribution.processor;version="2.0.0",
- org.apache.tuscany.sca.contribution.resolver;version="2.0.0",
- org.apache.tuscany.sca.core;version="2.0.0",
- org.apache.tuscany.sca.monitor;version="2.0.0",
- org.apache.tuscany.sca.policy;version="2.0.0"
-Bundle-SymbolicName: org.apache.tuscany.sca.binding.jms
-Bundle-DocURL: http://www.apache.org/
-Bundle-RequiredExecutionEnvironment: J2SE-1.5,JavaSE-1.6
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/NOTICE b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/NOTICE
deleted file mode 100644
index fdfa0e9faa..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2008 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/pom.xml b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/pom.xml
deleted file mode 100644
index 5b1c1f9502..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/pom.xml
+++ /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.
--->
-<project>
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-modules</artifactId>
- <version>2.0-Beta2-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>2.0-Beta2-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.8.1</version>
- <scope>test</scope>
- </dependency>
-
- </dependencies>
-
- <build>
- </build>
-
-</project>
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/BindingProperty.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/BindingProperty.java
deleted file mode 100644
index 7aa62215ff..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/BindingProperty.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;
-
-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/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/JMSBinding.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/JMSBinding.java
deleted file mode 100644
index 4539ad2ac7..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/JMSBinding.java
+++ /dev/null
@@ -1,1094 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, 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.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.Binding;
-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.policy.ExtensionType;
-import org.apache.tuscany.sca.policy.Intent;
-import org.apache.tuscany.sca.policy.PolicySet;
-import org.apache.tuscany.sca.policy.PolicySubject;
-
-/**
- * Models a binding to a JMS resource.
- *
- * @version $Rev$ $Date$
- */
-
-//public class JMSBinding implements BindingRRB, PolicySubject, OperationsConfigurator, DefinitionElement {
-public class JMSBinding implements Binding, PolicySubject, OperationsConfigurator {
- QName TYPE = new QName(SCA11_NS, "binding.jms");
-
- @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>();
-
- // 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 = JMSBindingConstants.CREATE_IF_NOT_EXIST;
- 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 = JMSBindingConstants.CREATE_IF_NOT_EXIST;
- 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 jmsCorrelationId;
-
- 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 = null;
- private String uriJmsSelector = null;
- 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;
- private ExtensionType extensionType;
- private String jmsURI;
-
- private String uriType;
- private Boolean uriDeliveryMode;
- private Integer uriJMSPriority;
- private Long uriJMSTimeToLive;
-
- private String headerType;
- private Boolean headerDeliveryMode;
- private Integer headerPriority;
- private Long headerTimeToLive;
-
- private final Integer defaultPriority = Integer.valueOf(4);
- private final Boolean defaultDeliveryMode = true;
- private final Long defaultJMSTimeToLive =Long.valueOf(0);
- private boolean isDestinationSpecified = false;
-
- 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;
- }
-
- // getEffective...() will return values based on the following priority
- // 1. The value specified in the URI attribute
- // 2. The value specified in the operationProperties/headers
- // 3. The value specified in the headers element
- // 4. The default value from the headers element
- public String getEffectiveJMSType(String opName) {
- if ( getJMSURIType() != null ) return getJMSURIType();
- else if ( getOperationJMSType(opName) != null ) return getOperationJMSType(opName);
- else if ( getJMSHeaderType() != null ) return getJMSHeaderType();
- else return null;
- }
-
- public Boolean getEffectiveJMSDeliveryMode(String opName) {
- if ( getURIJMSDeliveryMode() != null ) return getURIJMSDeliveryMode();
- else if ( getOperationJMSDeliveryMode(opName) != null) return getOperationJMSDeliveryMode(opName);
- else if ( getHeaderJMSDeliveryMode() != null) return getHeaderJMSDeliveryMode();
- else return getDefaultDeliveryMode();
- }
-
- public Long getEffectiveJMSTimeToLive(String opName) {
- if ( getURIJMSTimeToLive() != null ) return getURIJMSTimeToLive();
- else if ( getOperationJMSTimeToLive(opName) != null) return getOperationJMSTimeToLive(opName);
- else if ( getHeaderJMSTimeToLive() != null) return getHeaderJMSTimeToLive();
- else return getDefaultJMSTimeToLive();
- }
-
- public Integer getEffectiveJMSPriority(String operationName) {
- if ( getURIJMSPriority() != null ) return getURIJMSPriority();
- else if ( getOperationJMSPriority(operationName)!= null) return getOperationJMSPriority(operationName);
- else if ( getJMSHeaderPriority() != null ) return getJMSHeaderPriority();
- else return getDefaultJMSPriority();
- }
-
-
- private Long getHeaderJMSTimeToLive() {
- return this.headerTimeToLive;
- }
-
- private Long getDefaultJMSTimeToLive() {
- return this.defaultJMSTimeToLive;
- }
-
- private Boolean getDefaultDeliveryMode() {
- return this.defaultDeliveryMode;
- }
-
- private Boolean getHeaderJMSDeliveryMode() {
- return headerDeliveryMode;
- }
-
- private Boolean getURIJMSDeliveryMode() {
- return this.uriDeliveryMode;
- }
-
- public String getJMSURIType() {
- return uriType;
- }
- public void setJMSURIType(String type) {
- this.uriType = type;
- }
- public String getJMSHeaderType() {
- return headerType;
- }
-
- public void setJMSHeaderType(String type) {
- this.headerType = type;
- }
-
- public String getJMSCorrelationId() {
- return jmsCorrelationId;
- }
-
- public void setJMSCorrelationId(String jmsCorrelationId) {
- setHeaders( true );
- this.jmsCorrelationId = jmsCorrelationId;
- }
-
- 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 Map<String, String> getNativeOperationNames() {
- return nativeOperationNames;
- }
-
- 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 null;
- }
- }
- }
- 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 null;
- }
- } else {
- if (operationJMSDeliveryModes.containsKey(opName)) {
- return operationJMSDeliveryModes.get(opName);
- } else {
- return null;
- }
- }
- }
- 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 null;
- }
- } else {
- if (operationJMSTimeToLives.containsKey(opName)) {
- return operationJMSTimeToLives.get(opName);
- } else {
- return null;
- }
- }
- }
- 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 null;
- }
- } else {
- if (operationJMSPriorities.containsKey(opName)) {
- return operationJMSPriorities.get(opName);
- } else {
- return null;
- }
- }
- }
- public void setOperationJMSPriority(String opName, int p) {
- operationJMSPriorities.put(opName, p);
- }
-
- public String getJMSSelector() {
- if ( this.uriJmsSelector != null )
- return this.uriJmsSelector;
- else
- 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 QName getType() {
- return TYPE;
- }
-
- 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;
- }
-
- public ExtensionType getExtensionType() {
- return extensionType;
- }
-
- public void setExtensionType(ExtensionType intentAttachPointType) {
- this.extensionType = intentAttachPointType;
- }
-
- public String getJMSURI() {
- return jmsURI;
- }
- public void setJMSURI(String jmsURI) {
- this.jmsURI = jmsURI;
- }
-
-
- public void setURIJMSDeliveryMode(boolean equals) {
- this.uriDeliveryMode = Boolean.valueOf(equals);
- }
-
- public Integer getURIJMSPriority() {
- return this.uriJMSPriority;
- }
-
- public void setURIJMSPriority(int parseInt) {
- this.uriJMSPriority = Integer.valueOf(parseInt);
- }
-
- public Long getURIJMSTimeToLive() {
- return this.uriJMSTimeToLive;
- }
- public void setURIJMSTimeToLive(long parseLong) {
- this.uriJMSTimeToLive = Long.valueOf(parseLong);
- }
-
- public Boolean isHeaderDeliveryModePersistent() {
- return this.headerDeliveryMode;
- }
- public void setJMSHeaderDeliveryMode(boolean b) {
- this.headerDeliveryMode = Boolean.valueOf(b);
- }
-
- public Long getJMSHeaderTimeToLive() {
- return this.headerTimeToLive;
- }
- public void setJMSHeaderTimeToLive(long parseLong) {
- this.headerTimeToLive = Long.valueOf(parseLong);
- }
-
- public Integer getJMSHeaderPriority() {
- return this.headerPriority;
- }
- public void setJMSHeaderPriority(int p) {
- this.headerPriority = Integer.valueOf(p);
- }
-
- public Integer getDefaultJMSPriority() {
- return this.defaultPriority;
- }
-
- public void setIsDestinationSpecified(boolean b) {
- this.isDestinationSpecified = b;
- }
-
- public boolean isDestinationSpecified() {
- return this.isDestinationSpecified ;
- }
-
- public void setURIJMSSelector(String selector) {
- this.uriJmsSelector = selector;
- }
-
-}
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/JMSBindingConstants.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/JMSBindingConstants.java
deleted file mode 100644
index c55fa7f3e8..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/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;
-
-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.SCA11_NS, BINDING_JMS);
- String CORRELATE_MSG_ID = "messageID";
- String CORRELATE_CORRELATION_ID = "correlationID";
- 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 = "scaCallbackDestination";
- String CONVERSATION_ID_PROPERTY = "scaConversationId";
-
- // XML element and attribute names
- String HEADERS = "headers";
-
- int MSG_CTXT_POSITION = 0;
-}
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/JMSBindingException.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/JMSBindingException.java
deleted file mode 100644
index 74f030ca21..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/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;
-
-/**
- * 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/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/JMSBindingProcessor.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/JMSBindingProcessor.java
deleted file mode 100644
index 97dfd5f4cf..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/JMSBindingProcessor.java
+++ /dev/null
@@ -1,1706 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.jms;
-
-import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
-import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
-
-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.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.Base;
-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.PolicySubjectProcessor;
-import org.apache.tuscany.sca.binding.jms.operationselector.OperationSelectorJMSDefault;
-import org.apache.tuscany.sca.binding.jms.wireformat.WireFormatJMSDefault;
-import org.apache.tuscany.sca.binding.jms.wireformat.WireFormatJMSObject;
-import org.apache.tuscany.sca.binding.jms.wireformat.WireFormatJMSText;
-import org.apache.tuscany.sca.binding.jms.wireformat.WireFormatJMSTextXML;
-import org.apache.tuscany.sca.common.xml.stax.StAXHelper;
-import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.ContributionReadException;
-import org.apache.tuscany.sca.contribution.processor.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.processor.ContributionWriteException;
-import org.apache.tuscany.sca.contribution.processor.ProcessorContext;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.core.FactoryExtensionPoint;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.Problem;
-import org.apache.tuscany.sca.monitor.Problem.Severity;
-import org.apache.tuscany.sca.policy.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 type="string"?
- * deliveryMode="string"?
- * timeToLive="int"?
- * priority="string"?>
- * <property name="NMTOKEN" type="NMTOKEN">*
- * </headers>?
- *
- * <destination jndiName="xs:anyURI" type="string"? create="string"?>
- * <property name="NMTOKEN" type="NMTOKEN">*
- * </destination>?
- *
- * <connectionFactory jndiName="xs:anyURI" create="string"?>
- * <property name="NMTOKEN" type="NMTOKEN">*
- * </connectionFactory>?
- *
- * <activationSpec name="xs:anyURI" create="string"?>
- * <property name="NMTOKEN" type="NMTOKEN">*
- * </activationSpec>?
- *
- * <response>
- * <destination jndiName="xs:anyURI" type="string"? create="string"?>
- * <property name="NMTOKEN" type="NMTOKEN">*
- * </destination>?
- *
- * <connectionFactory jndiName="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" selectedOperation="string"?>
- * <property name="NMTOKEN" type="NMTOKEN">*
- * <headers type="string"?
- * deliveryMode="string"?
- * timeToLive="int"?
- * priority="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 PolicySubjectProcessor policyProcessor;
- private ConfiguredOperationProcessor configuredOperationProcessor;
- protected StAXArtifactProcessor<Object> extensionProcessor;
-
- public JMSBindingProcessor(FactoryExtensionPoint modelFactories, StAXArtifactProcessor<Object> extensionProcessor) {
- this.policyFactory = modelFactories.getFactory(PolicyFactory.class);
- this.policyProcessor = new PolicySubjectProcessor(policyFactory);
-
- this.configuredOperationProcessor =
- new ConfiguredOperationProcessor(modelFactories);
- this.extensionProcessor = extensionProcessor;
- }
-
- /**
- * Report a error.
- *
- * @param problems
- * @param message
- * @param model
- */
- private void warning(Monitor monitor, String message, Object model, Object... messageParameters) {
- if (monitor != null) {
- Problem problem = monitor.createProblem(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(Monitor monitor, String message, Object model, Object... messageParameters) {
- if (monitor != null) {
- Problem problem = monitor.createProblem(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, ProcessorContext context) throws ContributionReadException, XMLStreamException {
- Monitor monitor = context.getMonitor();
- 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, monitor);
- }
-
- // Read correlation scheme
- QName correlationScheme = StAXHelper.getAttributeAsQName(reader, "correlationScheme");
- if (correlationScheme != null) {
- if (Base.SCA11_NS.equals(correlationScheme.getNamespaceURI()) && JMSBindingConstants.VALID_CORRELATION_SCHEMES.contains(correlationScheme.getLocalPart())) {
- jmsBinding.setCorrelationScheme(correlationScheme.getLocalPart());
- } else {
- error(monitor, "InvalidCorrelationScheme", reader, correlationScheme);
- }
- }
-
- // Read initial context factory
- String initialContextFactory = getURIString(reader, "initialContextFactory");
- if (initialContextFactory != null && initialContextFactory.length() > 0) {
- jmsBinding.setInitialContextFactoryName(initialContextFactory);
- }
-
- // Read JNDI URL
- String jndiURL = getURIString(reader, "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, monitor);
- } else if ("connectionFactory".equals(elementName)) {
- parseConnectionFactory(reader, jmsBinding, monitor);
- } else if ("activationSpec".equals(elementName)) {
- parseActivationSpec(reader, jmsBinding, monitor);
- } else if ("response".equals(elementName)) {
- parseResponse(reader, jmsBinding, context);
- } else if ("resourceAdapter".equals(elementName)) {
- parseResourceAdapter(reader, jmsBinding, monitor);
- } else if ("headers".equals(elementName)) {
- parseHeaders(reader, jmsBinding, monitor);
- } else if ("operationProperties".equals(elementName)) {
- parseOperationProperties(reader, jmsBinding, monitor);
- } else if ("messageSelection".equals(elementName)) {
- parseSubscriptionHeaders(reader, jmsBinding);
- } else if (Constants.OPERATION_QNAME.equals(reader.getName())) {
- ConfiguredOperation confOp = configuredOperationProcessor.read(reader, context);
- if (confOp != null) {
- ((OperationsConfigurator)jmsBinding).getConfiguredOperations().add(confOp);
- }
- } else {
- Object extension = extensionProcessor.read(reader, context);
- if (extension != null) {
- if (extension instanceof WireFormat) {
- if (jmsBinding.getRequestWireFormat() == null) {
- jmsBinding.setRequestWireFormat((WireFormat) extension);
- } else {
- error(monitor, "WireFormatAlreadyDefined", reader, extension.toString());
- }
- } else if (extension instanceof OperationSelector) {
- if (jmsBinding.getOperationSelector() == null) {
- jmsBinding.setOperationSelector((OperationSelector) extension);
- } else {
- error(monitor, "OpSelectorAlreadyDefined", reader, extension.toString());
- }
-
- } else {
- error(monitor, "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(monitor, "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, monitor );
-
- return jmsBinding;
- }
-
- protected void parseURI(String uri, JMSBinding jmsBinding, Monitor monitor) {
- if (!(uri.startsWith("jms:jndi:") || uri.startsWith("jms:queue:") || uri.startsWith("jms:topic:"))) {
- error(monitor, "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("jndiConnectionFactoryName=")) {
- jmsBinding.setConnectionFactoryName(s.substring(26));
- } else if (s.startsWith("deliveryMode=")) {
- jmsBinding.setURIJMSDeliveryMode("persistent".equals(s.substring(13)));
- } else if (s.startsWith("priority=")) {
- jmsBinding.setURIJMSPriority(Integer.parseInt(s.substring(9)));
- } else if (s.startsWith("timeToLive=")) {
- jmsBinding.setURIJMSTimeToLive(Long.parseLong(s.substring(11)));
- } else if (s.startsWith("selector='")) {
- String selector = s.substring(10);
- if (selector.startsWith("\"") || selector.startsWith("'")) {
- selector = selector.substring(1, selector.length());
- }
- if (selector.endsWith("\"") || selector.endsWith("'")) {
- selector = selector.substring(0, selector.length() - 1);
- }
- jmsBinding.setURIJMSSelector(selector);
- } else if (s.startsWith("type")) {
- String type = s.substring(5);
- jmsBinding.setJMSURIType(type);
- } else {
- error(monitor, "UnknownTokenInURI", jmsBinding, s, uri);
- return;
- }
- }
- int j=uri.indexOf(':', 4);
- jmsBinding.setDestinationName(uri.substring(j+1, i));
- jmsBinding.setDestinationType(uri.substring(4, j));
- } else {
- int j=uri.indexOf(':', 4);
- jmsBinding.setDestinationName(uri.substring(j+1));
- jmsBinding.setDestinationType(uri.substring(4, j));
- }
- jmsBinding.setJMSURI(uri);
- }
-
- public void resolve(JMSBinding model, ModelResolver resolver, ProcessorContext context) throws ContributionResolveException {
- if (model.getRequestConnectionName() != null) {
- model.setRequestConnectionBinding(getConnectionBinding(model, "requestConnection", model.getRequestConnectionName(), resolver, context));
- }
- if (model.getResponseConnectionName() != null) {
- model.setResponseConnectionBinding(getConnectionBinding(model, "responseConnection", model.getResponseConnectionName(), resolver, context));
- }
- if (model.getOperationPropertiesName() != null) {
- model.setOperationPropertiesBinding(getConnectionBinding(model, "operationProperties", model.getOperationPropertiesName(), resolver, context));
- }
- }
-
- private JMSBinding getConnectionBinding(JMSBinding model, String attrName, QName bindingName, ModelResolver resolver, ProcessorContext context) {
- JMSBinding binding = new JMSBinding();
- binding.setTargetNamespace(bindingName.getNamespaceURI());
- binding.setName(bindingName.getLocalPart());
- binding.setUnresolved(true);
- binding = resolver.resolveModel(JMSBinding.class, binding, context);
- if (binding.isUnresolved())
- error(context.getMonitor(), "BindingNotFound", model, attrName, bindingName);
- return binding;
- }
-
- private void parseDestination(XMLStreamReader reader, JMSBinding jmsBinding, Monitor monitor) throws XMLStreamException {
- jmsBinding.setIsDestinationSpecified(true);
- String name = getURIString(reader, "jndiName");
- if (name != null && name.length() > 0) {
- jmsBinding.setDestinationName(name);
- }
-
- String type = reader.getAttributeValue(null, "type");
- if (type != null && type.length() > 0) {
- 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(monitor, "InvalidDestinationType", reader, type);
- }
- }
-
- String create = reader.getAttributeValue(null, "create");
- if (create != null && create.length() > 0) {
- validateCreate(create, reader, monitor);
- jmsBinding.setDestinationCreate(create);
- }
-
- jmsBinding.getDestinationProperties().putAll(parseBindingProperties(reader, monitor));
-
- if (jmsBinding.getDestinationCreate().equals(JMSBindingConstants.CREATE_IF_NOT_EXIST)) {
- if (name == null || name.length() < 1) {
- error(monitor, "MissingNameForCREATE_IF_NOT_EXIST", reader);
- }
- }
- if (jmsBinding.getDestinationCreate().equals(JMSBindingConstants.CREATE_NEVER)) {
- if (name == null || name.length() < 1) {
- error(monitor, "MissingNameForCREATE_NEVER", reader);
- }
- }
- }
-
- private void parseConnectionFactory(XMLStreamReader reader, JMSBinding jmsBinding, Monitor monitor) throws XMLStreamException {
- String name = getURIString(reader, "jndiName");
- if (name != null && name.length() > 0) {
- jmsBinding.setConnectionFactoryName(name);
- } else {
- error(monitor, "MissingConnectionFactoryName", reader);
- }
-
- String create = reader.getAttributeValue(null, "create");
- if (create != null && create.length() > 0) {
- validateCreate(create, reader, monitor);
- jmsBinding.setConnectionFactoryCreate(create);
- }
- if (jmsBinding.getConnectionFactoryCreate().equals(JMSBindingConstants.CREATE_IF_NOT_EXIST)) {
- if (name == null || name.length() < 1) {
- error(monitor, "MissingNameForCREATE_IF_NOT_EXIST", reader);
- }
- }
- if (jmsBinding.getConnectionFactoryCreate().equals(JMSBindingConstants.CREATE_NEVER)) {
- if (name == null || name.length() < 1) {
- error(monitor, "MissingNameForCREATE_NEVER", reader);
- }
- }
-
- jmsBinding.getConnectionFactoryProperties().putAll(parseBindingProperties(reader, monitor));
- }
-
- private void parseActivationSpec(XMLStreamReader reader, JMSBinding jmsBinding, Monitor monitor) throws XMLStreamException {
- String name = reader.getAttributeValue(null, "jndiName");
- if (name != null && name.length() > 0) {
- jmsBinding.setActivationSpecName(name);
- }
-
- String create = reader.getAttributeValue(null, "create");
- if (create != null && create.length() > 0) {
- validateCreate(create, reader, monitor);
- jmsBinding.setActivationSpecCreate(create);
- }
- if (jmsBinding.getActivationSpecCreate().equals(JMSBindingConstants.CREATE_IF_NOT_EXIST)) {
- if (name == null || name.length() < 1) {
- error(monitor, "MissingNameForCREATE_IF_NOT_EXIST", reader);
- }
- }
- if (jmsBinding.getActivationSpecCreate().equals(JMSBindingConstants.CREATE_NEVER)) {
- if (name == null || name.length() < 1) {
- error(monitor, "MissingNameForCREATE_NEVER", reader);
- }
- }
-
- jmsBinding.getActivationSpecProperties().putAll(parseBindingProperties(reader, monitor));
- }
-
- private void parseResponseDestination(XMLStreamReader reader, JMSBinding jmsBinding, Monitor monitor) throws XMLStreamException {
- String name = getURIString(reader, "jndiName");
- if (name != null && name.length() > 0) {
- jmsBinding.setResponseDestinationName(name);
- }
-
- String type = reader.getAttributeValue(null, "type");
- if (type != null && type.length() > 0) {
- warning(monitor, "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(monitor, "InvalidResponseDestinationType", reader, type);
- }
- }
-
- String create = reader.getAttributeValue(null, "create");
- if (create != null && create.length() > 0) {
- validateCreate(create, reader, monitor);
- jmsBinding.setResponseDestinationCreate(create);
- }
- if (jmsBinding.getResponseDestinationCreate().equals(JMSBindingConstants.CREATE_IF_NOT_EXIST)) {
- if (name == null || name.length() < 1) {
- error(monitor, "MissingNameForCREATE_IF_NOT_EXIST", reader);
- }
- }
- if (jmsBinding.getResponseDestinationCreate().equals(JMSBindingConstants.CREATE_NEVER)) {
- if (name == null || name.length() < 1) {
- error(monitor, "MissingNameForCREATE_NEVER", reader);
- }
- }
-
- jmsBinding.getResponseDestinationProperties().putAll(parseBindingProperties(reader, monitor));
- }
-
- private void parseResponseConnectionFactory(XMLStreamReader reader, JMSBinding jmsBinding, Monitor monitor) throws XMLStreamException {
- String name = getURIString(reader, "jndiName");
- if (name != null && name.length() > 0) {
- jmsBinding.setResponseConnectionFactoryName(name);
- } else {
- warning(monitor, "MissingResponseConnectionFactory", reader);
- }
- String create = reader.getAttributeValue(null, "create");
- if (create != null && create.length() > 0) {
- validateCreate(create, reader, monitor);
- jmsBinding.setResponseConnectionFactoryCreate(create);
- }
- if (jmsBinding.getResponseConnectionFactoryCreate().equals(JMSBindingConstants.CREATE_IF_NOT_EXIST)) {
- if (name == null || name.length() < 1) {
- error(monitor, "MissingNameForCREATE_IF_NOT_EXIST", reader);
- }
- }
- if (jmsBinding.getResponseConnectionFactoryCreate().equals(JMSBindingConstants.CREATE_NEVER)) {
- if (name == null || name.length() < 1) {
- error(monitor, "MissingNameForCREATE_NEVER", reader);
- }
- }
- jmsBinding.getResponseConnectionFactoryProperties().putAll(parseBindingProperties(reader, monitor));
- }
-
- private void parseResponseActivationSpec(XMLStreamReader reader, JMSBinding jmsBinding, Monitor monitor) throws XMLStreamException {
- String name = reader.getAttributeValue(null, "jndiName");
- if (name != null && name.length() > 0) {
- jmsBinding.setResponseActivationSpecName(name);
- }
- String create = reader.getAttributeValue(null, "create");
- if (create != null && create.length() > 0) {
- validateCreate(create, reader, monitor);
- jmsBinding.setResponseActivationSpecCreate(create);
- }
- if (jmsBinding.getResponseActivationSpecCreate().equals(JMSBindingConstants.CREATE_IF_NOT_EXIST)) {
- if (name == null || name.length() < 1) {
- error(monitor, "MissingNameForCREATE_IF_NOT_EXIST", reader);
- }
- }
- if (jmsBinding.getResponseActivationSpecCreate().equals(JMSBindingConstants.CREATE_NEVER)) {
- if (name == null || name.length() < 1) {
- error(monitor, "MissingNameForCREATE_NEVER", reader);
- }
- }
- jmsBinding.getResponseActivationSpecProperties().putAll(parseBindingProperties(reader, monitor));
- }
-
- private void validateCreate(String create, XMLStreamReader reader, Monitor monitor) {
- if (JMSBindingConstants.CREATE_ALWAYS.equals(create)) {
- return;
- }
- if (JMSBindingConstants.CREATE_NEVER.equals(create)) {
- return;
- }
- if (JMSBindingConstants.CREATE_IF_NOT_EXIST.equals(create)) {
- return;
- }
- error(monitor, "InvalidCreate", reader, create);
- }
-
- private void parseResponse(XMLStreamReader reader, JMSBinding jmsBinding, ProcessorContext context) throws ContributionReadException, XMLStreamException {
- // Read sub-elements of response
- Monitor monitor = context.getMonitor();
- while (true) {
- switch (reader.next()) {
- case START_ELEMENT:
- String elementName = reader.getName().getLocalPart();
- if ("destination".equals(elementName)) {
- parseResponseDestination(reader, jmsBinding, context.getMonitor());
- } else if ("connectionFactory".equals(elementName)) {
- parseResponseConnectionFactory(reader, jmsBinding, monitor);
- } else if ("activationSpec".equals(elementName)) {
- parseResponseActivationSpec(reader, jmsBinding, monitor);
- } else {
- Object extension = extensionProcessor.read(reader, context);
- if (extension != null) {
- if (extension instanceof WireFormat) {
- if (jmsBinding.getResponseWireFormat() == null) {
- jmsBinding.setResponseWireFormat((WireFormat)extension);
- } else {
- error(context.getMonitor(), "ResponseWireformatAlreadyDefined", reader, extension.toString());
- }
- } else {
- error(context.getMonitor(), "UnexpectedElement", reader, extension.toString());
- }
- }
- reader.next();
- }
- //reader.next();
- break;
- case END_ELEMENT:
- QName x = reader.getName();
- if (x.getLocalPart().equals("response")) {
- return;
- } else {
- error(context.getMonitor(), "UnexpectedResponseElement", reader, x.toString());
- }
- }
- }
- }
-
- private void parseResourceAdapter(XMLStreamReader reader, JMSBinding jmsBinding, Monitor monitor) throws XMLStreamException {
- String name = reader.getAttributeValue(null, "name");
- if (name != null && name.length() > 0) {
- jmsBinding.setResourceAdapterName(name);
- } else {
- error(monitor, "MissingResourceAdapterName", reader);
- }
- jmsBinding.getResourceAdapterProperties().putAll(parseBindingProperties(reader, monitor));
- }
-
- /**
- * <headers JMSType="string"?
- * JMSCorrelationID="string"?
- * JMSDeliveryMode="PERSISTENT or NON_PERSISTENT"?
- * timeToLive="long"?
- * JMSPriority="0 .. 9"?>
- * <property name="NMTOKEN" type="NMTOKEN"?>*
- * </headers>?
- */
- private void parseHeaders(XMLStreamReader reader, JMSBinding jmsBinding, Monitor monitor) throws XMLStreamException {
- String jmsType = reader.getAttributeValue(null, "type");
- if (jmsType != null && jmsType.length() > 0) {
- jmsBinding.setJMSHeaderType(jmsType);
- }
-
- String jmsDeliveryMode = reader.getAttributeValue(null, "deliveryMode");
- if (jmsDeliveryMode != null && jmsDeliveryMode.length() > 0) {
- if ("persistent".equalsIgnoreCase(jmsDeliveryMode)) {
- jmsBinding.setJMSHeaderDeliveryMode(true);
- } else if ("nonpersistent".equalsIgnoreCase(jmsDeliveryMode)) {
- jmsBinding.setJMSHeaderDeliveryMode(false);
- } else {
- error(monitor, "InvalidJMSDeliveryMode", jmsBinding, jmsDeliveryMode);
- }
- }
-
- String jmsTimeToLive = reader.getAttributeValue(null, "timeToLive");
- if (jmsTimeToLive != null && jmsTimeToLive.length() > 0) {
- jmsBinding.setJMSHeaderTimeToLive(Long.parseLong(jmsTimeToLive));
- }
-
- String jmsPriority = reader.getAttributeValue(null, "priority");
- if (jmsPriority != null && jmsPriority.length() > 0) {
- try {
- int p = Integer.parseInt(jmsPriority);
- if (p >= 0 && p <= 9) {
- jmsBinding.setJMSHeaderPriority(p);
- } else {
- warning(monitor, "InvalidJMSPriority", jmsBinding, jmsPriority);
- }
- } catch (NumberFormatException ex) {
- error(monitor, "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(monitor, "UnexpectedResponseElement", reader, x.toString());
- }
- }
- }
- }
-
- private void parseProperty(XMLStreamReader reader, JMSBinding jmsBinding) throws XMLStreamException {
- jmsBinding.setHeaders( true );
- String name = reader.getAttributeValue(null, "name");
- QName typeName = StAXHelper.getAttributeAsQName(reader, "type");
- String type = typeName == null ? null : typeName.getLocalPart();
-
- 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" selectedOperation="string"?>
- * <property name="NMTOKEN" type="NMTOKEN"?>*
- * <headers JMSType="string"?
- * JMSCorrelationID="string"?
- * JMSDeliveryMode="PERSISTENT or NON_PERSISTENT"?
- * timeToLive="long"?
- * JMSPriority="0 .. 9"?>
- * <property name="NMTOKEN" type="NMTOKEN"?>*
- * </headers>?
- * </operationProperties>*
- */
- private void parseOperationProperties(XMLStreamReader reader, JMSBinding jmsBinding, Monitor monitor) throws XMLStreamException {
-
- if (jmsBinding.getOperationPropertiesName() != null) {
- error(monitor, "DuplicateOperationProperties", jmsBinding);
- }
-
- String opName = reader.getAttributeValue(null, "name");
- if (opName == null || opName.length() < 1) {
- error(monitor, "MissingJMSOperationPropertyName", jmsBinding);
- return;
- }
- // Since nativeOpName, headers, and property elements are optional, must add opName.
- jmsBinding.addOperationName(opName);
- String nativeOpName = reader.getAttributeValue(null, "selectedOperation"); // 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, monitor);
- } else if (reader.getName().getLocalPart().equals("property")) { // optional
- processProperty(reader, props, monitor);
- }
- 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(monitor, "UnexpectedResponseElement", reader, x.toString());
- }
- }
- }
- }
- }
-
- private void parseOperationHeaders(XMLStreamReader reader, JMSBinding jmsBinding, String opName, Monitor monitor) throws XMLStreamException {
- String jmsType = reader.getAttributeValue(null, "type");
- if (jmsType != null && jmsType.length() > 0) {
- jmsBinding.setOperationJMSType(opName, jmsType);
- }
-
- String jmsDeliveryMode = reader.getAttributeValue(null, "deliveryMode");
- if (jmsDeliveryMode != null && jmsDeliveryMode.length() > 0) {
- if ("persistent".equalsIgnoreCase(jmsDeliveryMode)) {
- jmsBinding.setOperationJMSDeliveryMode(opName, true);
- } else if ("nonpersistent".equalsIgnoreCase(jmsDeliveryMode)) {
- jmsBinding.setOperationJMSDeliveryMode(opName, false);
- } else {
- error(monitor, "InvalidOPJMSDeliveryMode", jmsBinding, jmsDeliveryMode);
- }
- }
-
- String jmsTimeToLive = reader.getAttributeValue(null, "timeToLive");
- if (jmsTimeToLive != null && jmsTimeToLive.length() > 0) {
- jmsBinding.setOperationJMSTimeToLive(opName, Long.parseLong(jmsTimeToLive));
- }
-
- String jmsPriority = reader.getAttributeValue(null, "priority");
- if (jmsPriority != null && jmsPriority.length() > 0) {
- try {
- int p = Integer.parseInt(jmsPriority);
- if (p >= 0 && p <= 9) {
- jmsBinding.setOperationJMSPriority(opName, p);
- } else {
- warning(monitor, "InvalidOPJMSPriority", jmsBinding, jmsPriority);
- }
- } catch (NumberFormatException ex) {
- error(monitor, "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(monitor, "UnexpectedResponseElement", reader, x.toString());
- }
- }
- }
- }
-
- private void parseOperationPropertyProperties(XMLStreamReader reader, JMSBinding jmsBinding, String opName) throws XMLStreamException {
- String propName = reader.getAttributeValue(null, "name");
- QName typeName = StAXHelper.getAttributeAsQName(reader, "type");
- String type = typeName == null ? null : typeName.getLocalPart();
- 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, "selector");
- if (jmsSelector != null && jmsSelector.length() > 0 && jmsBinding.getJMSSelector() == null) {
- jmsBinding.setJMSSelector(jmsSelector);
- }
-
- // Skip to end element
- while (reader.hasNext()) {
- if (reader.next() == END_ELEMENT && "messageSelection".equals(reader.getName().getLocalPart())) {
- break;
- }
- } // end while
- }
-
- private Map<String, BindingProperty> parseBindingProperties(XMLStreamReader reader, Monitor monitor) 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, monitor);
- }
- 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, Monitor monitor) throws XMLStreamException {
- String name = reader.getAttributeValue(null, "name");
- if (name == null || name.length() < 1) {
- error(monitor, "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, 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, Monitor monitor ) {
- // 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(monitor, "DestinationQueueContradiction", jmsBinding, connectionFactoryName );
- }
- }
- if (JMSBindingConstants.DESTINATION_TYPE_TOPIC == jmsBinding.getDestinationType()) {
- if ( connectionFactoryName.contains( "queue" )) {
- error(monitor, "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(monitor, "ConnectionFactoryActivationSpecContradiction", jmsBinding, connectionFactoryName, activationSpecName );
- }
- }
-
- // If URI is specified, destination should not be present
- if ( ( jmsBinding.getJMSURI() != null ) && ( jmsBinding.getJMSURI().length() > 0) &&
- (jmsBinding.isDestinationSpecified())) {
- error(monitor, "DestinationURIContradiction", jmsBinding, jmsBinding.getJMSURI(), jmsBinding.getDestinationName());
- }
-
- // If activation spec and destination are both specified, they have to match
- if ( ( jmsBinding.getActivationSpecName() != null ) && (jmsBinding.getActivationSpecName().length() > 0 ) &&
- (jmsBinding.getDestinationName() != null) && (jmsBinding.getDestinationName().length() > 0 ) ) {
- if ( !jmsBinding.getActivationSpecName().equals(jmsBinding.getDestinationName())) {
- error(monitor, "ActivationSpecAndDestinationMismatch", jmsBinding, jmsBinding.getActivationSpecName(), jmsBinding.getDestinationName());
- }
- }
-
- if ( ( jmsBinding.getResponseActivationSpecName() != null ) && (jmsBinding.getResponseActivationSpecName().length() > 0 ) &&
- (jmsBinding.getResponseDestinationName() != null ) && (jmsBinding.getResponseDestinationName().length() > 0 ) ) {
- if ( !jmsBinding.getResponseActivationSpecName().equals(jmsBinding.getResponseDestinationName())) {
- error(monitor, "ActivationSpecAndDestinationMismatch", jmsBinding, jmsBinding.getResponseActivationSpecName(), jmsBinding.getResponseDestinationName());
- }
- }
- // If activation spec exists with create=always, a jndiName must be specified
- if (JMSBindingConstants.CREATE_ALWAYS.equals(jmsBinding.getActivationSpecCreate()) &&
- (jmsBinding.getActivationSpecName() == null)) {
- error(monitor, "ActivationSpecNameRequiredForCreateAlways", jmsBinding);
- }
- // If Connection factory specified then destination name must also be
- if (( connectionFactoryName != null ) && ( connectionFactoryName.length() > 0 )) {
- String destinationName = jmsBinding.getDestinationName();
- if ((destinationName == null) || (destinationName.length() < 1 )) {
- error(monitor, "ConnectionFactoryDestinationContradiction", jmsBinding, connectionFactoryName);
- }
- }
-
- // 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(monitor, "ResponseAttrElement", jmsBinding, responseConnectionName, responseDestinationName );
- }
- }
-
- // [BJM30029] The value of the operationProperties/@selectedOperation attribute MUST be unique across the containing binding.jms element
- Set<String> ops = new HashSet<String>(jmsBinding.getNativeOperationNames().values());
- if (ops.size() != jmsBinding.getNativeOperationNames().values().size()) {
- error(monitor, "BJM30029", jmsBinding);
- }
-
-
- // 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 writer an XMLStreamWriter that writes XML attributes and elements
- * @param jmsBinding JMSBinding model
- */
- public void write(JMSBinding jmsBinding, XMLStreamWriter writer, ProcessorContext context) throws ContributionWriteException,
- XMLStreamException {
- // Write a <binding.jms>
- writeStart(writer, Constants.SCA11_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.getJMSURI() != null) {
- writer.writeAttribute("uri", jmsBinding.getJMSURI());
- writeEnd(writer);
- return;
- }
-
- //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.SCA11_NS, "response");
- writeResponseDestinationProperties( jmsBinding, writer );
- writeResponseConnectionFactoryProperties( jmsBinding, writer );
- writeResponseActivationSpecProperties( jmsBinding, writer );
-
- if ((jmsBinding.getResponseWireFormat() != null) &&
- !(jmsBinding.getResponseWireFormat() instanceof WireFormatJMSDefault)){
- writeWireFormat(jmsBinding.getResponseWireFormat(), writer, context);
- }
-
- writer.writeEndElement();
- // Strange bug. Without white space, headers end tag improperly read.
- writer.writeCharacters( " " );
- }
-
- writeResourceAdapterProperties( jmsBinding, writer );
-
- writeConfiguredOperations( jmsBinding, writer, context );
-
- if ((jmsBinding.getRequestWireFormat() != null) &&
- !(jmsBinding.getRequestWireFormat() instanceof WireFormatJMSDefault)){
- writeWireFormat(jmsBinding.getRequestWireFormat(), writer, context);
- }
-
- if ((jmsBinding.getOperationSelector() != null) &&
- !(jmsBinding.getOperationSelector() instanceof OperationSelectorJMSDefault)){
- writeOperationSelector(jmsBinding.getOperationSelector(), writer, context);
- }
-
- writeEnd(writer);
- }
-
- /**
- * Writes headers element and its attributes.
- * <headers JMSType="string"?
- * JMSCorrelationID="string"?
- * JMSDeliveryMode="PERSISTENT or NON_PERSISTENT"?
- * timeToLive="long"?
- * JMSPriority="0 .. 9"?>
- * <property name="NMTOKEN" type="NMTOKEN"?>*
- * </headers>?
- */
- private void writeHeaders( JMSBinding jmsBinding, XMLStreamWriter writer) throws XMLStreamException {
-
- writer.writeStartElement(Constants.SCA11_NS, JMSBindingConstants.HEADERS);
-
- String jmsType = jmsBinding.getJMSHeaderType();
- if (jmsType != null && jmsType.length() > 0) {
- writer.writeAttribute("type", jmsType);
- }
-
- Boolean jmsDeliveryMode = jmsBinding.isHeaderDeliveryModePersistent();
- if (jmsDeliveryMode != null) {
- if ( jmsDeliveryMode.booleanValue() )
- writer.writeAttribute("deliveryMode", "persistent");
- else
- writer.writeAttribute("deliveryMode", "nonpersistent");
- }
-
- Long jmsTimeToLive = jmsBinding.getJMSHeaderTimeToLive();
- if (jmsTimeToLive != null) {
- writer.writeAttribute("timeToLive", jmsTimeToLive.toString());
- }
-
- Integer jmsPriority = jmsBinding.getJMSHeaderPriority();
- if (jmsPriority != null) {
- writer.writeAttribute("priority", 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>
- */
- @SuppressWarnings("unchecked")
- 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.SCA11_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" selectedOperation="string"?>
- * <property name="NMTOKEN" type="NMTOKEN">*
- * <headers JMSType="string"?
- * JMSCorrelationID="string"?
- * JMSDeliveryMode="string"?
- * timeToLive="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.SCA11_NS, "operationProperties");
- writer.writeAttribute("name", opName);
-
- String nativeOperation = jmsBinding.getNativeOperationName(opName);
- if (nativeOperation != null && nativeOperation.length() > 0) {
- if ( !nativeOperation.equals( opName )) {
- writer.writeAttribute("selectedOperation", 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.SCA11_NS, JMSBindingConstants.HEADERS);
-
- if (jmsType != null && jmsType.length() > 0) {
- writer.writeAttribute("type", jmsType);
- }
-
- if (jmsDeliveryMode != null) {
- if (jmsDeliveryMode.booleanValue())
- writer.writeAttribute("deliveryMode", "persistent");
- else
- writer.writeAttribute("deliveryMode", "nonpersistent");
- }
-
- if (jmsTimeToLive != null) {
- writer.writeAttribute("timeToLive", jmsTimeToLive.toString());
- }
-
- if (jmsPriority != null) {
- writer.writeAttribute("priority", 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>
- */
- @SuppressWarnings("unchecked")
- 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.SCA11_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="messageSelection">
- * <attribute name="selector" 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.SCA11_NS, "messageSelection");
- writer.writeAttribute("selector", jmsSubscriptionHeaders);
- writer.writeEndElement();
- // Strange bug. Without white space, headers end tag improperly read.
- // writer.writeCharacters( " " );
- }
- }
-
- /**
- * Writes destination properties if there are any.
- * <destination jndiName="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.SCA11_NS, "destination");
-
- if ( destinationName != null && destinationName.length() > 0) {
- writer.writeAttribute("jndiName", 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 jndiName="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.SCA11_NS, "connectionFactory");
-
- if ( cfName != null && cfName.length() > 0) {
- writer.writeAttribute("jndiName", 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.SCA11_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 jndiName="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.SCA11_NS, "destination");
-
- if ( destinationName != null && destinationName.length() > 0) {
- writer.writeAttribute("jndiName", 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 jndiName="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.SCA11_NS, "connectionFactory");
-
- if ( cfName != null && cfName.length() > 0) {
- writer.writeAttribute("jndiName", 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.SCA11_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.SCA11_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, ProcessorContext context) 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, context);
- }
-
- // 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, ProcessorContext context ) throws XMLStreamException, ContributionWriteException {
- extensionProcessor.write(wireFormat, writer, context);
- }
-
- /**
- * 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, ProcessorContext context ) throws XMLStreamException, ContributionWriteException{
- extensionProcessor.write(operationSeletor, writer, context);
- }
-
-}
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/OperationSelectorJMSDefault.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/OperationSelectorJMSDefault.java
deleted file mode 100644
index 9573ddfc38..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/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;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.OperationSelector;
-import org.apache.tuscany.sca.assembly.xml.Constants;
-
-/**
- * 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.SCA11_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/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/OperationSelectorJMSDefaultProcessor.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/OperationSelectorJMSDefaultProcessor.java
deleted file mode 100644
index 4f09eeb9a5..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/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;
-
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.ContributionReadException;
-import org.apache.tuscany.sca.contribution.processor.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.processor.ContributionWriteException;
-import org.apache.tuscany.sca.contribution.processor.ProcessorContext;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.core.FactoryExtensionPoint;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class OperationSelectorJMSDefaultProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<OperationSelectorJMSDefault> {
-
- public QName getArtifactType() {
- return OperationSelectorJMSDefault.OPERATION_SELECTOR_JMS_DEFAULT_QNAME;
- }
-
- public OperationSelectorJMSDefaultProcessor(FactoryExtensionPoint modelFactories) {
- }
-
-
- public OperationSelectorJMSDefault read(XMLStreamReader reader, ProcessorContext context) throws ContributionReadException, XMLStreamException {
- OperationSelectorJMSDefault wireFormat = new OperationSelectorJMSDefault();
-
- return wireFormat;
- }
-
- public void write(OperationSelectorJMSDefault wireFormat, XMLStreamWriter writer, ProcessorContext context)
- throws ContributionWriteException, XMLStreamException {
- String prefix = "tuscany";
- writer.writeStartElement(prefix,
- getArtifactType().getLocalPart(),
- getArtifactType().getNamespaceURI());
- writer.writeNamespace("tuscany", Constants.SCA11_TUSCANY_NS);
-
- writer.writeEndElement();
- }
-
- public Class<OperationSelectorJMSDefault> getModelType() {
- return OperationSelectorJMSDefault.class;
- }
-
- public void resolve(OperationSelectorJMSDefault arg0, ModelResolver arg1, ProcessorContext context) throws ContributionResolveException {
-
- }
-
-}
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/OperationSelectorJMSUserProp.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/OperationSelectorJMSUserProp.java
deleted file mode 100644
index f978adfa58..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/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;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.OperationSelector;
-import org.apache.tuscany.sca.assembly.xml.Constants;
-
-/**
- * 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.SCA11_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/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/OperationSelectorJMSUserPropProcessor.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/OperationSelectorJMSUserPropProcessor.java
deleted file mode 100644
index 9b731ffb1b..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/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;
-
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.ContributionReadException;
-import org.apache.tuscany.sca.contribution.processor.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.processor.ContributionWriteException;
-import org.apache.tuscany.sca.contribution.processor.ProcessorContext;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.core.FactoryExtensionPoint;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class OperationSelectorJMSUserPropProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<OperationSelectorJMSUserProp> {
-
- public QName getArtifactType() {
- return OperationSelectorJMSUserProp.OPERATION_SELECTOR_JMS_USERPROP_QNAME;
- }
-
- public OperationSelectorJMSUserPropProcessor(FactoryExtensionPoint modelFactories) {
- }
-
-
- public OperationSelectorJMSUserProp read(XMLStreamReader reader, ProcessorContext context) 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, ProcessorContext context)
- throws ContributionWriteException, XMLStreamException {
- String prefix = "tuscany";
- writer.writeStartElement(prefix,
- getArtifactType().getLocalPart(),
- getArtifactType().getNamespaceURI());
- writer.writeNamespace("tuscany", Constants.SCA11_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, ProcessorContext context) throws ContributionResolveException {
-
- }
-
-}
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/JMSTokenAuthenticationPolicy.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/JMSTokenAuthenticationPolicy.java
deleted file mode 100644
index 24f43d3027..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/JMSTokenAuthenticationPolicy.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.policy.authentication.token;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.xml.Constants;
-
-/**
- * Implementation for policies that could be injected as parameter
- * into the axis2config.
- *
- * @version $Rev$ $Date$
- */
-public class JMSTokenAuthenticationPolicy {
- public static final QName JMS_TOKEN_AUTHENTICATION_POLICY_QNAME = new QName(Constants.SCA11_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/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/JMSTokenAuthenticationPolicyProcessor.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/JMSTokenAuthenticationPolicyProcessor.java
deleted file mode 100644
index 4322595515..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/JMSTokenAuthenticationPolicyProcessor.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.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.processor.BaseStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.ContributionReadException;
-import org.apache.tuscany.sca.contribution.processor.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.processor.ContributionWriteException;
-import org.apache.tuscany.sca.contribution.processor.ProcessorContext;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class JMSTokenAuthenticationPolicyProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<JMSTokenAuthenticationPolicy> {
-
- public QName getArtifactType() {
- return JMSTokenAuthenticationPolicy.JMS_TOKEN_AUTHENTICATION_POLICY_QNAME;
- }
-
- public JMSTokenAuthenticationPolicyProcessor(ExtensionPointRegistry registry) {
- }
-
-
- public JMSTokenAuthenticationPolicy read(XMLStreamReader reader, ProcessorContext context) 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, ProcessorContext context)
- throws ContributionWriteException, XMLStreamException {
- String prefix = "tuscany";
- writer.writeStartElement(prefix,
- getArtifactType().getLocalPart(),
- getArtifactType().getNamespaceURI());
- writer.writeNamespace("tuscany", Constants.SCA11_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, ProcessorContext context) throws ContributionResolveException {
-
- }
-
-}
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/policy/header/JMSHeaderPolicy.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/policy/header/JMSHeaderPolicy.java
deleted file mode 100644
index 48fef397c7..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/policy/header/JMSHeaderPolicy.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.jms.policy.header;
-
-import java.util.Hashtable;
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.xml.Constants;
-
-/**
- * Implementation for policies that could be injected as parameter
- * into the axis2config.
- *
- * @version $Rev$ $Date$
- */
-public class JMSHeaderPolicy {
- public static final QName JMS_HEADER_POLICY_QNAME = new QName(Constants.SCA11_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/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/policy/header/JMSHeaderPolicyProcessor.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/policy/header/JMSHeaderPolicyProcessor.java
deleted file mode 100644
index c925c01554..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/policy/header/JMSHeaderPolicyProcessor.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.binding.jms.policy.header;
-
-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.assembly.xml.Messages;
-import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.ContributionReadException;
-import org.apache.tuscany.sca.contribution.processor.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.processor.ContributionWriteException;
-import org.apache.tuscany.sca.contribution.processor.ProcessorContext;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-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;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class JMSHeaderPolicyProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<JMSHeaderPolicy> {
-
-
-
- public QName getArtifactType() {
- return JMSHeaderPolicy.JMS_HEADER_POLICY_QNAME;
- }
-
- public JMSHeaderPolicyProcessor(ExtensionPointRegistry modelFactories) {
- }
-
- /**
- * Marshals warnings into the monitor
- *
- * @param message
- * @param model
- * @param messageParameters
- */
- protected void warning(Monitor monitor, String message, Object model, String... messageParameters) {
- if (monitor != null){
- Problem problem = monitor.createProblem(this.getClass().getName(), Messages.RESOURCE_BUNDLE, Severity.WARNING, model, message, (Object[])messageParameters);
- monitor.problem(problem);
- }
- }
-
- /**
- * Marshals errors into the monitor
- *
- * @param problems
- * @param message
- * @param model
- */
- protected void error(Monitor monitor, String message, Object model, Object... messageParameters) {
- if (monitor != null) {
- Problem problem = monitor.createProblem(this.getClass().getName(), Messages.RESOURCE_BUNDLE, Severity.ERROR, model, message, (Object[])messageParameters);
- monitor.problem(problem);
- }
- }
-
-
- public JMSHeaderPolicy read(XMLStreamReader reader, ProcessorContext context) throws ContributionReadException, XMLStreamException {
- JMSHeaderPolicy policy = new JMSHeaderPolicy();
- int event = reader.getEventType();
- QName name = null;
- Monitor monitor = context.getMonitor();
- 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(monitor, "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(monitor, "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(monitor, "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, ProcessorContext context)
- throws ContributionWriteException, XMLStreamException {
- String prefix = "tuscany";
- writer.writeStartElement(prefix,
- getArtifactType().getLocalPart(),
- getArtifactType().getNamespaceURI());
- writer.writeNamespace("tuscany", Constants.SCA11_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, ProcessorContext context) throws ContributionResolveException {
-
- }
-
-}
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/WireFormatJMSBytes.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/WireFormatJMSBytes.java
deleted file mode 100644
index a16cdc9c4f..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/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;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.WireFormat;
-import org.apache.tuscany.sca.assembly.xml.Constants;
-
-/**
- * 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.SCA11_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/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/WireFormatJMSBytesProcessor.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/WireFormatJMSBytesProcessor.java
deleted file mode 100644
index 8be904da3e..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/WireFormatJMSBytesProcessor.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;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.ContributionReadException;
-import org.apache.tuscany.sca.contribution.processor.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.processor.ContributionWriteException;
-import org.apache.tuscany.sca.contribution.processor.ProcessorContext;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.core.FactoryExtensionPoint;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class WireFormatJMSBytesProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<WireFormatJMSBytes> {
-
- public QName getArtifactType() {
- return WireFormatJMSBytes.WIRE_FORMAT_JMS_BYTES_QNAME;
- }
-
- public WireFormatJMSBytesProcessor(FactoryExtensionPoint modelFactories) {
- }
-
-
- public WireFormatJMSBytes read(XMLStreamReader reader, ProcessorContext context) throws ContributionReadException, XMLStreamException {
- WireFormatJMSBytes wireFormat = new WireFormatJMSBytes();
-
- return wireFormat;
- }
-
- public void write(WireFormatJMSBytes wireFormat, XMLStreamWriter writer, ProcessorContext context)
- throws ContributionWriteException, XMLStreamException {
- String prefix = "tuscany";
- writer.writeStartElement(prefix,
- getArtifactType().getLocalPart(),
- getArtifactType().getNamespaceURI());
- writer.writeNamespace("tuscany", Constants.SCA11_TUSCANY_NS);
-
- writer.writeEndElement();
- }
-
- public Class<WireFormatJMSBytes> getModelType() {
- return WireFormatJMSBytes.class;
- }
-
- public void resolve(WireFormatJMSBytes arg0, ModelResolver arg1, ProcessorContext context) throws ContributionResolveException {
-
- }
-
-}
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/WireFormatJMSBytesXML.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/WireFormatJMSBytesXML.java
deleted file mode 100644
index 4f7a91657f..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/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;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.WireFormat;
-import org.apache.tuscany.sca.assembly.xml.Constants;
-
-
-public class WireFormatJMSBytesXML implements WireFormat {
- public static final QName WIRE_FORMAT_JMS_BYTES_QNAME = new QName(Constants.SCA11_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/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/WireFormatJMSBytesXMLProcessor.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/WireFormatJMSBytesXMLProcessor.java
deleted file mode 100644
index 33533b23eb..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/WireFormatJMSBytesXMLProcessor.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;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.ContributionReadException;
-import org.apache.tuscany.sca.contribution.processor.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.processor.ContributionWriteException;
-import org.apache.tuscany.sca.contribution.processor.ProcessorContext;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.core.FactoryExtensionPoint;
-
-
-public class WireFormatJMSBytesXMLProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<WireFormatJMSBytesXML> {
-
- public QName getArtifactType() {
- return WireFormatJMSBytesXML.WIRE_FORMAT_JMS_BYTES_QNAME;
- }
-
- public WireFormatJMSBytesXMLProcessor(FactoryExtensionPoint modelFactories) {
- }
-
-
- public WireFormatJMSBytesXML read(XMLStreamReader reader, ProcessorContext context) throws ContributionReadException, XMLStreamException {
- WireFormatJMSBytesXML wireFormat = new WireFormatJMSBytesXML();
-
- return wireFormat;
- }
-
- public void write(WireFormatJMSBytesXML wireFormat, XMLStreamWriter writer, ProcessorContext context)
- throws ContributionWriteException, XMLStreamException {
- String prefix = "tuscany";
- writer.writeStartElement(prefix,
- getArtifactType().getLocalPart(),
- getArtifactType().getNamespaceURI());
- writer.writeNamespace("tuscany", Constants.SCA11_TUSCANY_NS);
-
- writer.writeEndElement();
- }
-
- public Class<WireFormatJMSBytesXML> getModelType() {
- return WireFormatJMSBytesXML.class;
- }
-
- public void resolve(WireFormatJMSBytesXML arg0, ModelResolver arg1, ProcessorContext context) throws ContributionResolveException {
-
- }
-
-}
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/WireFormatJMSDefault.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/WireFormatJMSDefault.java
deleted file mode 100644
index 3b429e5475..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/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;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.WireFormat;
-import org.apache.tuscany.sca.assembly.xml.Constants;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class WireFormatJMSDefault implements WireFormat {
- public static final QName WIRE_FORMAT_JMS_DEFAULT_QNAME = new QName(Constants.SCA11_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/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/WireFormatJMSDefaultProcessor.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/WireFormatJMSDefaultProcessor.java
deleted file mode 100644
index 6b5488a168..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/WireFormatJMSDefaultProcessor.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.jms.wireformat;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.ContributionReadException;
-import org.apache.tuscany.sca.contribution.processor.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.processor.ContributionWriteException;
-import org.apache.tuscany.sca.contribution.processor.ProcessorContext;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.core.FactoryExtensionPoint;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class WireFormatJMSDefaultProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<WireFormatJMSDefault> {
-
- public QName getArtifactType() {
- return WireFormatJMSDefault.WIRE_FORMAT_JMS_DEFAULT_QNAME;
- }
-
- public WireFormatJMSDefaultProcessor(FactoryExtensionPoint modelFactories) {
- }
-
- public WireFormatJMSDefault read(XMLStreamReader reader, ProcessorContext context) 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, ProcessorContext context) throws ContributionWriteException, XMLStreamException {
- String prefix = "tuscany";
- writer.writeStartElement(prefix, getArtifactType().getLocalPart(), getArtifactType().getNamespaceURI());
- writer.writeNamespace("tuscany", Constants.SCA11_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, ProcessorContext context) throws ContributionResolveException {
-
- }
-
-}
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/WireFormatJMSObject.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/WireFormatJMSObject.java
deleted file mode 100644
index e043139010..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/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;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.WireFormat;
-import org.apache.tuscany.sca.assembly.xml.Constants;
-
-/**
- * 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.SCA11_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/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/WireFormatJMSObjectProcessor.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/WireFormatJMSObjectProcessor.java
deleted file mode 100644
index cf0c0db0d7..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/WireFormatJMSObjectProcessor.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.wireformat;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.ContributionReadException;
-import org.apache.tuscany.sca.contribution.processor.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.processor.ContributionWriteException;
-import org.apache.tuscany.sca.contribution.processor.ProcessorContext;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.core.FactoryExtensionPoint;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class WireFormatJMSObjectProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<WireFormatJMSObject> {
-
- public QName getArtifactType() {
- return WireFormatJMSObject.WIRE_FORMAT_JMS_BYTES_QNAME;
- }
-
- public WireFormatJMSObjectProcessor(FactoryExtensionPoint modelFactories) {
- }
-
-
- public WireFormatJMSObject read(XMLStreamReader reader, ProcessorContext context) 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, ProcessorContext context)
- throws ContributionWriteException, XMLStreamException {
- String prefix = "tuscany";
- writer.writeStartElement(prefix,
- getArtifactType().getLocalPart(),
- getArtifactType().getNamespaceURI());
- writer.writeNamespace("tuscany", Constants.SCA11_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, ProcessorContext context) throws ContributionResolveException {
-
- }
-
-}
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/WireFormatJMSText.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/WireFormatJMSText.java
deleted file mode 100644
index 4f728cea92..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/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;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.WireFormat;
-import org.apache.tuscany.sca.assembly.xml.Constants;
-
-/**
- * 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.SCA11_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/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/WireFormatJMSTextProcessor.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/WireFormatJMSTextProcessor.java
deleted file mode 100644
index 5c564e044c..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/WireFormatJMSTextProcessor.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;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.ContributionReadException;
-import org.apache.tuscany.sca.contribution.processor.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.processor.ContributionWriteException;
-import org.apache.tuscany.sca.contribution.processor.ProcessorContext;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.core.FactoryExtensionPoint;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class WireFormatJMSTextProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<WireFormatJMSText> {
-
- public QName getArtifactType() {
- return WireFormatJMSText.WIRE_FORMAT_JMS_BYTES_QNAME;
- }
-
- public WireFormatJMSTextProcessor(FactoryExtensionPoint modelFactories) {
- }
-
-
- public WireFormatJMSText read(XMLStreamReader reader, ProcessorContext context) throws ContributionReadException, XMLStreamException {
- WireFormatJMSText wireFormat = new WireFormatJMSText();
-
- return wireFormat;
- }
-
- public void write(WireFormatJMSText wireFormat, XMLStreamWriter writer, ProcessorContext context)
- throws ContributionWriteException, XMLStreamException {
- String prefix = "tuscany";
- writer.writeStartElement(prefix,
- getArtifactType().getLocalPart(),
- getArtifactType().getNamespaceURI());
- writer.writeNamespace("tuscany", Constants.SCA11_TUSCANY_NS);
-
- writer.writeEndElement();
- }
-
- public Class<WireFormatJMSText> getModelType() {
- return WireFormatJMSText.class;
- }
-
- public void resolve(WireFormatJMSText arg0, ModelResolver arg1, ProcessorContext context) throws ContributionResolveException {
-
- }
-
-}
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/WireFormatJMSTextXML.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/WireFormatJMSTextXML.java
deleted file mode 100644
index be6187d2c5..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/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;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.WireFormat;
-import org.apache.tuscany.sca.assembly.xml.Constants;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class WireFormatJMSTextXML implements WireFormat {
- public static final QName WIRE_FORMAT_JMS_DEFAULT_QNAME = new QName(Constants.SCA11_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/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/WireFormatJMSTextXMLProcessor.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/WireFormatJMSTextXMLProcessor.java
deleted file mode 100644
index ae544f3163..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/WireFormatJMSTextXMLProcessor.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;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.ContributionReadException;
-import org.apache.tuscany.sca.contribution.processor.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.processor.ContributionWriteException;
-import org.apache.tuscany.sca.contribution.processor.ProcessorContext;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.core.FactoryExtensionPoint;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class WireFormatJMSTextXMLProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<WireFormatJMSTextXML> {
-
- public QName getArtifactType() {
- return WireFormatJMSTextXML.WIRE_FORMAT_JMS_DEFAULT_QNAME;
- }
-
- public WireFormatJMSTextXMLProcessor(FactoryExtensionPoint modelFactories) {
- }
-
-
- public WireFormatJMSTextXML read(XMLStreamReader reader, ProcessorContext context) throws ContributionReadException, XMLStreamException {
- WireFormatJMSTextXML wireFormat = new WireFormatJMSTextXML();
-
- return wireFormat;
- }
-
- public void write(WireFormatJMSTextXML wireFormat, XMLStreamWriter writer, ProcessorContext context)
- throws ContributionWriteException, XMLStreamException {
- String prefix = "tuscany";
- writer.writeStartElement(prefix,
- getArtifactType().getLocalPart(),
- getArtifactType().getNamespaceURI());
- writer.writeNamespace("tuscany", Constants.SCA11_TUSCANY_NS);
-
- writer.writeEndElement();
- }
-
- public Class<WireFormatJMSTextXML> getModelType() {
- return WireFormatJMSTextXML.class;
- }
-
- public void resolve(WireFormatJMSTextXML arg0, ModelResolver arg1, ProcessorContext context) throws ContributionResolveException {
-
- }
-
-}
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
deleted file mode 100644
index 8e984c511e..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
+++ /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 class for the artifact processor extension
-org.apache.tuscany.sca.binding.jms.JMSBindingProcessor;qname=http://docs.oasis-open.org/ns/opencsa/sca/200912#binding.jms,model=org.apache.tuscany.sca.binding.jms.JMSBinding
-org.apache.tuscany.sca.binding.jms.wireformat.WireFormatJMSDefaultProcessor;qname=http://docs.oasis-open.org/ns/opencsa/sca/200912#wireFormat.jmsDefault,model=org.apache.tuscany.sca.binding.jms.wireformat.WireFormatJMSDefault
-org.apache.tuscany.sca.binding.jms.wireformat.WireFormatJMSTextXMLProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.1#wireFormat.jmsTextXML,model=org.apache.tuscany.sca.binding.jms.wireformat.WireFormatJMSTextXML
-org.apache.tuscany.sca.binding.jms.wireformat.WireFormatJMSBytesProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.1#wireFormat.jmsBytes,model=org.apache.tuscany.sca.binding.jms.wireformat.WireFormatJMSBytes
-org.apache.tuscany.sca.binding.jms.wireformat.WireFormatJMSBytesXMLProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.1#wireFormat.jmsBytesXML,model=org.apache.tuscany.sca.binding.jms.wireformat.WireFormatJMSBytesXML
-org.apache.tuscany.sca.binding.jms.wireformat.WireFormatJMSTextProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.1#wireFormat.jmsText,model=org.apache.tuscany.sca.binding.jms.wireformat.WireFormatJMSText
-org.apache.tuscany.sca.binding.jms.wireformat.WireFormatJMSObjectProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.1#wireFormat.jmsObject,model=org.apache.tuscany.sca.binding.jms.wireformat.WireFormatJMSObject
-org.apache.tuscany.sca.binding.jms.operationselector.OperationSelectorJMSDefaultProcessor;qname=http://docs.oasis-open.org/ns/opencsa/sca/200912#operationSelector.jmsDefault,model=org.apache.tuscany.sca.binding.jms.operationselector.OperationSelectorJMSDefault
-org.apache.tuscany.sca.binding.jms.operationselector.OperationSelectorJMSUserPropProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.1#operationSelector.jmsUserProp,model=org.apache.tuscany.sca.binding.jms.operationselector.OperationSelectorJMSUserProp
-org.apache.tuscany.sca.binding.jms.policy.authentication.token.JMSTokenAuthenticationPolicyProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.1#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.1#jmsHeader,model=org.apache.tuscany.sca.binding.jms.policy.header.JMSHeaderPolicy
-
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/resources/META-INF/services/org.apache.tuscany.sca.definitions.xml.Definitions b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/resources/META-INF/services/org.apache.tuscany.sca.definitions.xml.Definitions
deleted file mode 100644
index 01b45bf203..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/resources/META-INF/services/org.apache.tuscany.sca.definitions.xml.Definitions
+++ /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/binding/jms/policy/definitions.xml
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/resources/binding-jms-policy-validation-messages.properties b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/resources/binding-jms-policy-validation-messages.properties
deleted file mode 100644
index fd43b2c4e9..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/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/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/resources/binding-jms-validation-messages.properties b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/resources/binding-jms-validation-messages.properties
deleted file mode 100644
index 6fe55f1c0f..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/resources/binding-jms-validation-messages.properties
+++ /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.
-#
-#
-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:jndi:' or 'jms:queue:' or 'jms:topic:' 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}
-DestinationURIContradiction = Destination {1} can not be specified when URI {0} is present
-ConnectionFactoryActivationSpecContradiction = Connection factory \"{0}\" and activation specification \"{0}\" are mutually exclusive
-ConnectionFactoryDestinationContradiction = When connection factory \"{0}\" element is present then a destination name must also be defined
-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
-WireFormatAlreadyDefined = The request wireformat has already been defined. Only one request wire format can be specified.
-OpSelectorAlreadyDefined = More than one operation selector has been specified. Only one operation selector can be specified.
-ResponseWireformatAlreadyDefined = The response wireformat has already been defined. Only one response wire format can be specified.
-MissingNameForCREATE_NEVER = Must specify jndiName attribute when create mode is "never"
-MissingNameForCREATE_IF_NOT_EXIST = Must specify jndiName attribute when create mode is "ifNotExist"
-InvalidCreate = Attribute create {0} invalid, must be 'always', 'never', or 'ifNotExist'
-ActivationSpecAndDestinationMismatch = Activation spec name {0} must match destination name {1}
-ActivationSpecNameRequiredForCreateAlways = A JNDI name must be specified when an ActivationSpec has a create mode of "always"
-BJM30029 = the selectedOperation attribute MUST be unique across the containing binding.jms element
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/resources/org/apache/tuscany/sca/binding/jms/policy/definitions.xml b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/resources/org/apache/tuscany/sca/binding/jms/policy/definitions.xml
deleted file mode 100644
index 343b4fc295..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/main/resources/org/apache/tuscany/sca/binding/jms/policy/definitions.xml
+++ /dev/null
@@ -1,29 +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://docs.oasis-open.org/ns/opencsa/sca/200912"
- targetNamespace="http://tuscany.apache.org/xmlns/sca/1.1"
- xmlns:sca="http://docs.oasis-open.org/ns/opencsa/sca/200912"
- xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1">
-
- <sca:bindingType type="sca:binding.jms"
- alwaysProvides="sca:JMS"
- mayProvide="sca:atLeastOnce sca:atMostOnce sca:ordered sca:asyncInvocation" />
-
-</sca:definitions> \ No newline at end of file
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/JMSBindingProcessorTestCase.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/JMSBindingProcessorTestCase.java
deleted file mode 100644
index c1fb89df8d..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/JMSBindingProcessorTestCase.java
+++ /dev/null
@@ -1,773 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, 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.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.WireFormatJMSBytes;
-import org.apache.tuscany.sca.binding.jms.wireformat.WireFormatJMSObject;
-import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.ProcessorContext;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
-
-/**
- * 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://docs.oasis-open.org/ns/opencsa/sca/200912\" targetNamespace=\"http://binding-jms\" name=\"binding-jms\">"
- + " <component name=\"HelloWorldComponent\">"
- + " <implementation.java class=\"services.HelloWorld\"/>"
- + " <service name=\"HelloWorldService\">"
- + " <binding.jms uri=\"jms:jndi:testQueue\" />"
- + " </service>"
- + " </component>"
- + "</composite>";
-
- public static final String HEADERS1 =
- "<?xml version=\"1.0\" encoding=\"ASCII\"?>"
- + "<composite xmlns=\"http://docs.oasis-open.org/ns/opencsa/sca/200912\" targetNamespace=\"http://binding-jms\" name=\"binding-jms\">"
- + " <component name=\"HelloWorldComponent\">"
- + " <implementation.java class=\"services.HelloWorld\"/>"
- + " <service name=\"HelloWorldService\">"
- + " <binding.jms uri=\"jms:testQueue\" >"
- + " <headers type=\"myType\" deliveryMode=\"persistent\" timeToLive=\"54321\" priority=\"5\">"
- + " </headers>"
- + " </binding.jms>"
- + " </service>"
- + " </component>"
- + "</composite>";
-
- public static final String HEADERS_INVALID_PRIORITY =
- "<?xml version=\"1.0\" encoding=\"ASCII\"?>"
- + "<composite xmlns=\"http://docs.oasis-open.org/ns/opencsa/sca/200912\" targetNamespace=\"http://binding-jms\" name=\"binding-jms\">"
- + " <component name=\"HelloWorldComponent\">"
- + " <implementation.java class=\"services.HelloWorld\"/>"
- + " <service name=\"HelloWorldService\">"
- + " <binding.jms uri=\"jms:testQueue\" >"
- + " <headers type=\"myType\" deliveryMode=\"persistent\" timeToLive=\"54321\" priority=\"medium\">"
- + " </headers>"
- + " </binding.jms>"
- + " </service>"
- + " </component>"
- + "</composite>";
-
- public static final String PROPERTIES1 =
- "<?xml version=\"1.0\" encoding=\"ASCII\"?>"
- + "<composite xmlns=\"http://docs.oasis-open.org/ns/opencsa/sca/200912\" 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://docs.oasis-open.org/ns/opencsa/sca/200912\" 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 type=\"op1Type\" >"
- + " <property name=\"p1\">bla</property>"
- + " <property name=\"intProp\" type=\"int\">42</property>"
- + " </headers>"
- + " </operationProperties >"
- + " <operationProperties name=\"op2\" nativeOperation=\"nativeOp2\" >"
- + " <headers type=\"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://docs.oasis-open.org/ns/opencsa/sca/200912\" 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://docs.oasis-open.org/ns/opencsa/sca/200912\" targetNamespace=\"http://binding-jms\" name=\"binding-jms\">"
- + " <component name=\"HelloWorldComponent\">"
- + " <implementation.java class=\"services.HelloWorld\"/>"
- + " <service name=\"HelloWorldService\">"
- + " <binding.jms uri=\"jms:testQueue\" >"
- + " <messageSelection selector=\"prop1 = 2\" />"
- + " </binding.jms>"
- + " </service>"
- + " </component>"
- + "</composite>";
-
- public static final String COMPOSITE_INVALID_URI =
- "<?xml version=\"1.0\" encoding=\"ASCII\"?>"
- + "<composite xmlns=\"http://docs.oasis-open.org/ns/opencsa/sca/200912\" 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://docs.oasis-open.org/ns/opencsa/sca/200912\" 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 jndiName=\"responseConnectionElementName\"/>"
- + " </response>"
- + " </binding.jms>"
- + " </service>"
- + " </component>"
- + "</composite>";
-
- public static final String DEST_PROPS =
- "<?xml version=\"1.0\" encoding=\"ASCII\"?>"
- + "<composite xmlns=\"http://docs.oasis-open.org/ns/opencsa/sca/200912\" targetNamespace=\"http://binding-jms\" name=\"binding-jms\">"
- + " <component name=\"HelloWorldComponent\">"
- + " <implementation.java class=\"services.HelloWorld\"/>"
- + " <service name=\"HelloWorldService\">"
- + " <binding.jms>"
- + " <destination jndiName=\"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://docs.oasis-open.org/ns/opencsa/sca/200912\" targetNamespace=\"http://binding-jms\" name=\"binding-jms\">"
- + " <component name=\"HelloWorldComponent\">"
- + " <implementation.java class=\"services.HelloWorld\"/>"
- + " <service name=\"HelloWorldService\">"
- + " <binding.jms>"
- + " <connectionFactory jndiName=\"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://docs.oasis-open.org/ns/opencsa/sca/200912\" 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://docs.oasis-open.org/ns/opencsa/sca/200912\" targetNamespace=\"http://binding-jms\" name=\"binding-jms\">"
- + " <component name=\"HelloWorldComponent\">"
- + " <implementation.java class=\"services.HelloWorld\"/>"
- + " <service name=\"HelloWorldService\">"
- + " <binding.jms>"
- + " <response>"
- + " <destination jndiName=\"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://docs.oasis-open.org/ns/opencsa/sca/200912\" targetNamespace=\"http://binding-jms\" name=\"binding-jms\">"
- + " <component name=\"HelloWorldComponent\">"
- + " <implementation.java class=\"services.HelloWorld\"/>"
- + " <service name=\"HelloWorldService\">"
- + " <binding.jms>"
- + " <response>"
- + " <connectionFactory jndiName=\"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://docs.oasis-open.org/ns/opencsa/sca/200912\" 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://docs.oasis-open.org/ns/opencsa/sca/200912\" 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://docs.oasis-open.org/ns/opencsa/sca/200912\" 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://docs.oasis-open.org/ns/opencsa/sca/200912\" 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://docs.oasis-open.org/ns/opencsa/sca/200912\" targetNamespace=\"http://binding-jms\" xmlns:tuscany=\"http://tuscany.apache.org/xmlns/sca/1.1\" name=\"binding-jms\">"
- + " <component name=\"HelloWorldComponent\">"
- + " <implementation.java class=\"services.HelloWorld\"/>"
- + " <service name=\"HelloWorldService\">"
- + " <binding.jms uri=\"jms:testQueue\" >"
- + " <response>"
- + " <destination jndiName=\"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://docs.oasis-open.org/ns/opencsa/sca/200912\" 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 ProcessorContext context;
-
- @Override
- protected void setUp() throws Exception {
- DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
- context = new ProcessorContext(extensionPoints);
- inputFactory = XMLInputFactory.newInstance();
- StAXArtifactProcessorExtensionPoint staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(extensionPoints);
- staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, 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, context);
- 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, context);
- JMSBinding binding = (JMSBinding) composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
-
- assertNotNull(binding);
- assertEquals("myType", binding.getJMSHeaderType());
- assertTrue(binding.isHeaderDeliveryModePersistent());
- assertEquals(54321, binding.getJMSHeaderTimeToLive().longValue());
- assertEquals(5, binding.getJMSHeaderPriority().intValue());
- }
-
- public void testProperties1() throws Exception {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(PROPERTIES1));
-
- Composite composite = (Composite)staxProcessor.read(reader, context);
- 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, context);
- 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, context);
- 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, context);
- } 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, context);
- } 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, context);
- } 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, context);
- 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, context);
- 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, context);
- 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, context);
- 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, context);
- 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, context);
- 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, context);
- 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, context);
- 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, context);
- 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, context);
- 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, context);
- 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, context);
- 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, context);
- JMSBinding binding = (JMSBinding) composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
-
- assertNotNull(binding);
- assertEquals( "foo", binding.getOperationPropertiesName().getLocalPart() );
- }
-}
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/JMSBindingProcessorWriteTestCase.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/JMSBindingProcessorWriteTestCase.java
deleted file mode 100644
index db138aa30d..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/JMSBindingProcessorWriteTestCase.java
+++ /dev/null
@@ -1,438 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, 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.io.ByteArrayOutputStream;
-import java.io.StringReader;
-
-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.DefaultStAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.ProcessorContext;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
-
-/**
- * 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;
-
- public static final String DEFAULT =
- "<?xml version=\"1.0\" encoding=\"ASCII\"?>"
- + "<composite xmlns=\"http://docs.oasis-open.org/ns/opencsa/sca/200912\" targetNamespace=\"http://binding-jms\" name=\"binding-jms\">"
- + " <component name=\"HelloWorldComponent\">"
- + " <service name=\"HelloWorldService\">"
- + " <binding.jms>"
- + " <destination jndiName=\"AAA\">"
- + " <property name=\"AAAProp\" type=\"string\"/>"
- + " </destination>"
- + " <connectionFactory jndiName=\"ABC\"/>"
- + " <response/>"
- + " <headers/>"
- + " <resourceAdapter name=\"GHI\"/>"
- + " <operationProperties name=\"JKL\">"
- + " </operationProperties>"
- + " </binding.jms>"
- + " </service>"
- + " </component>"
- + "</composite>";
-
- private ProcessorContext context;
-
- @Override
- protected void setUp() throws Exception {
- DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
- context = new ProcessorContext(extensionPoints);
- inputFactory = XMLInputFactory.newInstance();
- outputFactory = XMLOutputFactory.newInstance();
- StAXArtifactProcessorExtensionPoint staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(extensionPoints);
- staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, outputFactory);
- }
-
- /**
- * 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, context);
- 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), context);
-
- // Read written JMSBinding to a different JMSBinding model.
- XMLStreamReader reader2 = inputFactory.createXMLStreamReader(new StringReader(bos.toString()));
- Composite composite2 = (Composite)staxProcessor.read(reader2, context);
- 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 {
- Composite composite = (Composite)staxProcessor.read(inputFactory.createXMLStreamReader(new StringReader(JMSBindingProcessorTestCase.HEADERS1)), context);
- 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), context);
-
- // Read written JMSBinding to a different JMSBinding model.
- XMLStreamReader reader2 = inputFactory.createXMLStreamReader(new StringReader(bos.toString()));
- Composite composite2 = (Composite)staxProcessor.read(reader2, context);
- 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, context);
- 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), context);
-
- // Read written JMSBinding to a different JMSBinding model.
- XMLStreamReader reader2 = inputFactory.createXMLStreamReader(new StringReader(bos.toString()));
- Composite composite2 = (Composite)staxProcessor.read(reader2, context);
- 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, context);
- 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), context);
-
- // Read written JMSBinding to a different JMSBinding model.
- XMLStreamReader reader2 = inputFactory.createXMLStreamReader(new StringReader(bos.toString()));
- Composite composite2 = (Composite)staxProcessor.read(reader2, context);
- 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, context);
- 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), context);
-
- // Read written JMSBinding to a different JMSBinding model.
- XMLStreamReader reader2 = inputFactory.createXMLStreamReader(new StringReader(bos.toString()));
- Composite composite2 = (Composite)staxProcessor.read(reader2, context);
- 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, context);
- 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), context);
-
- // Read written JMSBinding to a different JMSBinding model.
- XMLStreamReader reader2 = inputFactory.createXMLStreamReader(new StringReader(bos.toString()));
- Composite composite2 = (Composite)staxProcessor.read(reader2, context);
- 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, context);
- 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), context);
-
- // Read written JMSBinding to a different JMSBinding model.
- XMLStreamReader reader2 = inputFactory.createXMLStreamReader(new StringReader(bos.toString()));
- Composite composite2 = (Composite)staxProcessor.read(reader2, context);
- 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, context);
- 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), context);
-
- // Read written JMSBinding to a different JMSBinding model.
- XMLStreamReader reader2 = inputFactory.createXMLStreamReader(new StringReader(bos.toString()));
- Composite composite2 = (Composite)staxProcessor.read(reader2, context);
- 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, context);
- 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), context);
-
- // Read written JMSBinding to a different JMSBinding model.
- XMLStreamReader reader2 = inputFactory.createXMLStreamReader(new StringReader(bos.toString()));
- Composite composite2 = (Composite)staxProcessor.read(reader2, context);
- 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, context);
- 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), context);
-
- // Read written JMSBinding to a different JMSBinding model.
- XMLStreamReader reader2 = inputFactory.createXMLStreamReader(new StringReader(bos.toString()));
- Composite composite2 = (Composite)staxProcessor.read(reader2, context);
- 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, context);
- 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), context);
-
- // Read written JMSBinding to a different JMSBinding model.
- XMLStreamReader reader2 = inputFactory.createXMLStreamReader(new StringReader(bos.toString()));
- Composite composite2 = (Composite)staxProcessor.read(reader2, context);
- 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, context);
- 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), context);
-
- // Read written JMSBinding to a different JMSBinding model.
- XMLStreamReader reader2 = inputFactory.createXMLStreamReader(new StringReader(bos.toString()));
- Composite composite2 = (Composite)staxProcessor.read(reader2, context);
- 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, context);
- 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), context);
-
- // Read written JMSBinding to a different JMSBinding model.
- XMLStreamReader reader2 = inputFactory.createXMLStreamReader(new StringReader(bos.toString()));
- Composite composite2 = (Composite)staxProcessor.read(reader2, context);
- 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, context);
- 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), context);
-
- // Read written JMSBinding to a different JMSBinding model.
- XMLStreamReader reader2 = inputFactory.createXMLStreamReader(new StringReader(bos.toString()));
- Composite composite2 = (Composite)staxProcessor.read(reader2, context);
- 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, context);
- 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), context);
-
- // Read written JMSBinding to a different JMSBinding model.
- XMLStreamReader reader2 = inputFactory.createXMLStreamReader(new StringReader(bos.toString()));
- Composite composite2 = (Composite)staxProcessor.read(reader2, context);
- 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, context);
- 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), context);
-
- System.out.println(bos.toString());
- assertEquals(bos.toString(),
- "<?xml version=\'1.0\' encoding=\'UTF-8\'?>" +
- "<composite xmlns=\"http://docs.oasis-open.org/ns/opencsa/sca/200912\" targetNamespace=\"http://binding-jms\" name=\"binding-jms\">" +
- "<component name=\"HelloWorldComponent\">" +
- "<service name=\"HelloWorldService\">" +
- "<binding.jms><operationProperties name=\"JKL\" /> " +
- "<destination jndiName=\"AAA\">" +
- "<property name=\"AAAProp\" type=\"string\"></property>" +
- "</destination> " +
- "<connectionFactory jndiName=\"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, context);
- 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), context);
-
- // Read written JMSBinding to a different JMSBinding model.
- XMLStreamReader reader2 = inputFactory.createXMLStreamReader(new StringReader(bos.toString()));
- Composite composite2 = (Composite)staxProcessor.read(reader2, context);
- 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/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/policy/PolicyProcessorTestCase.java b/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/policy/PolicyProcessorTestCase.java
deleted file mode 100644
index 326bb54cca..0000000000
--- a/sca-java-2.x/branches/2.0-Beta2/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/policy/PolicyProcessorTestCase.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.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.ProcessorContext;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.junit.Ignore;
-import org.junit.Test;
-
-/**
- * @version $Rev$ $Date$
- */
-@Ignore("TODO: 2.x migration")
-public class PolicyProcessorTestCase {
- private final static List<String> SEQ =
- Arrays.asList("<tuscany:jmsHeader xmlns:tuscany=\"http://tuscany.apache.org/xmlns/sca/1.1\" 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.1\" 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));
- processors.put(JMSTokenAuthenticationPolicy.JMS_TOKEN_AUTHENTICATION_POLICY_QNAME, new JMSTokenAuthenticationPolicyProcessor(null));
-
- InputStream is = getClass().getResourceAsStream("mock_policy_definitions.xml");
- XMLInputFactory inputFactory = XMLInputFactory.newInstance();
- XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
-
- XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
- ProcessorContext context =new ProcessorContext();
- 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());
- Object xxx = processor.read(reader, context);
-// Policy policy = (Policy)processor.read(reader);
-
- ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
- XMLStreamWriter writer = outputFactory.createXMLStreamWriter(outputStream);
- processor.write(xxx, writer, context);
-// processor.write(policy, writer);
- writer.flush();
- results.add(outputStream.toString());
- }
- }
- if (reader.hasNext()) {
- reader.next();
- } else {
- break;
- }
- }
- Assert.assertEquals(SEQ, results);
- }
-}