summaryrefslogtreecommitdiffstats
path: root/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca
diff options
context:
space:
mode:
Diffstat (limited to 'java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca')
-rw-r--r--java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/context/JMSBindingContext.java141
-rw-r--r--java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/headers/HeaderReferenceInterceptor.java166
-rw-r--r--java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/host/DefaultJMSHostExtensionPoint.java40
-rw-r--r--java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/host/DefaultJMSServiceListener.java234
-rw-r--r--java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/host/DefaultJMSServiceListenerFactory.java55
-rw-r--r--java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/host/DefaultServiceInvoker.java106
-rw-r--r--java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/host/JMSHostExtensionPoint.java27
-rw-r--r--java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/host/JMSServiceListener.java29
-rw-r--r--java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/host/JMSServiceListenerDetails.java37
-rw-r--r--java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/host/JMSServiceListenerFactory.java27
-rw-r--r--java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/runtime/OperationSelectorJMSDefaultProviderFactory.java60
-rw-r--r--java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/runtime/OperationSelectorJMSDefaultServiceInterceptor.java190
-rw-r--r--java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/runtime/OperationSelectorJMSDefaultServiceProvider.java53
-rw-r--r--java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsuserprop/runtime/OperationSelectorJMSUserPropProviderFactory.java56
-rw-r--r--java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsuserprop/runtime/OperationSelectorJMSUserPropServiceInterceptor.java107
-rw-r--r--java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsuserprop/runtime/OperationSelectorJMSUserPropServiceProvider.java47
-rw-r--r--java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/provider/JMSTokenAuthenticationPolicyProviderFactory.java76
-rw-r--r--java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/provider/JMSTokenAuthenticationReferencePolicyInterceptor.java104
-rw-r--r--java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/provider/JMSTokenAuthenticationReferencePolicyProvider.java85
-rw-r--r--java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/provider/JMSTokenAuthenticationServicePolicyInterceptor.java106
-rw-r--r--java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/provider/JMSTokenAuthenticationServicePolicyProvider.java85
-rw-r--r--java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/policy/header/JMSHeaderPolicyProviderFactory.java82
-rw-r--r--java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/policy/header/JMSHeaderReferencePolicyInterceptor.java87
-rw-r--r--java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/policy/header/JMSHeaderReferencePolicyProvider.java86
-rw-r--r--java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/AbstractMessageProcessor.java136
-rw-r--r--java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/BytesMessageProcessor.java120
-rw-r--r--java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/DefaultJMSResourceFactoryExtensionPoint.java30
-rw-r--r--java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/DefaultMessageProcessor.java288
-rw-r--r--java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingProviderFactory.java76
-rw-r--r--java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingReferenceBindingProvider.java169
-rw-r--r--java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingServiceBindingProvider.java236
-rw-r--r--java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSMessageProcessor.java55
-rw-r--r--java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSMessageProcessorUtil.java109
-rw-r--r--java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSResourceFactory.java95
-rw-r--r--java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSResourceFactoryExtensionPoint.java28
-rw-r--r--java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSResourceFactoryImpl.java282
-rw-r--r--java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/ObjectMessageProcessor.java231
-rw-r--r--java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/RRBJMSBindingInvoker.java267
-rw-r--r--java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/TextMessageProcessor.java80
-rw-r--r--java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/XMLBytesMessageProcessor.java135
-rw-r--r--java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/XMLTextMessageProcessor.java132
-rw-r--r--java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/transport/TransportReferenceInterceptor.java157
-rw-r--r--java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/transport/TransportServiceInterceptor.java186
-rw-r--r--java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wire/CallbackDestinationInterceptor.java94
-rw-r--r--java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wire/OperationPropertiesInterceptor.java69
-rw-r--r--java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesProviderFactory.java60
-rw-r--r--java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesReferenceInterceptor.java123
-rw-r--r--java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesReferenceProvider.java92
-rw-r--r--java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesServiceInterceptor.java115
-rw-r--r--java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesServiceProvider.java96
-rw-r--r--java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytesxml/runtime/WireFormatJMSBytesXMLProviderFactory.java64
-rw-r--r--java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytesxml/runtime/WireFormatJMSBytesXMLReferenceInterceptor.java123
-rw-r--r--java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytesxml/runtime/WireFormatJMSBytesXMLReferenceProvider.java100
-rw-r--r--java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytesxml/runtime/WireFormatJMSBytesXMLServiceInterceptor.java109
-rw-r--r--java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytesxml/runtime/WireFormatJMSBytesXMLServiceProvider.java108
-rw-r--r--java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/runtime/WireFormatJMSDefaultProviderFactory.java66
-rw-r--r--java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/runtime/WireFormatJMSDefaultReferenceInterceptor.java175
-rw-r--r--java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/runtime/WireFormatJMSDefaultReferenceProvider.java201
-rw-r--r--java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/runtime/WireFormatJMSDefaultServiceInterceptor.java175
-rw-r--r--java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/runtime/WireFormatJMSDefaultServiceProvider.java193
-rw-r--r--java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectProviderFactory.java60
-rw-r--r--java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectReferenceInterceptor.java142
-rw-r--r--java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectReferenceProvider.java113
-rw-r--r--java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectServiceInterceptor.java139
-rw-r--r--java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectServiceProvider.java119
-rw-r--r--java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextProviderFactory.java60
-rw-r--r--java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextReferenceInterceptor.java124
-rw-r--r--java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextReferenceProvider.java101
-rw-r--r--java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextServiceInterceptor.java115
-rw-r--r--java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextServiceProvider.java103
-rw-r--r--java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLProviderFactory.java66
-rw-r--r--java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLReferenceInterceptor.java129
-rw-r--r--java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLReferenceProvider.java113
-rw-r--r--java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLServiceInterceptor.java116
-rw-r--r--java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLServiceProvider.java108
75 files changed, 0 insertions, 8469 deletions
diff --git a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/context/JMSBindingContext.java b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/context/JMSBindingContext.java
deleted file mode 100644
index e38a9d0c60..0000000000
--- a/java/sca/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/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/headers/HeaderReferenceInterceptor.java b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/headers/HeaderReferenceInterceptor.java
deleted file mode 100644
index b067b6ed12..0000000000
--- a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/headers/HeaderReferenceInterceptor.java
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.jms.headers;
-
-
-
-
-import java.util.Map;
-
-import javax.jms.DeliveryMode;
-import javax.jms.JMSException;
-
-import org.apache.tuscany.sca.assembly.WireFormat;
-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 JMSResourceFactory jmsResourceFactory;
- private JMSBinding jmsBinding;
- private JMSMessageProcessor requestMessageProcessor;
- private JMSMessageProcessor responseMessageProcessor;
- private String correlationScheme;
- private WireFormat requestWireFormat;
- private WireFormat responseWireFormat;
-
- public HeaderReferenceInterceptor(ExtensionPointRegistry extensions, JMSBinding jmsBinding, JMSResourceFactory jmsResourceFactory, RuntimeEndpointReference runtimeWire) {
- super();
- this.jmsBinding = jmsBinding;
- this.runtimeWire = runtimeWire;
- this.jmsResourceFactory = jmsResourceFactory;
- this.requestMessageProcessor = JMSMessageProcessorUtil.getRequestMessageProcessor(extensions, jmsBinding);
- this.responseMessageProcessor = JMSMessageProcessorUtil.getResponseMessageProcessor(extensions, jmsBinding);
- this.correlationScheme = jmsBinding.getCorrelationScheme();
-
- }
-
- public Message invoke(Message msg) {
-
- return next.invoke(invokeRequest(msg));
-
- }
-
- public Message invokeRequest(Message tuscanyMsg) {
- try {
- // get the jms context
- JMSBindingContext context = tuscanyMsg.getBindingContext();
- javax.jms.Message jmsMsg = tuscanyMsg.getBody();
-
- Operation operation = tuscanyMsg.getOperation();
- String operationName = operation.getName();
- 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.getOperationJMSDeliveryMode(operationName) != null) {
- if (jmsBinding.getOperationJMSDeliveryMode(operationName)) {
- jmsMsg.setJMSDeliveryMode(DeliveryMode.PERSISTENT);
- } else {
- jmsMsg.setJMSDeliveryMode(DeliveryMode.NON_PERSISTENT);
- }
- }
-
- if (jmsBinding.getOperationJMSCorrelationId(operationName) != null) {
- jmsMsg.setJMSCorrelationID(jmsBinding.getOperationJMSCorrelationId(operationName));
- }
-
- if (jmsBinding.getOperationJMSPriority(operationName) != null) {
- jmsMsg.setJMSPriority(jmsBinding.getOperationJMSPriority(operationName));
- }
-
- if (jmsBinding.getOperationJMSType(operationName) != null) {
- jmsMsg.setJMSType(jmsBinding.getOperationJMSType(operationName));
- }
-
- if (tuscanyMsg.getFrom().getCallbackEndpoint() != null) {
-
- String callbackDestName = getCallbackDestinationName(reference);
- if (callbackDestName != null) {
- jmsMsg.setStringProperty(JMSBindingConstants.CALLBACK_Q_PROPERTY, callbackDestName);
- }
- }
-
- for (String propName : jmsBinding.getPropertyNames()) {
- Object value = jmsBinding.getProperty(propName);
- jmsMsg.setObjectProperty(propName, value);
- }
-
- Map<String, Object> operationProperties = jmsBinding.getOperationProperties(operationName);
- if (operationProperties != null) {
- for (String propName : operationProperties.keySet()) {
- Object value = operationProperties.get(propName);
- jmsMsg.setObjectProperty(propName, value);
- }
- }
-
- if (jmsBinding.getOperationJMSTimeToLive(operationName) != null) {
- context.setTimeToLive(jmsBinding.getOperationJMSTimeToLive(operationName) * 2);
- } else {
- context.setTimeToLive(JMSBindingConstants.DEFAULT_TIME_TO_LIVE);
- }
-
- return tuscanyMsg;
- } catch (JMSException e) {
- throw new JMSBindingException(e);
- }
- }
-
-
- protected String getCallbackDestinationName(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/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/host/DefaultJMSHostExtensionPoint.java b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/host/DefaultJMSHostExtensionPoint.java
deleted file mode 100644
index 7de30c265a..0000000000
--- a/java/sca/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/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/host/DefaultJMSServiceListener.java b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/host/DefaultJMSServiceListener.java
deleted file mode 100644
index f120055dde..0000000000
--- a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/host/DefaultJMSServiceListener.java
+++ /dev/null
@@ -1,234 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.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 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: 721811 $ $Date: 2008-11-30 13:46:51 +0000 (Sun, 30 Nov 2008) $
- */
-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 {
- registerListerner();
- } catch (Exception e) {
- throw new JMSBindingException("Error starting JMSServiceBinding", e);
- }
- }
-
- public void stop() {
- this.running = false;
- try {
- consumer.close();
- jmsResourceFactory.closeConnection();
- jmsResourceFactory.closeResponseConnection();
- } catch (Exception e) {
- // if using an embedded broker then when shutting down Tuscany the broker may get closed
- // before this stop method is called. I can't see how to detect that so for now just
- // ignore the exception if the message is that the transport is already disposed
- if (!"Transport disposed.".equals(e.getMessage())) {
- throw new JMSBindingException("Error stopping JMSServiceBinding", e);
- }
- }
- }
-
- private void registerListerner() throws NamingException, JMSException {
-
- Session session = jmsResourceFactory.createSession();
- destination = lookupDestinationQueue();
- if (destination == null) {
- destination = session.createTemporaryQueue();
- }
-
- if (jmsBinding.getJMSSelector() != null) {
- consumer = session.createConsumer(destination, jmsBinding.getJMSSelector());
- } else {
- consumer = session.createConsumer(destination);
- }
-
- try {
-
- consumer.setMessageListener(listener);
- jmsResourceFactory.startConnection();
-
- } catch (javax.jms.JMSException e) {
-
- // setMessageListener not allowed in JEE container so use Tuscany threads
-
- jmsResourceFactory.startConnection();
- workScheduler.scheduleWork(new Runnable() {
- public void run() {
- try {
- while (running) {
- final Message msg = consumer.receive();
- workScheduler.scheduleWork(new Runnable() {
- public void run() {
- try {
- listener.onMessage(msg);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- });
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- });
- }
- logger.log(Level.INFO, "JMS " + (isCallbackService ? "callback service" : "service")
- + " '"
- + serviceName
- + "' listening on destination "
- + ((destination instanceof Queue) ? ((Queue)destination).getQueueName() : ((Topic)destination).getTopicName()));
- }
-
- /**
- * Looks up the Destination Queue for the JMS Binding.
- * <p>
- * What happens in the look up will depend on the create mode specified for the JMS Binding:
- * <ul>
- * <li>always - the JMS queue is always created. It is an error if the queue already exists
- * <li>ifnotexist - the JMS queue is created if it does not exist. It is not an error if the queue already exists
- * <li>never - the JMS queue is never created. It is an error if the queue does not exist
- * </ul>
- * See the SCA JMS Binding specification for more information.
- * <p>
- *
- * @return The Destination queue.
- * @throws NamingException Failed to lookup JMS queue
- * @throws JMSBindingException Failed to lookup JMS Queue. Probable cause is that the JMS queue's current existence/non-existence is not
- * compatible with the create mode specified on the binding
- */
- private Destination lookupDestinationQueue() throws NamingException, JMSBindingException {
-
- if (isCallbackService && (jmsBinding.getDestinationName() == null)) {
- // if its a callback service returning null indicates to use a temporary queue
- return null;
- }
-
- Destination destination = jmsResourceFactory.lookupDestination(jmsBinding.getDestinationName());
-
- String qCreateMode = jmsBinding.getDestinationCreate();
- if (qCreateMode.equals(JMSBindingConstants.CREATE_ALWAYS)) {
- // In this mode, the queue must not already exist as we are creating it
- if (destination != null) {
- throw new JMSBindingException("JMS Destination " + jmsBinding.getDestinationName()
- + " already exists but has create mode of \""
- + qCreateMode
- + "\" while registering service "
- + serviceName
- + " listener");
- }
-
- // Create the queue
- destination = jmsResourceFactory.createDestination(jmsBinding.getDestinationName());
-
- } else if (qCreateMode.equals(JMSBindingConstants.CREATE_IF_NOT_EXIST)) {
- // In this mode, the queue may nor may not exist. It will be created if it does not exist
- if (destination == null) {
- destination = jmsResourceFactory.createDestination(jmsBinding.getDestinationName());
- }
-
- } else if (qCreateMode.equals(JMSBindingConstants.CREATE_NEVER)) {
- // In this mode, the queue must have already been created.
- if (destination == null) {
- throw new JMSBindingException("JMS Destination " + jmsBinding.getDestinationName()
- + " not found but create mode of \""
- + qCreateMode
- + "\" while registering service "
- + serviceName
- + " listener");
- }
- }
-
- // Make sure we ended up with a queue
- if (destination == null) {
- throw new JMSBindingException("JMS Destination " + jmsBinding.getDestinationName()
- + " not found with create mode of \""
- + qCreateMode
- + "\" while registering service "
- + serviceName
- + " listener");
- }
-
- return destination;
- }
-
- public String getDestinationName() {
- try {
- if (destination instanceof Queue) {
- return ((Queue)destination).getQueueName();
- } else if (destination instanceof Topic) {
- return ((Topic)destination).getTopicName();
- } else {
- return null;
- }
- } catch (JMSException e) {
- throw new JMSBindingException(e);
- }
- }
-
-}
diff --git a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/host/DefaultJMSServiceListenerFactory.java b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/host/DefaultJMSServiceListenerFactory.java
deleted file mode 100644
index bb4b30d190..0000000000
--- a/java/sca/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/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/host/DefaultServiceInvoker.java b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/host/DefaultServiceInvoker.java
deleted file mode 100644
index 0e1ee1bfd0..0000000000
--- a/java/sca/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: 721811 $ $Date: 2008-11-30 13:46:51 +0000 (Sun, 30 Nov 2008) $
- */
-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/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/host/JMSHostExtensionPoint.java b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/host/JMSHostExtensionPoint.java
deleted file mode 100644
index e4bf31f7ee..0000000000
--- a/java/sca/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/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/host/JMSServiceListener.java b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/host/JMSServiceListener.java
deleted file mode 100644
index b6ccb5be9b..0000000000
--- a/java/sca/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/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/host/JMSServiceListenerDetails.java b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/host/JMSServiceListenerDetails.java
deleted file mode 100644
index c183a720e2..0000000000
--- a/java/sca/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/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/host/JMSServiceListenerFactory.java b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/host/JMSServiceListenerFactory.java
deleted file mode 100644
index 5f3f773985..0000000000
--- a/java/sca/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/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/runtime/OperationSelectorJMSDefaultProviderFactory.java b/java/sca/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/java/sca/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/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/runtime/OperationSelectorJMSDefaultServiceInterceptor.java b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/runtime/OperationSelectorJMSDefaultServiceInterceptor.java
deleted file mode 100644
index effdd5f2a9..0000000000
--- a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/runtime/OperationSelectorJMSDefaultServiceInterceptor.java
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.jms.operationselector.jmsdefault.runtime;
-
-import java.io.ByteArrayInputStream;
-import java.io.StringReader;
-import java.util.List;
-
-import javax.jms.BytesMessage;
-import javax.jms.JMSException;
-import javax.jms.TextMessage;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.impl.builder.StAXOMBuilder;
-import org.apache.tuscany.sca.binding.jms.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.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;
-
-/**
- * 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;
-
-
- 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();
- }
-
- public Message invoke(Message msg) {
- return next.invoke(invokeRequest(msg));
- }
-
- public Message invokeRequest(Message msg) {
- // get the jms context
- JMSBindingContext context = msg.getBindingContext();
- javax.jms.Message jmsMsg = context.getJmsMsg();
-
- String operationName = requestMessageProcessor.getOperationName(jmsMsg);
- Operation operation = getTargetOperation(operationName, jmsMsg);
- msg.setOperation(operation);
-
- return msg;
- }
-
- protected Operation getTargetOperation(String operationName, javax.jms.Message jmsMsg) {
- Operation operation = null;
-
- if (serviceOperations.size() == 1) {
-
- // SCA JMS Binding Specification - Rule 1.5.1 line 203
- operation = serviceOperations.get(0);
-
- } else if (operationName != null) {
-
- // SCA JMS Binding Specification - Rule 1.5.1 line 205
- for (Operation op : serviceOperations) {
- if (op.getName().equals(operationName)) {
- operation = op;
- break;
- }
- }
- } else if (jmsBinding.getRequestWireFormat() instanceof WireFormatJMSDefault
- || jmsBinding.getRequestWireFormat() instanceof WireFormatJMSTextXML) {
-
- OMElement rootElement;
- String operationFromPayload;
-
- try {
- if (jmsMsg instanceof TextMessage) {
- String xmlPayload = ((TextMessage) jmsMsg).getText();
-
- if (xmlPayload != null) {
- XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(new StringReader(xmlPayload));
- StAXOMBuilder builder = new StAXOMBuilder(reader);
- rootElement = builder.getDocumentElement();
- operationFromPayload = rootElement.getLocalName();
- for (Operation op : serviceOperations) {
- if (op.getName().equals(operationFromPayload)) {
- operation = op;
- break;
- }
- }
- }
- } else if (jmsMsg instanceof BytesMessage) {
- long noOfBytes = ((BytesMessage) jmsMsg).getBodyLength();
- byte[] bytes = new byte[(int) noOfBytes];
- ((BytesMessage) jmsMsg).readBytes(bytes);
- ((BytesMessage) jmsMsg).reset();
-
- if (bytes != null) {
- XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(new ByteArrayInputStream(bytes));
- StAXOMBuilder builder = new StAXOMBuilder(reader);
- rootElement = builder.getDocumentElement();
- operationFromPayload = rootElement.getLocalName();
- for (Operation op : serviceOperations) {
- if (op.getName().equals(operationFromPayload)) {
- operation = op;
- break;
- }
- }
- }
- }
-
- } catch (XMLStreamException e) {
- //let's ignore this in case the client doesn't want to use a wrapped xml message
- } catch (JMSException e) {
- throw new JMSBindingException(e);
- }
-
- // If operation is still null we attempt the last rule
- if (operation == null) {
-
- // SCA JMS Binding Specification - Rule 1.5.1 line 207
- for (Operation op : serviceOperations) {
- if (op.getName().equals(ON_MESSAGE_METHOD_NAME)) {
- operation = op;
- break;
- }
- }
- }
- }
-
- if (operation == null) {
- throw new JMSBindingException("Can't find operation " + (operationName != null ? operationName : ON_MESSAGE_METHOD_NAME));
- }
-
- return operation;
- }
-
- public Invoker getNext() {
- return next;
- }
-
- public void setNext(Invoker next) {
- this.next = next;
- }
-
-}
diff --git a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/runtime/OperationSelectorJMSDefaultServiceProvider.java b/java/sca/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/java/sca/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/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsuserprop/runtime/OperationSelectorJMSUserPropProviderFactory.java b/java/sca/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/java/sca/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/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsuserprop/runtime/OperationSelectorJMSUserPropServiceInterceptor.java b/java/sca/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/java/sca/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/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsuserprop/runtime/OperationSelectorJMSUserPropServiceProvider.java b/java/sca/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/java/sca/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/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/provider/JMSTokenAuthenticationPolicyProviderFactory.java b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/provider/JMSTokenAuthenticationPolicyProviderFactory.java
deleted file mode 100644
index d4773c52e4..0000000000
--- a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/provider/JMSTokenAuthenticationPolicyProviderFactory.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.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;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-
-/**
- * @version $Rev$ $Date$
- */
-public class JMSTokenAuthenticationPolicyProviderFactory implements PolicyProviderFactory<JMSTokenAuthenticationPolicy> {
- private ExtensionPointRegistry registry;
-
- public JMSTokenAuthenticationPolicyProviderFactory(ExtensionPointRegistry registry) {
- super();
- this.registry = registry;
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createImplementationPolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.assembly.Implementation)
- */
- public PolicyProvider createImplementationPolicyProvider(RuntimeComponent component, Implementation implementation) {
- return null;//new TokenAuthenticationImplementationPolicyProvider(component, implementation);
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createReferencePolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.runtime.RuntimeComponentReference, org.apache.tuscany.sca.assembly.Binding)
- */
- public PolicyProvider createReferencePolicyProvider(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/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/provider/JMSTokenAuthenticationReferencePolicyInterceptor.java b/java/sca/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/java/sca/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/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/provider/JMSTokenAuthenticationReferencePolicyProvider.java b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/provider/JMSTokenAuthenticationReferencePolicyProvider.java
deleted file mode 100644
index e630d0cd53..0000000000
--- a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/provider/JMSTokenAuthenticationReferencePolicyProvider.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.jms.policy.authentication.token.provider;
-
-import java.util.List;
-
-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.PolicyProvider;
-
-/**
- * @version $Rev$ $Date$
- */
-public class JMSTokenAuthenticationReferencePolicyProvider implements PolicyProvider {
- private EndpointReference endpointReference;
-
- public JMSTokenAuthenticationReferencePolicyProvider(EndpointReference endpointReference) {
- this.endpointReference = endpointReference;
- }
-
- private PolicySet findPolicySet() {
- List<PolicySet> policySets = endpointReference.getPolicySets();
- for (PolicySet ps : policySets) {
- for (Object p : ps.getPolicies()) {
- if (JMSTokenAuthenticationPolicy.class.isInstance(p)) {
- return ps;
- }
- }
- }
- return null;
- }
-
- private String getContext() {
- return "component.reference: " + endpointReference.getComponent().getURI()
- + "#"
- + endpointReference.getReference().getName()
- + "("
- + endpointReference.getBinding().getClass().getName()
- + ")";
- }
-
- /**
- * @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;
- }
-
- public void start() {
- }
-
- public void stop() {
- }
-
-}
diff --git a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/provider/JMSTokenAuthenticationServicePolicyInterceptor.java b/java/sca/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/java/sca/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/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/provider/JMSTokenAuthenticationServicePolicyProvider.java b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/provider/JMSTokenAuthenticationServicePolicyProvider.java
deleted file mode 100644
index be5ca5dd61..0000000000
--- a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/provider/JMSTokenAuthenticationServicePolicyProvider.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.jms.policy.authentication.token.provider;
-
-import java.util.List;
-
-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.PolicyProvider;
-
-/**
- * @version $Rev$ $Date$
- */
-public class JMSTokenAuthenticationServicePolicyProvider implements PolicyProvider {
-
- private Endpoint endpoint;
-
- public JMSTokenAuthenticationServicePolicyProvider(Endpoint endpoint) {
- this.endpoint = endpoint;
- }
-
- private PolicySet findPolicySet() {
- List<PolicySet> policySets = endpoint.getPolicySets();
- for (PolicySet ps : policySets) {
- for (Object p : ps.getPolicies()) {
- if (JMSTokenAuthenticationPolicy.class.isInstance(p)) {
- return ps;
- }
- }
- }
- return null;
- }
-
- private String getContext() {
- return "component.service: " + endpoint.getComponent().getURI()
- + "#"
- + endpoint.getService().getName()
- + "("
- + endpoint.getBinding().getClass().getName()
- + ")";
- }
-
- /**
- * @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;
- }
-
- public void start() {
- }
-
- public void stop() {
- }
-
-}
diff --git a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/policy/header/JMSHeaderPolicyProviderFactory.java b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/policy/header/JMSHeaderPolicyProviderFactory.java
deleted file mode 100644
index 8e3055de29..0000000000
--- a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/policy/header/JMSHeaderPolicyProviderFactory.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.jms.policy.header;
-
-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.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/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/policy/header/JMSHeaderReferencePolicyInterceptor.java b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/policy/header/JMSHeaderReferencePolicyInterceptor.java
deleted file mode 100644
index 89fc7b5f50..0000000000
--- a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/policy/header/JMSHeaderReferencePolicyInterceptor.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.jms.policy.header;
-
-
-import org.apache.tuscany.sca.assembly.EndpointReference;
-import org.apache.tuscany.sca.binding.jms.context.JMSBindingContext;
-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/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/policy/header/JMSHeaderReferencePolicyProvider.java b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/policy/header/JMSHeaderReferencePolicyProvider.java
deleted file mode 100644
index 35154e0232..0000000000
--- a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/policy/header/JMSHeaderReferencePolicyProvider.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.jms.policy.header;
-
-import java.util.List;
-
-import org.apache.tuscany.sca.assembly.EndpointReference;
-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.PolicyProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-
-/**
- * @version $Rev$ $Date$
- */
-public class JMSHeaderReferencePolicyProvider implements PolicyProvider {
-
- private EndpointReference endpointReference;
-
- public JMSHeaderReferencePolicyProvider(EndpointReference endpointReference) {
- this.endpointReference = endpointReference;
- }
-
- private PolicySet findPolicySet() {
- List<PolicySet> policySets = endpointReference.getPolicySets();
- for (PolicySet ps : policySets) {
- for (Object p : ps.getPolicies()) {
- if (JMSHeaderPolicy.class.isInstance(p)) {
- return ps;
- }
- }
- }
- return null;
- }
-
- private String getContext() {
- return "component.reference: " + endpointReference.getComponent().getURI()
- + "#"
- + endpointReference.getReference().getName()
- + "("
- + endpointReference.getBinding().getClass().getName()
- + ")";
- }
-
- /**
- * @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;
- }
-
- public void start() {
- }
-
- public void stop() {
- }
-
-}
diff --git a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/AbstractMessageProcessor.java b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/AbstractMessageProcessor.java
deleted file mode 100644
index 8b665c91a8..0000000000
--- a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/AbstractMessageProcessor.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.jms.provider;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.logging.Logger;
-
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.ObjectMessage;
-import javax.jms.Session;
-
-import org.apache.tuscany.sca.binding.jms.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();
- String causeMsg;
- if (o instanceof RuntimeException) {
- message.setObject(new RuntimeException(o.getMessage()));
- } else {
- // for a checked exception return the checked exception
- message.setObject(o);
- }
- message.setBooleanProperty(JMSBindingConstants.FAULT_PROPERTY, true);
- return message;
-
- } catch (JMSException e) {
- throw new JMSBindingException(e);
- }
- }
-
- protected abstract Object extractPayload(Message msg);
-
- protected abstract Message createJMSMessage(Session session, Object o);
-
-}
diff --git a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/BytesMessageProcessor.java b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/BytesMessageProcessor.java
deleted file mode 100644
index 7b14d29dfa..0000000000
--- a/java/sca/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/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/DefaultJMSResourceFactoryExtensionPoint.java b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/DefaultJMSResourceFactoryExtensionPoint.java
deleted file mode 100644
index 17542ace9d..0000000000
--- a/java/sca/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/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/DefaultMessageProcessor.java b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/DefaultMessageProcessor.java
deleted file mode 100644
index 4132657945..0000000000
--- a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/DefaultMessageProcessor.java
+++ /dev/null
@@ -1,288 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.jms.provider;
-
-import java.io.ByteArrayInputStream;
-import java.io.StringReader;
-import java.util.logging.Logger;
-
-import javax.jms.BytesMessage;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMNode;
-import org.apache.axiom.om.impl.builder.StAXOMBuilder;
-import org.apache.tuscany.sca.binding.jms.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.JMSBindingConstants;
-import org.apache.tuscany.sca.binding.jms.JMSBindingException;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.interfacedef.util.FaultException;
-
-/**
- * MessageProcessor for sending/receiving XML over javax.jms.TextMessage or javax.jms.BytesMessage
- * with the JMSBinding.
- * This is very specific to the default wire format and is not tied into the usual hierarchy
- * of message processors
- *
- * @version $Rev$ $Date$
- */
-public class DefaultMessageProcessor extends AbstractMessageProcessor {
- private static final Logger logger = Logger.getLogger(DefaultMessageProcessor.class.getName());
-
- public DefaultMessageProcessor(JMSBinding jmsBinding, ExtensionPointRegistry registry) {
- super(jmsBinding);
- }
-
- // inherited methods that don't do anything useful
- @Override
- protected Message createJMSMessage(Session session, Object o) {
- // should not be used
- return null;
- }
-
- @Override
- protected Object extractPayload(Message msg) {
- // if it's not a text/bytes message or a fault then we don;t know what to do with it
- return null;
- }
-
- // TODO - This makes the assumption that whatever the text/bytes configuration of the
- // jms binding, unchecked faults will be sent as bytes.
- @Override
- public Message createFaultMessage(Session session, Throwable o) {
- return createFaultJMSBytesMessage(session, o);
- }
-
- // handle text messages
-
- public Object extractPayloadFromJMSTextMessage(Message msg, OMElement wrapper) {
- if (msg instanceof TextMessage) {
- try {
- String xml = ((TextMessage) msg).getText();
- Object os;
- if (xml != null) {
- XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(new StringReader(xml));
- StAXOMBuilder builder = new StAXOMBuilder(reader);
- os = builder.getDocumentElement();
- } else {
- os = null;
- }
-
- if (wrapper != null){
- //don't modify the original wrapper since it will be reused
- //clone the wrapper
- OMElement newWrapper = wrapper.cloneOMElement();
- if (os != null){
- newWrapper.addChild((OMNode)os);
- }
- return newWrapper;
- }
-
- return os;
-
- } catch (XMLStreamException e) {
- throw new JMSBindingException(e);
- } catch (JMSException e) {
- throw new JMSBindingException(e);
- }
- } else {
- // handle the non-text fault case
- return super.extractPayloadFromJMSMessage(msg);
- }
- }
-
- public Message insertPayloadIntoJMSTextMessage(Session session, Object o, boolean unwrap) {
-
- try {
-
- TextMessage message = session.createTextMessage();
-
- if (o instanceof OMElement) {
-
- if (unwrap){
- OMElement firstElement = ((OMElement)o).getFirstElement();
- if (firstElement == null ) {
- message.setText(null);
- } else {
- message.setText(firstElement.toString());
- }
- }else {
- message.setText(o.toString());
- }
- } else if ((o instanceof Object[]) && ((Object[]) o)[0] instanceof OMElement) {
- if (unwrap){
- OMElement firstElement = ((OMElement)((Object[]) o)[0]).getFirstElement();
- if (firstElement == null ) {
- message.setText(null);
- } else {
- message.setText(firstElement.toString());
- }
- }else {
- message.setText(((Object[]) o)[0].toString());
- }
- } else if (o != null) {
- throw new IllegalStateException("expecting OMElement payload: " + o);
- }
-
- return message;
-
- } catch (JMSException e) {
- throw new JMSBindingException(e);
- }
- }
-
- public Message createFaultJMSTextMessage(Session session, Throwable o) {
-
- if (session == null) {
- logger.fine("no response session to create fault message: " + String.valueOf(o));
- return null;
- }
- if (o instanceof FaultException) {
- try {
-
- TextMessage message = session.createTextMessage();
- message.setText(String.valueOf(((FaultException) o).getFaultInfo()));
- message.setBooleanProperty(JMSBindingConstants.FAULT_PROPERTY, true);
- return message;
-
- } catch (JMSException e) {
- throw new JMSBindingException(e);
- }
- } else {
- // handle the non XML fault case
- return super.createFaultMessage(session, o);
- }
- }
-
- // handle bytes messages
-
- public Object extractPayloadFromJMSBytesMessage(Message msg, OMElement wrapper) {
-
- if (msg instanceof BytesMessage) {
- try {
- Object os;
-
- long noOfBytes = ((BytesMessage) msg).getBodyLength();
- byte[] bytes = new byte[(int) noOfBytes];
- ((BytesMessage) msg).readBytes(bytes);
- ((BytesMessage)msg).reset();
-
- if ((bytes != null) && (bytes.length > 0)) {
- XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(new ByteArrayInputStream(bytes));
- StAXOMBuilder builder = new StAXOMBuilder(reader);
- os = builder.getDocumentElement();
- } else {
- os = null;
- }
-
- if (wrapper != null){
- //don't modify the original wrapper since it will be reused
- //clone the wrapper
- OMElement newWrapper = wrapper.cloneOMElement();
- if (os != null){
- newWrapper.addChild((OMNode)os);
- }
- return newWrapper;
- }
-
- return os;
-
- } catch (XMLStreamException e) {
- throw new JMSBindingException(e);
- } catch (JMSException e) {
- throw new JMSBindingException(e);
- }
- } else {
- // trap the non-bytes fault case
- return super.extractPayloadFromJMSMessage(msg);
- }
- }
-
- public Message insertPayloadIntoJMSBytesMessage(Session session, Object o, boolean unwrap) {
-
- try {
-
- BytesMessage message = session.createBytesMessage();
-
-
- if (o instanceof OMElement) {
- if (unwrap) {
- OMElement firstElement = ((OMElement)o).getFirstElement();
- if (firstElement == null ) {
- //do nothing, the message will just be set with a byte[0]
- } else {
- message.writeBytes(firstElement.toString().getBytes());
- }
-
- } else {
- message.writeBytes(o.toString().getBytes());
- }
-
- } else if ((o instanceof Object[]) && ((Object[]) o)[0] instanceof OMElement) {
- if (unwrap){
- OMElement firstElement = ((OMElement)((Object[]) o)[0]).getFirstElement();
- if (firstElement == null ) {
- //do nothing, the message will just be set with a byte[0]
- } else {
- message.writeBytes(firstElement.toString().getBytes());
- }
-
- }else {
- message.writeBytes(((Object[]) o)[0].toString().getBytes());
- }
- } else if (o != null) {
- throw new IllegalStateException("expecting OMElement payload: " + o);
- }
-
- return message;
-
- } catch (JMSException e) {
- throw new JMSBindingException(e);
- }
- }
-
- public Message createFaultJMSBytesMessage(Session session, Throwable o) {
-
- if (session == null) {
- logger.fine("no response session to create fault message: " + String.valueOf(o));
- return null;
- }
-
- if (o instanceof FaultException) {
- try {
-
- BytesMessage message = session.createBytesMessage();
- message.writeBytes(String.valueOf(((FaultException) o).getFaultInfo()).getBytes());
- message.setBooleanProperty(JMSBindingConstants.FAULT_PROPERTY, true);
- return message;
-
- } catch (JMSException e) {
- throw new JMSBindingException(e);
- }
- } else {
- return super.createFaultMessage(session, o);
- }
- }
-}
diff --git a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingProviderFactory.java b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingProviderFactory.java
deleted file mode 100644
index 15bd8713f2..0000000000
--- a/java/sca/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/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingReferenceBindingProvider.java b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingReferenceBindingProvider.java
deleted file mode 100644
index 8053ba69e4..0000000000
--- a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingReferenceBindingProvider.java
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.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());
-// }
- }
-
- 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/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingServiceBindingProvider.java b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingServiceBindingProvider.java
deleted file mode 100644
index 225d514045..0000000000
--- a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingServiceBindingProvider.java
+++ /dev/null
@@ -1,236 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.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.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;
-
- // 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) {
- throw new JMSBindingException("Error starting JMSServiceBinding", e);
- }
- }
-
- public void stop() {
- try {
- serviceListener.stop();
- } catch (Exception e) {
- throw new JMSBindingException("Error stopping JMSServiceBinding", e);
- }
- }
-
- public String getDestinationName() {
- return serviceListener.getDestinationName();
- }
-
- /*
- * Adds JMS specific interceptors to the binding chain
- */
- public void 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));
-
- // 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/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSMessageProcessor.java b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSMessageProcessor.java
deleted file mode 100644
index 821b9d7873..0000000000
--- a/java/sca/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/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSMessageProcessorUtil.java b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSMessageProcessorUtil.java
deleted file mode 100644
index 2628bf50a1..0000000000
--- a/java/sca/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/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSResourceFactory.java b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSResourceFactory.java
deleted file mode 100644
index 348764fe43..0000000000
--- a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSResourceFactory.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.jms.provider;
-
-import javax.jms.Connection;
-import javax.jms.Destination;
-import javax.jms.JMSException;
-import javax.jms.Session;
-import javax.naming.NamingException;
-
-public interface JMSResourceFactory {
-
- /*
- * This is a simple implementation where a connection is created per binding Ideally the resource factory should be
- * able to leverage the host environment to provide connection pooling if it can. E.g. if Tuscany is running inside
- * an AppServer Then we could leverage the JMS resources it provides
- *
- * @see org.apache.tuscany.binding.jms.JMSResourceFactory#getConnection()
- */
- public abstract Connection getConnection() throws NamingException, JMSException;
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.tuscany.binding.jms.JMSResourceFactory#createSession()
- */
- public abstract Session createSession() throws JMSException, NamingException;
-
- public abstract void closeSession(Session session) throws JMSException;
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.tuscany.binding.jms.JMSResourceFactory#startConnection()
- */
- public abstract void startConnection() throws JMSException, NamingException;
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.tuscany.binding.jms.JMSResourceFactory#closeConnection()
- */
- public abstract void closeConnection() throws JMSException;
-
- public abstract Destination lookupDestination(String destName) throws NamingException;
-
- /**
- * You can create a destination in ActiveMQ (and have it appear in JNDI) by putting "dynamicQueues/" in front of the queue name being looked up
- */
- public abstract Destination createDestination(String jndiName) throws NamingException;
-
- /*
- * This is a simple implementation where a connection is created per binding Ideally the resource factory should be
- * able to leverage the host environment to provide connection pooling if it can. E.g. if Tuscany is running inside
- * an AppServer Then we could leverage the JMS resources it provides
- *
- * @see org.apache.tuscany.binding.jms.JMSResourceFactory#getConnection()
- */
- public abstract Connection getResponseConnection() throws NamingException, JMSException;
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.tuscany.binding.jms.JMSResourceFactory#createSession()
- */
- public abstract Session createResponseSession() throws JMSException, NamingException;
-
- public abstract void closeResponseSession(Session session) throws JMSException;
-
- public abstract void closeResponseConnection() throws JMSException;
-
- /*
- * Indicates whether connections obtained using getConnection() or getResponseConnection()
- * must be closed after each use. This is necessary in environments where connections are
- * shared with other users, or where connections cannot be held across transaction boundaries.
- */
- public abstract boolean isConnectionClosedAfterUse();
-}
diff --git a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSResourceFactoryExtensionPoint.java b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSResourceFactoryExtensionPoint.java
deleted file mode 100644
index 4fc20c0cb3..0000000000
--- a/java/sca/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/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSResourceFactoryImpl.java b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSResourceFactoryImpl.java
deleted file mode 100644
index 61080516b3..0000000000
--- a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSResourceFactoryImpl.java
+++ /dev/null
@@ -1,282 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.jms.provider;
-
-import java.util.Properties;
-
-import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
-import javax.jms.Destination;
-import javax.jms.JMSException;
-import javax.jms.Session;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-
-import org.apache.tuscany.sca.binding.jms.JMSBindingException;
-
-/**
- * Abstracts away any JMS provide specific feature from the JMS binding
- *
- * @version $Rev$ $Date$
- */
-public class JMSResourceFactoryImpl implements JMSResourceFactory {
-
- protected String initialContextFactoryName;
- protected String connectionFactoryName = "ConnectionFactory";
- protected String jndiURL;
-
- protected Connection connection;
- protected Context context;
- protected boolean isConnectionStarted;
- private Connection responseConnection;
- private String responseConnectionFactoryName;
-
- public JMSResourceFactoryImpl(String connectionFactoryName, String responseConnectionFactoryName, String initialContextFactoryName, String jndiURL) {
- if (connectionFactoryName != null && connectionFactoryName.trim().length() > 0) {
- this.connectionFactoryName = connectionFactoryName.trim();
- }
- if (responseConnectionFactoryName != null && responseConnectionFactoryName.trim().length() > 0) {
- this.responseConnectionFactoryName = responseConnectionFactoryName.trim();
- }
- if (initialContextFactoryName != null && initialContextFactoryName.trim().length() > 0) {
- this.initialContextFactoryName = initialContextFactoryName.trim();
- }
- if (jndiURL != null) {
- this.jndiURL = jndiURL.trim();
- }
- }
-
- /*
- * This is a simple implementation where a connection is created per binding Ideally the resource factory should be
- * able to leverage the host environment to provide connection pooling if it can. E.g. if Tuscany is running inside
- * an AppServer Then we could leverage the JMS resources it provides
- *
- * @see org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory#getConnection()
- */
- public Connection getConnection() throws NamingException, JMSException {
- if (connection == null) {
- createConnection();
- }
- return connection;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory#createSession()
- */
- public Session createSession() throws JMSException, NamingException {
- return getConnection().createSession(false, Session.AUTO_ACKNOWLEDGE);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory#closeSession(javax.jms.Session)
- */
- public void closeSession(Session session) throws JMSException {
- session.close();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory#startConnection()
- */
- public void startConnection() throws JMSException, NamingException {
- if (!isConnectionStarted) {
- getConnection().start();
- isConnectionStarted = true;
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory#closeConnection()
- */
- public void closeConnection() throws JMSException {
- if (connection != null) {
- try {
- connection.close();
- } catch (JMSException e) {
- // if using an embedded broker then when shutting down Tuscany the broker may get closed
- // before this stop method is called. I can't see how to detect that so for now just
- // ignore the exception if the message is that the transport is already disposed
- if (!e.getMessage().contains("disposed")) {
- throw e;
- }
- }
- }
- }
-
- protected void createConnection() throws NamingException, JMSException {
- ConnectionFactory connectionFactory = (ConnectionFactory)jndiLookUp(connectionFactoryName);
- if (connectionFactory == null) {
- throw new JMSBindingException("connection factory not found: " + connectionFactoryName);
- }
- connection = connectionFactory.createConnection();
- }
-
- protected synchronized Context getInitialContext() throws NamingException {
- if (context == null) {
- Properties props = new Properties();
-
- if (initialContextFactoryName != null) {
- props.setProperty(Context.INITIAL_CONTEXT_FACTORY, initialContextFactoryName);
- }
- if (jndiURL != null) {
- props.setProperty(Context.PROVIDER_URL, jndiURL);
- }
-
- initJREEnvironment(props);
-
- context = new InitialContext(props);
- }
- return context;
- }
-
- /**
- * If using the WAS JMS Client with a non-IBM JRE then an additional
- * environment property needs to be set to initialize the ORB correctly.
- * See: http://www-1.ibm.com/support/docview.wss?uid=swg24012804
- */
- protected void initJREEnvironment(Properties props) {
- if ("com.ibm.websphere.naming.WsnInitialContextFactory".equals(props.get(Context.INITIAL_CONTEXT_FACTORY))) {
- String vendor = System.getProperty("java.vendor");
- if (vendor == null || !vendor.contains("IBM")) {
- props.setProperty("com.ibm.CORBA.ORBInit", "com.ibm.ws.sib.client.ORB");
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory#lookupDestination(java.lang.String)
- */
- public Destination lookupDestination(String destName) throws NamingException {
- if (destName == null) {
- return null;
- }
-
- Destination dest = (Destination)jndiLookUp(destName);
- if (dest == null) {
- dest = lookupPhysical(destName);
- }
- return dest;
- }
-
- protected Destination lookupPhysical(String jndiName) {
-
- // TODO: the SCA JMS spec says a destination name may be a non-jndi plain destination name
-
-// Session session = null;
-// try {
-//
-// Destination dest;
-// session = createSession();
-// dest = session.createQueue(jndiName);
-// return dest;
-//
-// } catch (JMSException e) {
-// throw new JMSBindingException(e);
-// } catch (NamingException e) {
-// throw new JMSBindingException(e);
-// } finally {
-// if (session != null) {
-// try {
-// session.close();
-// } catch (JMSException e) {
-// throw new JMSBindingException(e);
-// }
-// }
-// }
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory#createDestination(java.lang.String)
- */
- public Destination createDestination(String jndiName) throws NamingException {
- return lookupDestination("dynamicQueues/" + jndiName);
- }
-
- protected Object jndiLookUp(String name) {
- Object o = null;
- try {
- o = getInitialContext().lookup("java:comp/env/" + name);
- } catch (Exception ex) {
- // ignore
- }
- if (o == null) {
- try {
- o = getInitialContext().lookup(name);
- } catch (NamingException ex) {
- // ignore
- }
- }
- return o;
- }
-
- public Session createResponseSession() throws JMSException, NamingException {
- return getResponseConnection().createSession(false, Session.AUTO_ACKNOWLEDGE);
- }
-
- public void closeResponseSession(Session session) throws JMSException {
- session.close();
- }
-
- public Connection getResponseConnection() throws NamingException, JMSException {
- if (responseConnection == null) {
- if (responseConnectionFactoryName != null) {
- ConnectionFactory connectionFactory = (ConnectionFactory)jndiLookUp(responseConnectionFactoryName);
- if (connectionFactory == null) {
- throw new JMSBindingException("connection factory not found: " + responseConnectionFactoryName);
- }
- responseConnection = connectionFactory.createConnection();
- } else {
- // if no response connection is defined in the SCDL use the request connection
- responseConnection = getConnection();
- }
- }
- return responseConnection;
- }
-
- public void closeResponseConnection() throws JMSException {
- if (responseConnection != null && !responseConnection.equals(connection)) {
- try {
- responseConnection.close();
- } catch (JMSException e) {
- // if using an embedded broker then when shutting down Tuscany the broker may get closed
- // before this stop method is called. I can't see how to detect that so for now just
- // ignore the exception if the message is that the transport is already disposed
- if (!e.getMessage().contains("disposed")) {
- throw e;
- }
- }
- }
- }
-
- public boolean isConnectionClosedAfterUse() {
- // It is assumed this resource factory is used in an environment
- // where the connection can be held for the life of the binding.
- return false;
- }
-
-}
diff --git a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/ObjectMessageProcessor.java b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/ObjectMessageProcessor.java
deleted file mode 100644
index db0b94dce1..0000000000
--- a/java/sca/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/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/RRBJMSBindingInvoker.java b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/RRBJMSBindingInvoker.java
deleted file mode 100644
index 8615c128c1..0000000000
--- a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/RRBJMSBindingInvoker.java
+++ /dev/null
@@ -1,267 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.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.DataExchangeSemantics;
-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, DataExchangeSemantics {
-
- 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();
- }
-
- Destination dest = jmsResourceFactory.lookupDestination(queueName);
-
- if (qCreateMode.equals(JMSBindingConstants.CREATE_ALWAYS)) {
- // In this mode, the queue must not already exist as we are creating it
- if (dest != null) {
- throw new JMSBindingException(queueType + queueName
- + " already exists but has create mode of \""
- + qCreateMode
- + "\" while registering binding "
- + jmsBinding.getName()
- + " invoker");
- }
- // Create the queue
- dest = jmsResourceFactory.createDestination(queueName);
-
- } else if (qCreateMode.equals(JMSBindingConstants.CREATE_IF_NOT_EXIST)) {
- // In this mode, the queue may nor may not exist. It will be created if it does not exist
- if (dest == null) {
- dest = jmsResourceFactory.createDestination(queueName);
- }
-
- } else if (qCreateMode.equals(JMSBindingConstants.CREATE_NEVER)) {
- // In this mode, the queue must have already been created.
- if (dest == null) {
- throw new JMSBindingException(queueType + queueName
- + " not found but create mode of \""
- + qCreateMode
- + "\" while registering binding "
- + jmsBinding.getName()
- + " invoker");
- }
- }
-
- // Make sure we ended up with a queue
- if (dest == null) {
- throw new JMSBindingException(queueType + queueName
- + " not found with create mode of \""
- + qCreateMode
- + "\" while registering binding "
- + jmsBinding.getName()
- + " invoker");
- }
-
- return dest;
- }
-
- public org.apache.tuscany.sca.invocation.Message invoke(org.apache.tuscany.sca.invocation.Message tuscanyMsg) {
- try {
- // populate the message context with JMS binding information
- JMSBindingContext context = new JMSBindingContext();
- context.setJmsResourceFactory(jmsResourceFactory);
- tuscanyMsg.setBindingContext(context);
-
- // get a jms session to cover the creation and sending of the message
- Session session = context.getJmsSession();
-
- context.setRequestDestination(getRequestDestination(tuscanyMsg, session));
- context.setReplyToDestination(getReplyToDestination(session));
-
- try {
- tuscanyMsg = 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;
- if (operation.isNonBlocking()) {
- replyToDest = null;
- } else {
- if (bindingReplyDest != null) {
- replyToDest = bindingReplyDest;
- } else {
- replyToDest = session.createTemporaryQueue();
- }
- }
- return replyToDest;
- }
-
- public boolean allowsPassByReference() {
- // JMS always pass by value
- return true;
- }
-
-}
diff --git a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/TextMessageProcessor.java b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/TextMessageProcessor.java
deleted file mode 100644
index b468c73e7a..0000000000
--- a/java/sca/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/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/XMLBytesMessageProcessor.java b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/XMLBytesMessageProcessor.java
deleted file mode 100644
index 915bb2e50c..0000000000
--- a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/XMLBytesMessageProcessor.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.jms.provider;
-
-import java.io.ByteArrayInputStream;
-import java.util.logging.Logger;
-
-import javax.jms.BytesMessage;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.Session;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.impl.builder.StAXOMBuilder;
-import org.apache.tuscany.sca.binding.jms.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.JMSBindingConstants;
-import org.apache.tuscany.sca.binding.jms.JMSBindingException;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.interfacedef.util.FaultException;
-
-/**
- * MessageProcessor for sending/receiving XML javax.jms.BytesMessage with the JMSBinding.
- */
-public class XMLBytesMessageProcessor extends AbstractMessageProcessor {
- private static final Logger logger = Logger.getLogger(XMLBytesMessageProcessor.class.getName());
-
- public XMLBytesMessageProcessor(JMSBinding jmsBinding, ExtensionPointRegistry registry) {
- super(jmsBinding);
- }
-
- @Override
- protected Object extractPayload(Message msg) {
- try {
-
- if (!(msg instanceof BytesMessage)) {
- throw new IllegalStateException("expecting JMS BytesMessage: " + msg);
- }
-
- long noOfBytes = ((BytesMessage)msg).getBodyLength();
- byte [] bytes = new byte[(int)noOfBytes];
- ((BytesMessage)msg).readBytes(bytes);
- ((BytesMessage)msg).reset();
-
- Object os;
- if (noOfBytes > 0) {
- XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(new ByteArrayInputStream(bytes));
- StAXOMBuilder builder = new StAXOMBuilder(reader);
- os = builder.getDocumentElement();
- } else {
- os = null;
- }
- return os;
- } catch (XMLStreamException e) {
- throw new JMSBindingException(e);
- } catch (JMSException e) {
- throw new JMSBindingException(e);
- }
- }
-
- @Override
- public Object extractPayloadFromJMSMessage(Message msg) {
- if (msg instanceof BytesMessage) {
- return extractPayload(msg);
- } else {
- return super.extractPayloadFromJMSMessage(msg);
- }
- }
-
- @Override
- protected Message createJMSMessage(Session session, Object o) {
- if (session == null) {
- logger.fine("no response session to create message: " + String.valueOf(o));
- return null;
- }
- try {
- BytesMessage message = session.createBytesMessage();
-
- if (o instanceof OMElement) {
- message.writeBytes(o.toString().getBytes());
- } else if ((o instanceof Object[]) && ((Object[])o)[0] instanceof OMElement) {
- message.writeBytes(((Object[])o)[0].toString().getBytes());
- } else if (o != null) {
- throw new IllegalStateException("expecting OMElement payload: " + o);
- }
-
- return message;
-
- } catch (JMSException e) {
- throw new JMSBindingException(e);
- }
- }
-
- @Override
- public Message createFaultMessage(Session session, Throwable o) {
-
- if (session == null) {
- logger.fine("no response session to create fault message: " + String.valueOf(o));
- return null;
- }
- if (o instanceof FaultException) {
- try {
-
- BytesMessage message = session.createBytesMessage();
- message.writeBytes(String.valueOf(((FaultException) o).getFaultInfo()).getBytes());
- message.setBooleanProperty(JMSBindingConstants.FAULT_PROPERTY, true);
- return message;
-
- } catch (JMSException e) {
- throw new JMSBindingException(e);
- }
- } else {
- return super.createFaultMessage(session, o);
- }
- }
-
-}
diff --git a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/XMLTextMessageProcessor.java b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/XMLTextMessageProcessor.java
deleted file mode 100644
index 9b652d05b8..0000000000
--- a/java/sca/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 OMElement payload: " + o);
- }
-
- return message;
-
- } catch (JMSException e) {
- throw new JMSBindingException(e);
- }
- }
-
- @Override
- public Message createFaultMessage(Session session, Throwable o) {
- if (session == null) {
- logger.fine("no response session to create fault message: " + String.valueOf(o));
- return null;
- }
- if (o instanceof FaultException) {
- try {
-
- TextMessage message = session.createTextMessage();
- message.setText(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/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/transport/TransportReferenceInterceptor.java b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/transport/TransportReferenceInterceptor.java
deleted file mode 100644
index 9668333ebd..0000000000
--- a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/transport/TransportReferenceInterceptor.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.jms.transport;
-
-import javax.jms.JMSException;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageProducer;
-import javax.jms.Session;
-import javax.naming.NamingException;
-
-import org.apache.tuscany.sca.binding.jms.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.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 RuntimeEndpointReference runtimeWire;
- private JMSResourceFactory jmsResourceFactory;
- private JMSBinding jmsBinding;
-
- public TransportReferenceInterceptor(JMSBinding jmsBinding, JMSResourceFactory jmsResourceFactory, RuntimeEndpointReference runtimeWire) {
- super();
- this.jmsBinding = jmsBinding;
- this.runtimeWire = runtimeWire;
- this.jmsResourceFactory = jmsResourceFactory;
- }
-
- public Message invoke(Message msg) {
- Message responseMsg = invokeRequest(msg);
-
- // get the jms context
- JMSBindingContext context = msg.getBindingContext();
-
- if (context.getReplyToDestination() == null) {
- responseMsg.setBody(null);
- } else {
- responseMsg = invokeResponse(msg);
- }
-
- return responseMsg;
- }
-
- public Message invokeRequest(Message msg) {
- try {
- // get the jms context
- JMSBindingContext context = msg.getBindingContext();
- Session session = context.getJmsSession();
-
- MessageProducer producer = session.createProducer(context.getRequestDestination());
-
- // Set JMS header attributes in producer, not message.
- String opName = msg.getOperation().getName();
- if (jmsBinding.getOperationJMSTimeToLive(msg.getOperation().getName()) != null) {
- producer.setTimeToLive(jmsBinding.getOperationJMSTimeToLive(msg.getOperation().getName()));
- }
- Integer priority = jmsBinding.getOperationJMSPriority( opName );
- if (priority != null) {
- producer.setPriority(priority.intValue());
- }
- Boolean deliveryModePersistent = jmsBinding.getOperationJMSDeliveryMode(opName);
- if (deliveryModePersistent != null) {
- if (deliveryModePersistent.booleanValue())
- producer.setDeliveryMode(javax.jms.DeliveryMode.PERSISTENT);
- else
- producer.setDeliveryMode(javax.jms.DeliveryMode.NON_PERSISTENT);
- }
-
- try {
- producer.send((javax.jms.Message)msg.getBody());
- } finally {
- producer.close();
- }
- return msg;
- } catch (JMSException e) {
- throw new JMSBindingException(e);
- }
- }
-
- public Message invokeResponse(Message msg) {
- JMSBindingContext context = msg.getBindingContext();
- try {
- Session session = context.getJmsResponseSession();
-
- javax.jms.Message requestMessage = (javax.jms.Message)msg.getBody();
-
- String msgSelector = "JMSCorrelationID = '" +
- requestMessage.getJMSMessageID() +
- "'";
- MessageConsumer consumer = session.createConsumer(context.getReplyToDestination(), msgSelector);
-
- javax.jms.Message replyMsg;
- try {
- context.getJmsResourceFactory().startConnection();
- //jmsResourceFactory.startConnection();
- replyMsg = consumer.receive(context.getTimeToLive());
- } finally {
- consumer.close();
- }
- if (replyMsg == null) {
- throw new JMSBindingException("No reply message received on " +
- context.getReplyToDestination() +
- " for message id " +
- requestMessage.getJMSMessageID());
- }
-
- msg.setBody(replyMsg);
- return msg;
- } catch (JMSException e) {
- throw new JMSBindingException(e);
- } catch (NamingException e) {
- throw new JMSBindingException(e);
- } finally {
- try {
- context.closeJmsResponseSession();
- if (jmsResourceFactory.isConnectionClosedAfterUse())
- jmsResourceFactory.closeResponseConnection();
- } catch (JMSException e) {
- }
- }
- }
-
- public Invoker getNext() {
- return next;
- }
-
- public void setNext(Invoker next) {
- this.next = next;
- }
-}
diff --git a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/transport/TransportServiceInterceptor.java b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/transport/TransportServiceInterceptor.java
deleted file mode 100644
index 6a32339c5d..0000000000
--- a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/transport/TransportServiceInterceptor.java
+++ /dev/null
@@ -1,186 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.jms.transport;
-
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import javax.jms.Destination;
-import javax.jms.JMSException;
-import javax.jms.MessageProducer;
-import javax.jms.Session;
-import javax.naming.NamingException;
-
-import org.apache.tuscany.sca.binding.jms.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.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 RuntimeEndpoint endpoint;
- private JMSResourceFactory jmsResourceFactory;
- private JMSBinding jmsBinding;
- private JMSMessageProcessor requestMessageProcessor;
- private JMSMessageProcessor responseMessageProcessor;
- private RuntimeComponentService service;
- private String correlationScheme;
-
-
- public TransportServiceInterceptor(ExtensionPointRegistry registry, JMSBinding jmsBinding, JMSResourceFactory jmsResourceFactory, RuntimeEndpoint endpoint) {
- super();
- this.jmsBinding = jmsBinding;
- this.endpoint = endpoint;
- this.jmsResourceFactory = jmsResourceFactory;
- this.requestMessageProcessor = JMSMessageProcessorUtil.getRequestMessageProcessor(registry, jmsBinding);
- this.responseMessageProcessor = JMSMessageProcessorUtil.getResponseMessageProcessor(registry, jmsBinding);
- this.service = (RuntimeComponentService)endpoint.getService();
- this.correlationScheme = jmsBinding.getCorrelationScheme();
- }
-
- public Message invoke(Message msg) {
- try {
- return invokeResponse(next.invoke(invokeRequest(msg)));
- } catch (Throwable e) {
- logger.log(Level.SEVERE, "Exception invoking service '" + service.getName(), e);
- JMSBindingContext context = msg.getBindingContext();
- javax.jms.Message replyJMSMsg = responseMessageProcessor.createFaultMessage(context.getJmsResponseSession(),
- (Throwable)e);
- msg.setBody(replyJMSMsg);
- invokeResponse(msg);
- return msg;
- } finally {
- try {
- ((JMSBindingContext)msg.getBindingContext()).closeJmsResponseSession();
- if (jmsResourceFactory.isConnectionClosedAfterUse())
- jmsResourceFactory.closeResponseConnection();
- } catch (JMSException e) {
- }
- }
- }
-
- public Message invokeRequest(Message msg) {
-// try {
- JMSBindingContext context = msg.getBindingContext();
- javax.jms.Message requestJMSMsg = context.getJmsMsg();
-
-// EndpointReference from = new EndpointReferenceImpl(null);
-// msg.setFrom(from);
-// from.setCallbackEndpoint(new EndpointReferenceImpl("/")); // TODO: whats this for?
-// ReferenceParameters parameters = from.getReferenceParameters();
-
-// String conversationID = requestJMSMsg.getStringProperty(JMSBindingConstants.CONVERSATION_ID_PROPERTY);
-// if (conversationID != null) {
-// parameters.setConversationID(conversationID);
-// }
-
- return msg;
-// } catch (JMSException e) {
-// throw new JMSBindingException(e);
-// }
- }
-
- public Message invokeResponse(Message msg) {
- try {
-
- //if operation is oneway, return back.
- Operation operation = msg.getOperation();
- if (operation != null && operation.isNonBlocking()) {
- return msg;
- }
-
- JMSBindingContext context = msg.getBindingContext();
- Session session = context.getJmsResponseSession();
- javax.jms.Message requestJMSMsg = context.getJmsMsg();
- javax.jms.Message responseJMSMsg = msg.getBody();
-
- Destination replyDest = requestJMSMsg.getJMSReplyTo();
- if (replyDest == null) {
- if (jmsBinding.getResponseDestinationName() != null) {
- try {
- replyDest = jmsResourceFactory.lookupDestination(jmsBinding.getResponseDestinationName());
- } catch (NamingException e) {
- throw new JMSBindingException("Exception lookingup response destination", e);
- }
- }
- }
-
- if (replyDest == null) {
- // assume no reply is expected
- if (msg.getBody() != null) {
- logger.log(Level.FINE, "JMS service '" + service.getName() + "' dropped response as request has no replyTo");
- }
- return msg;
- }
-
- responseJMSMsg.setJMSDeliveryMode(requestJMSMsg.getJMSDeliveryMode());
- responseJMSMsg.setJMSPriority(requestJMSMsg.getJMSPriority());
-
- if (correlationScheme == null ||
- JMSBindingConstants.CORRELATE_MSG_ID.equalsIgnoreCase(correlationScheme)) {
- responseJMSMsg.setJMSCorrelationID(requestJMSMsg.getJMSMessageID());
- } else if (JMSBindingConstants.CORRELATE_CORRELATION_ID.equalsIgnoreCase(correlationScheme)) {
- responseJMSMsg.setJMSCorrelationID(requestJMSMsg.getJMSCorrelationID());
- }
-
- MessageProducer producer = session.createProducer(replyDest);
-
- // Set jms header attributes in producer, not message.
- int deliveryMode = requestJMSMsg.getJMSDeliveryMode();
- producer.setDeliveryMode(deliveryMode);
- int deliveryPriority = requestJMSMsg.getJMSPriority();
- producer.setPriority(deliveryPriority);
-
- producer.send((javax.jms.Message)msg.getBody());
-
- producer.close();
- context.closeJmsResponseSession();
-
- return msg;
-
- } catch (JMSException e) {
- throw new JMSBindingException(e);
- }
- }
-
- public Invoker getNext() {
- return next;
- }
-
- public void setNext(Invoker next) {
- this.next = next;
- }
-
-}
diff --git a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wire/CallbackDestinationInterceptor.java b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wire/CallbackDestinationInterceptor.java
deleted file mode 100644
index 2245f61ee7..0000000000
--- a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wire/CallbackDestinationInterceptor.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.jms.wire;
-
-import javax.jms.Destination;
-import javax.jms.JMSException;
-import javax.jms.Queue;
-import javax.jms.Topic;
-
-import org.apache.tuscany.sca.binding.jms.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;
-
- public CallbackDestinationInterceptor(RuntimeEndpoint endpoint) {
- super();
- this.service = (RuntimeComponentService) endpoint.getService();
- }
-
- public Invoker getNext() {
- return next;
- }
-
- public void setNext(Invoker next) {
- this.next = next;
- }
-
- public Message invoke(Message msg) {
- return next.invoke(invokeRequest(msg));
- }
-
- public Message invokeRequest(Message msg) {
- try {
- // get the jms context
- JMSBindingContext context = msg.getBindingContext();
- javax.jms.Message jmsMsg = context.getJmsMsg();
-
- //ReferenceParameters parameters = msg.getFrom().getReferenceParameters(); TODO: 2.x migration, are these needed?
-
- if (service.getInterfaceContract().getCallbackInterface() != null) {
-
- String callbackdestName = jmsMsg.getStringProperty(JMSBindingConstants.CALLBACK_Q_PROPERTY);
- if (callbackdestName == null && msg.getOperation().isNonBlocking()) {
- // if the request has a replyTo but this service operation is oneway but the service uses callbacks
- // then use the replyTo as the callback destination
- Destination replyTo = jmsMsg.getJMSReplyTo();
- if (replyTo != null) {
- callbackdestName = (replyTo instanceof Queue) ? ((Queue) replyTo).getQueueName() : ((Topic) replyTo).getTopicName();
- }
- }
-
- if (callbackdestName != null) {
- // append "jms:" to make it an absolute uri so the invoker can determine it came in on the request
- // as otherwise the invoker should use the uri from the service callback binding
-// parameters.setCallbackReference(new EndpointReferenceImpl("jms:" + callbackdestName));
- }
-
- String callbackID = jmsMsg.getStringProperty(JMSBindingConstants.CALLBACK_ID_PROPERTY);
- if (callbackID != null) {
-// parameters.setCallbackID(callbackID);
- }
- }
-
- } catch (JMSException e) {
- throw new JMSBindingException(e);
- }
-
- return msg;
- }
-} \ No newline at end of file
diff --git a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wire/OperationPropertiesInterceptor.java b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wire/OperationPropertiesInterceptor.java
deleted file mode 100644
index bf046b473e..0000000000
--- a/java/sca/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/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesProviderFactory.java b/java/sca/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/java/sca/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/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesReferenceInterceptor.java b/java/sca/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/java/sca/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/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesReferenceProvider.java b/java/sca/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/java/sca/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/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesServiceInterceptor.java b/java/sca/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/java/sca/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/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesServiceProvider.java b/java/sca/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/java/sca/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/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytesxml/runtime/WireFormatJMSBytesXMLProviderFactory.java b/java/sca/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/java/sca/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/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytesxml/runtime/WireFormatJMSBytesXMLReferenceInterceptor.java b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytesxml/runtime/WireFormatJMSBytesXMLReferenceInterceptor.java
deleted file mode 100644
index 701a32e236..0000000000
--- a/java/sca/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.axiom.om.OMElement;
-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;
-
-
-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);
- OMElement om = (OMElement) response;
- e.setFaultName(new QName(om.getNamespace().getNamespaceURI(), om.getLocalName()));
- msg.setFaultBody(e);
- }
- } catch (JMSException e) {
- throw new JMSBindingException(e);
- }
- } else {
- msg.setBody(null);
- }
- }
-
- return msg;
- }
-
- public Invoker getNext() {
- return next;
- }
-
- public void setNext(Invoker next) {
- this.next = next;
- }
-}
diff --git a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytesxml/runtime/WireFormatJMSBytesXMLReferenceProvider.java b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytesxml/runtime/WireFormatJMSBytesXMLReferenceProvider.java
deleted file mode 100644
index e56d35a8ed..0000000000
--- a/java/sca/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.axiom.om.OMElement;
-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.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(OMElement.class.getName());
- }
-
- public InterfaceContract configureWireFormatInterfaceContract(InterfaceContract interfaceContract){
-
- if (this.interfaceContract != null ) {
- if (this.binding.getRequestWireFormat() instanceof WireFormatJMSBytesXML){
- // set the request data transformation
- interfaceContract.getInterface().resetInterfaceInputTypes(this.interfaceContract.getInterface());
- }
- if (this.binding.getResponseWireFormat() instanceof WireFormatJMSBytesXML){
- // set the response data transformation
- interfaceContract.getInterface().resetInterfaceOutputTypes(this.interfaceContract.getInterface());
- }
- }
-
- return interfaceContract;
- }
-
- public Interceptor createInterceptor() {
- return new WireFormatJMSBytesXMLReferenceInterceptor(registry, null, endpointReference);
- }
-
- public String getPhase() {
- return Phase.REFERENCE_BINDING_WIREFORMAT;
- }
-
- public InterfaceContract getWireFormatInterfaceContract() {
- return interfaceContract;
- }
-}
diff --git a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytesxml/runtime/WireFormatJMSBytesXMLServiceInterceptor.java b/java/sca/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/java/sca/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/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytesxml/runtime/WireFormatJMSBytesXMLServiceProvider.java b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytesxml/runtime/WireFormatJMSBytesXMLServiceProvider.java
deleted file mode 100644
index 00aaee39d5..0000000000
--- a/java/sca/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.axiom.om.OMElement;
-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.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(OMElement.class.getName());
- }
-
- public InterfaceContract configureWireFormatInterfaceContract(InterfaceContract interfaceContract){
-
- if (this.interfaceContract != null ) {
- if (this.binding.getRequestWireFormat() instanceof WireFormatJMSBytesXML){
- // set the request data transformation
- interfaceContract.getInterface().resetInterfaceInputTypes(this.interfaceContract.getInterface());
- }
- if (this.binding.getResponseWireFormat() instanceof WireFormatJMSBytesXML){
- // set the response data transformation
- interfaceContract.getInterface().resetInterfaceOutputTypes(this.interfaceContract.getInterface());
- }
- }
-
- return interfaceContract;
- }
-
- /**
- */
- public Interceptor createInterceptor() {
- return new WireFormatJMSBytesXMLServiceInterceptor(registry, jmsResourceFactory, endpoint);
- }
-
- /**
- */
- public String getPhase() {
- return Phase.SERVICE_BINDING_WIREFORMAT;
- }
-
- public InterfaceContract getWireFormatInterfaceContract() {
- return interfaceContract;
- }
-}
diff --git a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/runtime/WireFormatJMSDefaultProviderFactory.java b/java/sca/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/java/sca/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/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/runtime/WireFormatJMSDefaultReferenceInterceptor.java b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/runtime/WireFormatJMSDefaultReferenceInterceptor.java
deleted file mode 100644
index 499784095a..0000000000
--- a/java/sca/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.axiom.om.OMElement;
-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;
-
-/**
- *
- * @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, OMElement> outputWrapperMap;
-
- public WireFormatJMSDefaultReferenceInterceptor(ExtensionPointRegistry registry, JMSResourceFactory jmsResourceFactory, RuntimeEndpointReference endpointReference, HashMap<String, Boolean> inputWrapperMap,
- HashMap<String, OMElement> 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 {
-
- OMElement wrapper = null;
- // if we have a fault no need to wrap the response
- try {
- if (!jmsMsg.getBooleanProperty(JMSBindingConstants.FAULT_PROPERTY)) {
- // If there is only one arg we must add a wrapper if the operation is wrapper style
- wrapper = this.outputWrapperMap.get(msg.getOperation().getName());
- }
- } catch (JMSException e) {
- throw new JMSBindingException(e);
- }
-
- Object response;
- if (jmsMsg instanceof BytesMessage) {
- response = responseMessageProcessor.extractPayloadFromJMSBytesMessage(jmsMsg, wrapper);
- } else {
- response = responseMessageProcessor.extractPayloadFromJMSTextMessage(jmsMsg, wrapper);
- }
-
- if (response != null) {
- msg.setBody(response);
- try {
- if (jmsMsg.getBooleanProperty(JMSBindingConstants.FAULT_PROPERTY)) {
- FaultException e = new FaultException("remote exception", response);
- OMElement om = (OMElement) response;
- e.setFaultName(new QName(om.getNamespace().getNamespaceURI(), om.getLocalName()));
- msg.setFaultBody(e);
- }
- } catch (JMSException e) {
- throw new JMSBindingException(e);
- }
- } else {
- msg.setBody(null);
- }
- }
- }
-
- return msg;
- }
-
- public Invoker getNext() {
- return next;
- }
-
- public void setNext(Invoker next) {
- this.next = next;
- }
-}
diff --git a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/runtime/WireFormatJMSDefaultReferenceProvider.java b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/runtime/WireFormatJMSDefaultReferenceProvider.java
deleted file mode 100644
index 2732241b61..0000000000
--- a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/runtime/WireFormatJMSDefaultReferenceProvider.java
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.jms.wireformat.jmsdefault.runtime;
-
-import java.util.HashMap;
-import java.util.List;
-
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.OMNamespace;
-import org.apache.tuscany.sca.assembly.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.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.util.ElementInfo;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.Phase;
-import org.apache.tuscany.sca.provider.WireFormatProvider;
-import org.apache.tuscany.sca.runtime.RuntimeEndpointReference;
-
-/**
- * @version $Rev$ $Date$
- */
-public class WireFormatJMSDefaultReferenceProvider implements WireFormatProvider {
- private ExtensionPointRegistry registry;
- private RuntimeEndpointReference endpointReference;
- private ComponentReference reference;
- private JMSBinding binding;
- private InterfaceContract interfaceContract;
- private HashMap<String, Boolean> inputWrapperMap;
- private HashMap<String, OMElement> outputWrapperMap;
-
- public WireFormatJMSDefaultReferenceProvider(ExtensionPointRegistry registry, RuntimeEndpointReference endpointReference) {
- super();
- this.registry = registry;
- this.endpointReference = endpointReference;
- this.binding = (JMSBinding) endpointReference.getBinding();
-
- this.inputWrapperMap = new HashMap<String, Boolean>();
- this.outputWrapperMap = new HashMap<String, OMElement>();
-
- // configure the reference based on this wire format
-
- // currently maintaining the message processor structure which
- // contains the details of jms message processing so set the message
- // type here if not set explicitly in SCDL
- if (this.binding.getRequestWireFormat() instanceof WireFormatJMSDefault){
- this.binding.setRequestMessageProcessorName(JMSBindingConstants.DEFAULT_MP_CLASSNAME);
- }
- if (this.binding.getResponseWireFormat() instanceof WireFormatJMSDefault){
- this.binding.setResponseMessageProcessorName(JMSBindingConstants.DEFAULT_MP_CLASSNAME);
- }
-
- 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
- OMFactory factory = OMAbstractFactory.getOMFactory();
-
- // set the binding interface contract to represent the WSDL for the
- // xml messages that will be sent
- // I think we have to check for asIs because the Java2WSDL will blow up when using javax.jms.Message
- if (reference.getInterfaceContract() != null && !isAsIs()) {
- WebServiceBindingFactory wsFactory = registry.getExtensionPoint(WebServiceBindingFactory.class);
- WebServiceBinding wsBinding = wsFactory.createWebServiceBinding();
- BindingWSDLGenerator.generateWSDL(endpointReference.getComponent(), reference, wsBinding, registry, null);
- interfaceContract = wsBinding.getBindingInterfaceContract();
- interfaceContract.getInterface().resetDataBinding(OMElement.class.getName());
-
- List<Operation> wsdlOpList = interfaceContract.getInterface().getOperations();
-
- for (Operation op : opList) {
-
- String name = op.getName();
- Operation matchingWsdlOp = null;
-
- // find the matching wsdlop
- for (Operation wsdlOp : wsdlOpList) {
- if (name.equals(wsdlOp.getName())) {
- matchingWsdlOp = wsdlOp;
-
- break;
- }
- }
-
- // only add operations that need to be wrapped/unwrapped
- // we need to look at the wsdl interface to determine if the op is wrapped or not
-
- // TODO - not sure we really support viewing the input/output as separately wrapped
- // like the separate code paths imply. Not sure how many @OneWay tests we have, this might
- // not be an issue.
-
- if (matchingWsdlOp.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();
- OMNamespace ns = factory.createOMNamespace(namespace, "ns2");
- OMElement wrapper = factory.createOMElement(opName, ns);
-
- this.outputWrapperMap.put(name, wrapper);
- }
- }
- } else {
- interfaceContract = reference.getReference().getInterfaceContract();
- }
-
- }
-
- protected boolean isAsIs() {
- InterfaceContract ic = reference.getInterfaceContract();
- if (ic.getInterface().getOperations().size() != 1) {
- return false;
- }
-
- List<DataType> inputDataTypes = ic.getInterface().getOperations().get(0).getInputType().getLogical();
-
- if (inputDataTypes.size() != 1) {
- return false;
- }
-
- Class<?> inputType = inputDataTypes.get(0).getPhysical();
-
- if (javax.jms.Message.class.isAssignableFrom(inputType)) {
- return true;
- }
- return false;
- }
-
- public InterfaceContract configureWireFormatInterfaceContract(InterfaceContract interfaceContract){
-
- if (this.interfaceContract != null &&
- !isAsIs()) {
- if (this.binding.getRequestWireFormat() instanceof WireFormatJMSDefault){
- // set the request data transformation
- interfaceContract.getInterface().resetInterfaceInputTypes(this.interfaceContract.getInterface());
- }
- if (this.binding.getResponseWireFormat() instanceof WireFormatJMSDefault){
- // set the response data transformation
- interfaceContract.getInterface().resetInterfaceOutputTypes(this.interfaceContract.getInterface());
- }
- }
-
- return interfaceContract;
- }
-
- public Interceptor createInterceptor() {
- return new WireFormatJMSDefaultReferenceInterceptor(registry, null, endpointReference, inputWrapperMap, outputWrapperMap);
- }
-
- public String getPhase() {
- return Phase.REFERENCE_BINDING_WIREFORMAT;
- }
-
- public InterfaceContract getWireFormatInterfaceContract() {
- return interfaceContract;
- }
-}
diff --git a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/runtime/WireFormatJMSDefaultServiceInterceptor.java b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/runtime/WireFormatJMSDefaultServiceInterceptor.java
deleted file mode 100644
index 5d12af9b38..0000000000
--- a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/runtime/WireFormatJMSDefaultServiceInterceptor.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 java.util.List;
-
-import javax.jms.BytesMessage;
-import javax.jms.Session;
-
-import org.apache.axiom.om.OMElement;
-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.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;
-
-/**
- * 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,OMElement> inputWrapperMap;
- private HashMap<String, Boolean> outputWrapperMap;
-
- public WireFormatJMSDefaultServiceInterceptor(ExtensionPointRegistry registry, JMSResourceFactory jmsResourceFactory, RuntimeEndpoint endpoint, HashMap<String, OMElement> 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
- OMElement wrapper = this.inputWrapperMap.get(msg.getOperation().getName());
-
- Object requestPayload;
- if (jmsMsg instanceof BytesMessage) {
- requestPayload = responseMessageProcessor.extractPayloadFromJMSBytesMessage(jmsMsg, wrapper);
- context.setUseBytesForWFJMSDefaultResponse(true);
- } else {
- requestPayload = responseMessageProcessor.extractPayloadFromJMSTextMessage(jmsMsg, wrapper );
- context.setUseBytesForWFJMSDefaultResponse(false);
- }
-
- msg.setBody(new Object[] { requestPayload });
- }
-
- return msg;
-
- }
-
- public Message invokeResponse(Message msg) {
-
- // get the jms context
- JMSBindingContext context = msg.getBindingContext();
- Session session = context.getJmsResponseSession();
-
- javax.jms.Message responseJMSMsg;
-
- boolean respondBytesMessage = context.isUseBytesForWFJMSDefaultResponse();
-
- if (msg.isFault()) {
- if (respondBytesMessage == true) {
- responseJMSMsg = requestMessageProcessor.createFaultJMSBytesMessage(session, (Throwable) msg.getBody());
- } else {
- responseJMSMsg = responseMessageProcessor.createFaultJMSTextMessage(session, (Throwable) msg.getBody());
- }
- } else {
- boolean unwrap = false;
-
- if (this.outputWrapperMap.get(msg.getOperation().getName()) != null){
- unwrap = this.outputWrapperMap.get(msg.getOperation().getName());
- }
-
- if (respondBytesMessage == true) {
- responseJMSMsg = requestMessageProcessor.insertPayloadIntoJMSBytesMessage(session, msg.getBody(), unwrap);
- } else {
- responseJMSMsg = requestMessageProcessor.insertPayloadIntoJMSTextMessage(session, msg.getBody(), unwrap);
- }
- }
-
- msg.setBody(responseJMSMsg);
-
- return msg;
- }
-
- public Invoker getNext() {
- return next;
- }
-
- public void setNext(Invoker next) {
- this.next = next;
- }
-}
diff --git a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/runtime/WireFormatJMSDefaultServiceProvider.java b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/runtime/WireFormatJMSDefaultServiceProvider.java
deleted file mode 100644
index 85c775136c..0000000000
--- a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/runtime/WireFormatJMSDefaultServiceProvider.java
+++ /dev/null
@@ -1,193 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.jms.wireformat.jmsdefault.runtime;
-
-import java.util.HashMap;
-import java.util.List;
-
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.OMNamespace;
-import org.apache.tuscany.sca.assembly.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.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.util.ElementInfo;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.Phase;
-import org.apache.tuscany.sca.provider.WireFormatProvider;
-import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
-
-/**
- * @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 HashMap<String, OMElement> inputWrapperMap;
- private HashMap<String, Boolean> outputWrapperMap;
-
- public WireFormatJMSDefaultServiceProvider(ExtensionPointRegistry registry, RuntimeEndpoint endpoint, JMSResourceFactory jmsResourceFactory) {
- super();
- this.endpoint = endpoint;
- this.binding = (JMSBinding) endpoint.getBinding();
- this.service = endpoint.getService();
- this.jmsResourceFactory = jmsResourceFactory;
-
- this.inputWrapperMap = new HashMap<String, OMElement>();
- this.outputWrapperMap = new HashMap<String, Boolean>();
-
- // configure the service based on this wire format
-
- // currently maintaining the message processor structure which
- // contains the details of jms message processing so set the message
- // type here if not set explicitly in SCDL
- if (this.binding.getRequestWireFormat() instanceof WireFormatJMSDefault){
- this.binding.setRequestMessageProcessorName(JMSBindingConstants.DEFAULT_MP_CLASSNAME);
- }
- if (this.binding.getResponseWireFormat() instanceof WireFormatJMSDefault){
- this.binding.setResponseMessageProcessorName(JMSBindingConstants.DEFAULT_MP_CLASSNAME);
- }
-
- List<Operation> opList = service.getService().getInterfaceContract().getInterface().getOperations();
-
- // Go through each operation and add wrapper info
- OMFactory factory = OMAbstractFactory.getOMFactory();
-
- // set the binding interface contract to represent the WSDL for the
- // xml messages that will be sent
-
- // I think we have to check for asIs because the Java2WSDL will blow up when using javax.jms.Message
- if (service.getInterfaceContract() != null && !isAsIs()) {
- WebServiceBindingFactory wsFactory = registry.getExtensionPoint(WebServiceBindingFactory.class);
- WebServiceBinding wsBinding = wsFactory.createWebServiceBinding();
- BindingWSDLGenerator.generateWSDL(endpoint.getComponent(), service, wsBinding, registry, null);
- interfaceContract = wsBinding.getBindingInterfaceContract();
- interfaceContract.getInterface().resetDataBinding(OMElement.class.getName());
-
- List<Operation> wsdlOpList = interfaceContract.getInterface().getOperations();
-
- for (Operation op : opList) {
- String name = op.getName();
-
- Operation matchingWsdlOp = null;
-
- // find the matching wsdlop
- for (Operation wsdlOp : wsdlOpList) {
- if (name.equals(wsdlOp.getName())) {
- matchingWsdlOp = wsdlOp;
- break;
- }
- }
-
- // only add operations that need to be wrapped/unwrapped
-
- // TODO - not sure we really support viewing the input/output as separately wrapped
- // like the separate code paths imply. Not sure how many @OneWay tests we have, this might
- // not be an issue.
- if (matchingWsdlOp.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();
- OMNamespace ns = factory.createOMNamespace(namespace, "ns1");
- OMElement wrapper = factory.createOMElement(opName, ns);
- 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/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectProviderFactory.java b/java/sca/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/java/sca/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/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectReferenceInterceptor.java b/java/sca/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/java/sca/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/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectReferenceProvider.java b/java/sca/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/java/sca/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/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectServiceInterceptor.java b/java/sca/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/java/sca/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/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectServiceProvider.java b/java/sca/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/java/sca/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/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextProviderFactory.java b/java/sca/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/java/sca/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/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextReferenceInterceptor.java b/java/sca/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/java/sca/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/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextReferenceProvider.java b/java/sca/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/java/sca/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/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextServiceInterceptor.java b/java/sca/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/java/sca/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/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextServiceProvider.java b/java/sca/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/java/sca/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/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLProviderFactory.java b/java/sca/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/java/sca/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/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLReferenceInterceptor.java b/java/sca/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/java/sca/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/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLReferenceProvider.java b/java/sca/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/java/sca/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/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLServiceInterceptor.java b/java/sca/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/java/sca/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/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLServiceProvider.java b/java/sca/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/java/sca/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;
- }
-
-}