summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/branches/2.0-Beta1/modules/binding-jms-runtime/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--sca-java-2.x/branches/2.0-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/modules/binding-jms-runtime/src/test/resources/simple/client.composite38
-rw-r--r--sca-java-2.x/branches/2.0-Beta1/modules/binding-jms-runtime/src/test/resources/simple/service.composite35
86 files changed, 0 insertions, 9171 deletions
diff --git a/sca-java-2.x/branches/2.0-Beta1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/context/JMSBindingContext.java b/sca-java-2.x/branches/2.0-Beta1/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-Beta1/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-Beta1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/headers/HeaderReferenceInterceptor.java b/sca-java-2.x/branches/2.0-Beta1/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-Beta1/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-Beta1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/headers/HeaderServiceInterceptor.java b/sca-java-2.x/branches/2.0-Beta1/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-Beta1/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-Beta1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/host/DefaultJMSHostExtensionPoint.java b/sca-java-2.x/branches/2.0-Beta1/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-Beta1/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-Beta1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/host/DefaultJMSServiceListener.java b/sca-java-2.x/branches/2.0-Beta1/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-Beta1/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-Beta1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/host/DefaultJMSServiceListenerFactory.java b/sca-java-2.x/branches/2.0-Beta1/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-Beta1/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-Beta1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/host/DefaultServiceInvoker.java b/sca-java-2.x/branches/2.0-Beta1/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-Beta1/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-Beta1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/host/JMSHostExtensionPoint.java b/sca-java-2.x/branches/2.0-Beta1/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-Beta1/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-Beta1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/host/JMSServiceListener.java b/sca-java-2.x/branches/2.0-Beta1/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-Beta1/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-Beta1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/host/JMSServiceListenerDetails.java b/sca-java-2.x/branches/2.0-Beta1/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-Beta1/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-Beta1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/host/JMSServiceListenerFactory.java b/sca-java-2.x/branches/2.0-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/AbstractMessageProcessor.java b/sca-java-2.x/branches/2.0-Beta1/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-Beta1/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-Beta1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/BytesMessageProcessor.java b/sca-java-2.x/branches/2.0-Beta1/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-Beta1/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-Beta1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/DefaultJMSResourceFactoryExtensionPoint.java b/sca-java-2.x/branches/2.0-Beta1/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-Beta1/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-Beta1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/DefaultMessageProcessor.java b/sca-java-2.x/branches/2.0-Beta1/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-Beta1/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-Beta1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingProviderFactory.java b/sca-java-2.x/branches/2.0-Beta1/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-Beta1/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-Beta1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingReferenceBindingProvider.java b/sca-java-2.x/branches/2.0-Beta1/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-Beta1/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-Beta1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingServiceBindingProvider.java b/sca-java-2.x/branches/2.0-Beta1/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-Beta1/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-Beta1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSMessageProcessor.java b/sca-java-2.x/branches/2.0-Beta1/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-Beta1/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-Beta1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSMessageProcessorUtil.java b/sca-java-2.x/branches/2.0-Beta1/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-Beta1/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-Beta1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSResourceFactory.java b/sca-java-2.x/branches/2.0-Beta1/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-Beta1/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-Beta1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSResourceFactoryExtensionPoint.java b/sca-java-2.x/branches/2.0-Beta1/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-Beta1/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-Beta1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSResourceFactoryImpl.java b/sca-java-2.x/branches/2.0-Beta1/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-Beta1/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-Beta1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/ObjectMessageProcessor.java b/sca-java-2.x/branches/2.0-Beta1/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-Beta1/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-Beta1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/RRBJMSBindingInvoker.java b/sca-java-2.x/branches/2.0-Beta1/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-Beta1/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-Beta1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/TextMessageProcessor.java b/sca-java-2.x/branches/2.0-Beta1/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-Beta1/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-Beta1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/XMLBytesMessageProcessor.java b/sca-java-2.x/branches/2.0-Beta1/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-Beta1/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-Beta1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/XMLTextMessageProcessor.java b/sca-java-2.x/branches/2.0-Beta1/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-Beta1/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-Beta1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/transport/TransportReferenceInterceptor.java b/sca-java-2.x/branches/2.0-Beta1/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-Beta1/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-Beta1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/transport/TransportServiceInterceptor.java b/sca-java-2.x/branches/2.0-Beta1/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-Beta1/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-Beta1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wire/CallbackDestinationInterceptor.java b/sca-java-2.x/branches/2.0-Beta1/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-Beta1/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-Beta1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wire/OperationPropertiesInterceptor.java b/sca-java-2.x/branches/2.0-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/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-Beta1/modules/binding-jms-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory b/sca-java-2.x/branches/2.0-Beta1/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-Beta1/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-Beta1/modules/binding-jms-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.OperationSelectorProviderFactory b/sca-java-2.x/branches/2.0-Beta1/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-Beta1/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-Beta1/modules/binding-jms-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory b/sca-java-2.x/branches/2.0-Beta1/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-Beta1/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-Beta1/modules/binding-jms-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.WireFormatProviderFactory b/sca-java-2.x/branches/2.0-Beta1/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-Beta1/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-Beta1/modules/binding-jms-runtime/src/test/java/org/apache/tuscany/sca/binding/jms/HelloWorldClientImpl.java b/sca-java-2.x/branches/2.0-Beta1/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-Beta1/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-Beta1/modules/binding-jms-runtime/src/test/java/org/apache/tuscany/sca/binding/jms/HelloWorldService.java b/sca-java-2.x/branches/2.0-Beta1/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-Beta1/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-Beta1/modules/binding-jms-runtime/src/test/java/org/apache/tuscany/sca/binding/jms/HelloWorldServiceImpl.java b/sca-java-2.x/branches/2.0-Beta1/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-Beta1/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-Beta1/modules/binding-jms-runtime/src/test/java/org/apache/tuscany/sca/binding/jms/OperationSelectionTestCaseFIXME.java b/sca-java-2.x/branches/2.0-Beta1/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-Beta1/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-Beta1/modules/binding-jms-runtime/src/test/resources/simple/client.composite b/sca-java-2.x/branches/2.0-Beta1/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-Beta1/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-Beta1/modules/binding-jms-runtime/src/test/resources/simple/service.composite b/sca-java-2.x/branches/2.0-Beta1/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-Beta1/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>