diff options
Diffstat (limited to '')
19 files changed, 1941 insertions, 0 deletions
diff --git a/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/DefaultOperationAndDataBinding.java b/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/DefaultOperationAndDataBinding.java new file mode 100644 index 0000000000..c96bb76b1b --- /dev/null +++ b/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/DefaultOperationAndDataBinding.java @@ -0,0 +1,162 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.binding.jms; + +import java.io.Serializable; +import java.io.StringReader; + +import javax.jms.JMSException; +import javax.jms.Message; +import javax.jms.ObjectMessage; +import javax.jms.Session; +import javax.jms.TextMessage; +import javax.xml.stream.XMLInputFactory; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; + +import org.apache.axiom.om.OMElement; +import org.apache.axiom.om.impl.builder.StAXOMBuilder; + +public class DefaultOperationAndDataBinding implements OperationAndDataBinding { + + protected String operationPropertyName; + + private boolean xmlFormat; + + public DefaultOperationAndDataBinding(JMSBindingDefinition jmsBinding) { + this.operationPropertyName = jmsBinding.getOperationSelectorPropertyName(); + this.xmlFormat = jmsBinding.isXMLFormat(); + } + + /* + * (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 createJMSMessage(Session session, Object o) { + if (xmlFormat) { + return createXMLJMSMessage(session, o); + } else { + return createObjectJMSMessage(session, o); + } + } + + /* + * (non-Javadoc) + * + * @see org.apache.tuscany.binding.jms.OperationAndDataBinding#extractPayload(javax.jms.Message) + */ + public Object extractPayload(Message msg) { + if (xmlFormat) { + return extractXMLPayload(msg); + } else { + return extractObjectPayload(msg); + } + } + + protected Object extractXMLPayload(Message msg) { + try { + + String xml = ((TextMessage)msg).getText(); + + XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(new StringReader(xml)); + StAXOMBuilder builder = new StAXOMBuilder(reader); + OMElement omElement = builder.getDocumentElement(); + + return new Object[] {omElement}; + + } catch (XMLStreamException e) { + throw new JMSBindingException(e); + } catch (JMSException e) { + throw new JMSBindingException(e); + } + } + + protected Message createXMLJMSMessage(Session session, Object o) { + try { + + TextMessage message = session.createTextMessage(); + + if (o instanceof OMElement) { + message.setText(o.toString()); + } else { + message.setText(((Object[])o)[0].toString()); + } + + return message; + + } catch (JMSException e) { + throw new JMSBindingException(e); + } + } + + protected Object extractObjectPayload(Message msg) { + try { + + return ((ObjectMessage)msg).getObject(); + + } catch (JMSException e) { + throw new JMSBindingException(e); + } + } + + protected Message createObjectJMSMessage(Session session, Object o) { + try { + + ObjectMessage message = session.createObjectMessage(); // default + message.setObject((Serializable)o); + return message; + + } catch (JMSException e) { + throw new JMSBindingException(e); + } + } +} diff --git a/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/JMSBindingBuilder.java b/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/JMSBindingBuilder.java new file mode 100644 index 0000000000..6b38743b20 --- /dev/null +++ b/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/JMSBindingBuilder.java @@ -0,0 +1,177 @@ +/**
+ *
+ * Copyright 2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.binding.jms;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import javax.jms.Destination;
+import javax.naming.NamingException;
+
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.component.ServiceBinding;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.extension.BindingBuilderExtension;
+import org.apache.tuscany.spi.model.BoundReferenceDefinition;
+import org.apache.tuscany.spi.model.BoundServiceDefinition;
+import org.apache.tuscany.spi.model.ServiceContract;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.tuscany.idl.wsdl.WSDLServiceContract;
+
+/**
+ * Builds a Service or Reference for JMS binding.
+ *
+ * @version $Rev: 449970 $ $Date: 2006-09-26 06:05:35 -0400 (Tue, 26 Sep 2006) $
+ */
+
+public class JMSBindingBuilder extends BindingBuilderExtension<JMSBindingDefinition> {
+
+ private static final String DEFAULT_JMS_RESOURCE_FACTORY =
+ "org.apache.tuscany.binding.jms.SimpleJMSResourceFactory";
+
+ private static final String OM_DATA_BINDING = OMElement.class.getName();
+
+ protected Class<JMSBindingDefinition> getBindingType() {
+ return JMSBindingDefinition.class;
+ }
+
+ public ServiceBinding build(CompositeComponent parent,
+ BoundServiceDefinition serviceDefinition,
+ JMSBindingDefinition jmsBinding,
+ DeploymentContext deploymentContext) {
+
+ Class<?> interfaze = serviceDefinition.getServiceContract().getInterfaceClass();
+
+ ServiceContract serviceContract = serviceDefinition.getServiceContract();
+ jmsBinding.setXMLFormat(serviceContract instanceof WSDLServiceContract);
+
+ JMSResourceFactory jmsResourceFactory = getJMSResourceFactory(jmsBinding);
+
+ if (serviceContract instanceof WSDLServiceContract) {
+ serviceContract.setDataBinding(OM_DATA_BINDING);
+ }
+
+ OperationAndDataBinding requestODB =
+ getRequestOperationAndDatabinding(jmsBinding, deploymentContext.getClassLoader());
+ OperationAndDataBinding responseODB =
+ getRequestOperationAndDatabinding(jmsBinding, deploymentContext.getClassLoader());
+
+ return new JMSServiceBinding(serviceDefinition.getName(), parent, jmsBinding, jmsResourceFactory,
+ serviceContract, requestODB, responseODB, interfaze);
+ }
+
+ public JMSReferenceBinding build(CompositeComponent parent,
+ BoundReferenceDefinition referenceDefinition,
+ JMSBindingDefinition jmsBinding,
+ DeploymentContext deploymentContext) {
+
+ String name = referenceDefinition.getName();
+ ServiceContract serviceContract;
+ try {
+ serviceContract = (ServiceContract) referenceDefinition.getServiceContract().clone();
+ } catch (CloneNotSupportedException e) {
+ throw new JMSBindingException("Couldn't clone the Service Contract", e);
+ }
+ serviceContract.setDataBinding(OM_DATA_BINDING);
+
+ JMSResourceFactory jmsResourceFactory = getJMSResourceFactory(jmsBinding);
+
+ Destination requestDest;
+ Destination replyDest = null;
+ try {
+ requestDest = jmsResourceFactory.lookupDestination(jmsBinding.getDestinationName());
+ if (jmsBinding.getResponseDestinationName() != null) {
+ replyDest = jmsResourceFactory.lookupDestination(jmsBinding.getResponseDestinationName());
+ }
+ } catch (NamingException e) {
+ throw new JMSBindingException(e);
+ }
+
+ OperationAndDataBinding requestODB =
+ getRequestOperationAndDatabinding(jmsBinding, deploymentContext.getClassLoader());
+ OperationAndDataBinding responseODB =
+ getRequestOperationAndDatabinding(jmsBinding, deploymentContext.getClassLoader());
+
+ return new JMSReferenceBinding(name, parent, jmsBinding, jmsResourceFactory, serviceContract, requestODB, responseODB,
+ requestDest, replyDest);
+
+ }
+
+ private JMSResourceFactory getJMSResourceFactory(JMSBindingDefinition jmsBinding) {
+ String className = jmsBinding.getJmsResourceFactoryName();
+ if (className != null && !className.equals("")) {
+ try {
+ Class factoryClass = Class.forName(className != null ? className : DEFAULT_JMS_RESOURCE_FACTORY);
+ Constructor constructor = factoryClass.getDeclaredConstructor(new Class[]{JMSBindingDefinition.class});
+ return (JMSResourceFactory) constructor.newInstance(jmsBinding);
+ } catch (ClassNotFoundException e) {
+ throw new JMSBindingException("Error loading the JMSResourceFactory", e);
+ } catch (SecurityException e) {
+ throw new JMSBindingException("Error loading the JMSResourceFactory", e);
+ } catch (NoSuchMethodException e) {
+ throw new JMSBindingException("Error loading the JMSResourceFactory", e);
+ } catch (IllegalArgumentException e) {
+ throw new JMSBindingException("Error loading the JMSResourceFactory", e);
+ } catch (InstantiationException e) {
+ throw new JMSBindingException("Error loading the JMSResourceFactory", e);
+ } catch (IllegalAccessException e) {
+ throw new JMSBindingException("Error loading the JMSResourceFactory", e);
+ } catch (InvocationTargetException e) {
+ throw new JMSBindingException("Error loading the JMSResourceFactory", e);
+ }
+ } else {
+ return new SimpleJMSResourceFactory(jmsBinding);
+ }
+
+ }
+
+ protected OperationAndDataBinding getRequestOperationAndDatabinding(JMSBindingDefinition jmsBinding,
+ ClassLoader cl) {
+ String className = jmsBinding.getRequestOperationAndDatabindingName();
+ OperationAndDataBinding operationAndDataBinding = instantiateClass(jmsBinding, cl, className);
+ return operationAndDataBinding;
+ }
+
+ protected OperationAndDataBinding getResponseOperationAndDatabinding(JMSBindingDefinition jmsBinding,
+ ClassLoader cl) {
+ String className = jmsBinding.getResponseOperationAndDatabindingName();
+ OperationAndDataBinding operationAndDataBinding = instantiateClass(jmsBinding, cl, className);
+ return operationAndDataBinding;
+ }
+
+ protected OperationAndDataBinding instantiateClass(JMSBindingDefinition jmsBinding, ClassLoader cl,
+ String className) {
+ OperationAndDataBinding operationAndDataBinding;
+ if (cl == null) {
+ cl = this.getClass().getClassLoader();
+ }
+ try {
+ Class clazz;
+ try {
+ clazz = cl.loadClass(className);
+ } catch (ClassNotFoundException e) {
+ clazz = this.getClass().getClassLoader().loadClass(className);
+ }
+ Constructor constructor = clazz.getDeclaredConstructor(new Class[]{JMSBindingDefinition.class});
+ operationAndDataBinding = (OperationAndDataBinding) constructor.newInstance(jmsBinding);
+
+ } catch (Throwable e) {
+ throw new JMSBindingException("Exception instantiating OperationAndDataBinding class", e);
+ }
+ return operationAndDataBinding;
+ }
+}
diff --git a/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/JMSBindingDefinition.java b/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/JMSBindingDefinition.java new file mode 100644 index 0000000000..96f2599645 --- /dev/null +++ b/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/JMSBindingDefinition.java @@ -0,0 +1,257 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.binding.jms;
+
+import javax.jms.DeliveryMode;
+
+import org.apache.tuscany.spi.model.BindingDefinition;
+
+/**
+ * Represents a binding to a JMS resource.
+ */
+
+public class JMSBindingDefinition extends BindingDefinition {
+
+ public final static int DESTINATION_TYPE_QUEUE = 0;
+ public final static int DESTINATION_TYPE_TOPIC = 1;
+
+ private int destinationType = DESTINATION_TYPE_QUEUE;
+
+ private String destinationName;
+
+ // Topic or Query factory name
+ private String connectionFactoryName;
+
+ private String activationSpecName;
+
+ private String initialContextFactoryName; // "org.apache.activemq.jndi.ActiveMQInitialContextFactory"
+
+ private String jNDIProviderURL; // "tcp://hostname:61616"
+
+ // Maps to javax.jms.DeliveryMode
+ private int deliveryMode = DeliveryMode.NON_PERSISTENT;
+
+ private int timeToLive = 1000; // in mili seconds
+
+ private int priority;
+
+ private String replyTo;
+
+ private String jmsResourceFactoryName;
+
+ private String operationSelectorName;
+
+ private String operationSelectorPropertyName = DEFAULT_OPERATION_PROP_NAME;
+
+ private String correlationScheme;
+ private String responseDestinationName;
+
+ private String requestOperationAndDatabindingName = DEFAULT_ODB_CLASSNAME;
+ private String responseOperationAndDatabindingName = DEFAULT_ODB_CLASSNAME;
+
+ private boolean xmlFormat;
+
+ public static final String DEFAULT_ODB_CLASSNAME = DefaultOperationAndDataBinding.class.getName();
+ public static final String DEFAULT_OPERATION_PROP_NAME = "scaOperationName";
+
+ public JMSBindingDefinition(int destinationType,
+ String destinationName,
+ String connectionFactoryName,
+ String activationSpecName,
+ String initialContextFactoryName,
+ String providerURL,
+ int deliveryMode,
+ int timeToLive,
+ int priority,
+ String replyTo) {
+ super();
+ this.destinationType = destinationType;
+ this.destinationName = destinationName;
+ this.connectionFactoryName = connectionFactoryName;
+ this.activationSpecName = activationSpecName;
+ this.initialContextFactoryName = initialContextFactoryName;
+ this.jNDIProviderURL = providerURL;
+ this.deliveryMode = deliveryMode;
+ this.timeToLive = timeToLive;
+ this.priority = priority;
+ this.replyTo = replyTo;
+ }
+
+ public JMSBindingDefinition() {
+ super();
+ }
+
+ public String getActivationSpecName() {
+ return activationSpecName;
+ }
+
+ public void setActivationSpecName(String activationSpecName) {
+ this.activationSpecName = activationSpecName;
+ }
+
+ public String getConnectionFactoryName() {
+ return connectionFactoryName;
+ }
+
+ public void setConnectionFactoryName(String connectionFactoryName) {
+ this.connectionFactoryName = connectionFactoryName;
+ }
+
+ public int getDeliveryMode() {
+ return deliveryMode;
+ }
+
+ public void setDeliveryMode(int deliveryMode) {
+ this.deliveryMode = deliveryMode;
+ }
+
+ public String getDestinationName() {
+ return destinationName;
+ }
+
+ public void setDestinationName(String destinationName) {
+ this.destinationName = destinationName;
+ }
+
+ public String getInitialContextFactoryName() {
+ return initialContextFactoryName;
+ }
+
+ public void setInitialContextFactoryName(String initialContextFactoryName) {
+ this.initialContextFactoryName = initialContextFactoryName;
+ }
+
+ public String getJNDIProviderURL() {
+ return jNDIProviderURL;
+ }
+
+ public void setJNDIProviderURL(String providerURL) {
+ jNDIProviderURL = providerURL;
+ }
+
+ public int getPriority() {
+ return priority;
+ }
+
+ public void setPriority(int priority) {
+ this.priority = priority;
+ }
+
+ public String getReplyTo() {
+ return replyTo;
+ }
+
+ public void setReplyTo(String replyTo) {
+ this.replyTo = replyTo;
+ }
+
+ public int getTimeToLive() {
+ return timeToLive;
+ }
+
+ public void setTimeToLive(int timeToLive) {
+ this.timeToLive = timeToLive;
+ }
+
+ public int getDestinationType() {
+ return destinationType;
+ }
+
+ public void setDestinationType(int destinationType) {
+ this.destinationType = destinationType;
+ }
+
+ public String getJmsResourceFactoryName() {
+ return jmsResourceFactoryName;
+ }
+
+ public void setJmsResourceFactoryName(String jmsResourceFactoryName) {
+ this.jmsResourceFactoryName = jmsResourceFactoryName;
+ }
+
+ public String getOperationSelectorName() {
+ return operationSelectorName;
+ }
+
+ public void setOperationSelectorName(String operationSelectorName) {
+ this.operationSelectorName = operationSelectorName;
+ }
+
+ public String getOperationSelectorPropertyName() {
+ return operationSelectorPropertyName;
+ }
+
+ public void setOperationSelectorPropertyName(String operationSelectorPropertyName) {
+ this.operationSelectorPropertyName = operationSelectorPropertyName;
+ }
+
+ public void setCorrelationScheme(String correlationScheme) {
+ this.correlationScheme = correlationScheme;
+ }
+
+ public String getCorrelationScheme() {
+ return correlationScheme;
+ }
+
+ public void setCreateDestination(String create) {
+ }
+
+ public void setResponseDestinationName(String name) {
+ this.responseDestinationName = name;
+ }
+
+ public String getResponseDestinationName() {
+ return responseDestinationName;
+ }
+
+ public void setResponseDestinationType(int destination_type_queue2) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void setCreateResponseDestination(String create) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void setRequestOperationAndDatabindingName(String name) {
+ this.requestOperationAndDatabindingName = name;
+ }
+
+ public String getRequestOperationAndDatabindingName() {
+ return requestOperationAndDatabindingName;
+ }
+
+ public void setResponseOperationAndDatabindingName(String name) {
+ this.responseOperationAndDatabindingName = name;
+ }
+
+ public String getResponseOperationAndDatabindingName() {
+ return responseOperationAndDatabindingName;
+ }
+
+ public boolean isXMLFormat() {
+ return xmlFormat;
+ }
+
+ public void setXMLFormat(boolean b) {
+ this.xmlFormat = b;
+ }
+
+}
diff --git a/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/JMSBindingException.java b/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/JMSBindingException.java new file mode 100644 index 0000000000..a197eeffc6 --- /dev/null +++ b/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/JMSBindingException.java @@ -0,0 +1,40 @@ +/** + * + * Copyright 2006 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.binding.jms; + +import org.apache.tuscany.api.TuscanyRuntimeException; + +public class JMSBindingException extends TuscanyRuntimeException { + private static final long serialVersionUID = 1L; + + public JMSBindingException() { + super(); + } + + public JMSBindingException(String arg0, Throwable arg1) { + super(arg0, arg1); + } + + public JMSBindingException(String arg0) { + super(arg0); + } + + public JMSBindingException(Throwable arg0) { + super(arg0); + } + +} diff --git a/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/JMSBindingLoader.java b/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/JMSBindingLoader.java new file mode 100644 index 0000000000..c20b5250f4 --- /dev/null +++ b/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/JMSBindingLoader.java @@ -0,0 +1,199 @@ +/** + * + * Copyright 2006 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.binding.jms; + +import static javax.xml.stream.XMLStreamConstants.END_ELEMENT; +import static javax.xml.stream.XMLStreamConstants.START_ELEMENT; +import static org.osoa.sca.Version.XML_NAMESPACE_1_0; + +import java.util.Arrays; +import java.util.List; + +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; + +import org.apache.tuscany.spi.annotation.Autowire; +import org.apache.tuscany.spi.component.CompositeComponent; +import org.apache.tuscany.spi.deployer.DeploymentContext; +import org.apache.tuscany.spi.extension.LoaderExtension; +import org.apache.tuscany.spi.loader.LoaderException; +import org.apache.tuscany.spi.loader.LoaderRegistry; +import org.apache.tuscany.spi.model.ModelObject; +import org.osoa.sca.annotations.Scope; + +/** + * Loader for handling <binding.jms> elements based on the 0.96 draft 1 spec. + */ +@Scope("COMPOSITE") +public class JMSBindingLoader extends LoaderExtension<JMSBindingDefinition> { + + public static final QName BINDING_JMS = + new QName(XML_NAMESPACE_1_0, "binding.jms"); + + public static final List<String> VALID_CORRELATION_SCHEMES = + Arrays.asList(new String[] {"requestmsgidtocorrelid", "requestcorrelidtocorrelid", "none"}); + + public JMSBindingLoader(@Autowire LoaderRegistry registry) { + super(registry); + } + + public QName getXMLType() { + return BINDING_JMS; + } + + public JMSBindingDefinition load(CompositeComponent parent, + ModelObject modelObject, + XMLStreamReader reader, + DeploymentContext deploymentContext) throws XMLStreamException, LoaderException { + + JMSBindingDefinition jmsBinding = new JMSBindingDefinition(); + + String uri = reader.getAttributeValue(null, "uri"); + if (uri != null && uri.length() > 0) { + parseURI(jmsBinding, uri); + } + + String correlationScheme = reader.getAttributeValue(null, "correlationScheme"); + if (correlationScheme != null && correlationScheme.length() > 0) { + if (VALID_CORRELATION_SCHEMES.contains(correlationScheme.toLowerCase())) { + jmsBinding.setCorrelationScheme(correlationScheme); + } else { + throw new LoaderException("invalid correlationScheme: " + correlationScheme); + } + } + + String initialContextFactory = reader.getAttributeValue(null, "initialContextFactory"); + if (initialContextFactory != null && initialContextFactory.length() > 0) { + jmsBinding.setInitialContextFactoryName(initialContextFactory); + } + + String jndiProviderURL = reader.getAttributeValue(null, "JNDIProviderURL"); + if (jndiProviderURL != null && jndiProviderURL.length() > 0) { + jmsBinding.setJNDIProviderURL(jndiProviderURL); + } + + while (true) { + switch (reader.next()) { + case START_ELEMENT: + String elementName = reader.getName().getLocalPart(); + if ("destination".equals(elementName)) { + parseDestination(reader, jmsBinding); + } else if ("connectionFactory".equals(elementName)) { + parseConnectionFactory(reader, jmsBinding); + } else if ("activationSpec".equals(elementName)) { + parseActivationSpec(reader, jmsBinding); + } else if ("response".equals(elementName)) { + parseResponse(reader, jmsBinding); + } else if ("headers".equals(elementName)) { + parseHeaders(reader, jmsBinding); + } else if ("operationAndDataBinding".equals(elementName)) { + parseOperationAndDataBinding(reader, jmsBinding); + } else if ("operation".equals(elementName)) { + parseOperation(reader, jmsBinding); + } else if ("resourceAdapter".equals(elementName)) { + parseResourceAdapter(reader, jmsBinding); + } + reader.next(); + break; + + case END_ELEMENT: + QName x = reader.getName(); + if (x.equals(BINDING_JMS)) { + return jmsBinding; + } + throw new RuntimeException("Incomplete binding.jms definition"); + } + } + } + + protected void parseActivationSpec(XMLStreamReader reader, JMSBindingDefinition jmsBinding) { + String name = reader.getAttributeValue(null, "name"); + if (name != null && name.length() > 0) { + jmsBinding.setActivationSpecName(name); + } else { + throw new RuntimeException("missing ActivationSpec name"); + } + } + + protected void parseConnectionFactory(XMLStreamReader reader, JMSBindingDefinition jmsBinding) { + String name = reader.getAttributeValue(null, "name"); + if (name != null && name.length() > 0) { + jmsBinding.setConnectionFactoryName(name); + } else { + throw new RuntimeException("missing connectionFactory name"); + } + } + + protected void parseResponse(XMLStreamReader reader, JMSBindingDefinition jmsBinding) { + // TODO Auto-generated method stub + + } + + protected void parseResourceAdapter(XMLStreamReader reader, JMSBindingDefinition jmsBinding) throws XMLStreamException { + // TODO Auto-generated method stub + } + + protected void parseOperation(XMLStreamReader reader, JMSBindingDefinition jmsBinding) throws XMLStreamException { + // TODO Auto-generated method stub + } + + protected void parseOperationAndDataBinding(XMLStreamReader reader, JMSBindingDefinition jmsBinding) + throws XMLStreamException { + String name = reader.getAttributeValue(null, "name"); + String use = reader.getAttributeValue(null, "use"); + if (name != null && name.length() > 0) { + if ("request".equalsIgnoreCase(use)) { + jmsBinding.setRequestOperationAndDatabindingName(name); + } else if ("response".equalsIgnoreCase(use)) { + jmsBinding.setResponseOperationAndDatabindingName(name); + } else { + jmsBinding.setRequestOperationAndDatabindingName(name); + jmsBinding.setResponseOperationAndDatabindingName(name); + } + } + } + + protected void parseHeaders(XMLStreamReader reader, JMSBindingDefinition jmsBinding) throws XMLStreamException { + // TODO Auto-generated method stub + } + + protected void parseDestination(XMLStreamReader reader, JMSBindingDefinition jmsBinding) throws XMLStreamException { + String name = reader.getAttributeValue(null, "name"); + if (name != null && name.length() > 0) { + jmsBinding.setDestinationName(name); + } + String type = reader.getAttributeValue(null, "type"); + if (type != null && type.length() > 0) { + if ("queue".equalsIgnoreCase(type)) { + jmsBinding.setDestinationType(JMSBindingDefinition.DESTINATION_TYPE_QUEUE); + } else if ("topic".equalsIgnoreCase("type")) { + jmsBinding.setDestinationType(JMSBindingDefinition.DESTINATION_TYPE_TOPIC); + } else { + throw new RuntimeException("invalid destination type: " + type); + } + } + String create = reader.getAttributeValue(null, "create"); + if (create != null && create.length() > 0) { + jmsBinding.setCreateDestination(create); + } + } + + protected void parseURI(JMSBindingDefinition jmsBinding, String uri) { + // TODO Auto-generated method stub + } +} diff --git a/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/JMSProxy.java b/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/JMSProxy.java new file mode 100644 index 0000000000..56e367eca2 --- /dev/null +++ b/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/JMSProxy.java @@ -0,0 +1,131 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.binding.jms;
+
+import java.lang.reflect.Method;
+
+import javax.jms.Destination;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageListener;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+import javax.naming.NamingException;
+
+import org.apache.tuscany.spi.model.Operation;
+import org.apache.tuscany.spi.wire.InboundWire;
+import org.apache.tuscany.spi.wire.Interceptor;
+import org.apache.tuscany.spi.wire.InvocationChain;
+import org.apache.tuscany.spi.wire.MessageImpl;
+
+public class JMSProxy implements MessageListener {
+
+ protected Method operationMethod;
+ protected JMSResourceFactory jmsResourceFactory;
+ protected OperationAndDataBinding requestOperationAndDataBinding;
+ protected OperationAndDataBinding responseOperationAndDataBinding;
+ protected InboundWire inboundWire;
+ protected String correlationScheme;
+
+ public JMSProxy(InboundWire inboundWire,
+ JMSResourceFactory jmsResourceFactory,
+ OperationAndDataBinding requestOperationAndDataBinding,
+ OperationAndDataBinding responseOperationAndDataBinding,
+ String correlationScheme) throws NamingException {
+
+ this.jmsResourceFactory = jmsResourceFactory;
+ this.requestOperationAndDataBinding = requestOperationAndDataBinding;
+ this.responseOperationAndDataBinding = responseOperationAndDataBinding;
+ this.inboundWire = inboundWire;
+ this.correlationScheme = correlationScheme;
+ }
+
+ public void onMessage(Message requestJMSMsg) {
+ try {
+ Object responsePayload = invokeService(requestJMSMsg);
+ sendReply(requestJMSMsg, responsePayload);
+ } catch (Exception e) {
+ sendFaultReply(requestJMSMsg, e);
+ }
+ }
+
+ protected Object invokeService(Message requestJMSMsg) throws JMSException {
+
+ String operationName = requestOperationAndDataBinding.getOperationName(requestJMSMsg);
+ Object requestPayload = requestOperationAndDataBinding.extractPayload(requestJMSMsg);
+
+ Operation op = (Operation)inboundWire.getServiceContract().getOperations().get(operationName);
+ InvocationChain chain = inboundWire.getInvocationChains().get(op);
+
+ org.apache.tuscany.spi.wire.Message tuscanyRequestMsg = new MessageImpl();
+ tuscanyRequestMsg.setTargetInvoker(chain.getTargetInvoker());
+ tuscanyRequestMsg.setBody(requestPayload);
+
+ org.apache.tuscany.spi.wire.Message tuscanyResponseMsg = null;
+
+ Interceptor headInterceptor = chain.getHeadInterceptor();
+ if (headInterceptor != null) {
+ tuscanyResponseMsg = headInterceptor.invoke(tuscanyRequestMsg);
+ }
+
+ // TODO: what if headInterceptor is null?
+
+ return tuscanyResponseMsg.getBody();
+ }
+
+ protected void sendReply(Message requestJMSMsg, Object responsePayload) {
+ try {
+
+ if (requestJMSMsg.getJMSReplyTo() == null) {
+ // assume no reply is expected
+ return;
+ }
+
+ Session session = jmsResourceFactory.createSession();
+ Message replyJMSMsg = responseOperationAndDataBinding.createJMSMessage(session, responsePayload);
+
+ replyJMSMsg.setJMSDeliveryMode(requestJMSMsg.getJMSDeliveryMode());
+ replyJMSMsg.setJMSPriority(requestJMSMsg.getJMSPriority());
+
+ if (correlationScheme == null || "RequestMsgIDToCorrelID".equalsIgnoreCase(correlationScheme)) {
+ replyJMSMsg.setJMSCorrelationID(requestJMSMsg.getJMSMessageID());
+ } else if ("RequestCorrelIDToCorrelID".equalsIgnoreCase(correlationScheme)) {
+ replyJMSMsg.setJMSCorrelationID(requestJMSMsg.getJMSCorrelationID());
+ }
+
+ Destination destination = requestJMSMsg.getJMSReplyTo();
+ MessageProducer producer = session.createProducer(destination);
+
+ producer.send(replyJMSMsg);
+
+ producer.close();
+ session.close();
+
+ } catch (JMSException e) {
+ throw new JMSBindingException(e);
+ } catch (NamingException e) {
+ throw new JMSBindingException(e);
+ }
+ }
+
+ protected void sendFaultReply(Message requestJMSMsg, Exception e) {
+ sendReply(requestJMSMsg, new JMSBindingException("exception invoking JMS service", e));
+ }
+
+}
diff --git a/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/JMSReferenceBinding.java b/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/JMSReferenceBinding.java new file mode 100644 index 0000000000..3aa0bf31eb --- /dev/null +++ b/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/JMSReferenceBinding.java @@ -0,0 +1,75 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.binding.jms;
+
+import javax.jms.Destination;
+import javax.xml.namespace.QName;
+
+import static org.osoa.sca.Version.XML_NAMESPACE_1_0;
+
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.extension.ReferenceBindingExtension;
+import org.apache.tuscany.spi.model.Operation;
+import org.apache.tuscany.spi.model.ServiceContract;
+import org.apache.tuscany.spi.wire.TargetInvoker;
+
+/**
+ * @version $Rev: 449970 $ $Date: 2006-09-26 06:05:35 -0400 (Tue, 26 Sep 2006) $
+ */
+public class JMSReferenceBinding extends ReferenceBindingExtension {
+ private static final QName BINDING_JMS = new QName(XML_NAMESPACE_1_0, "binding.jms");
+
+ protected JMSBindingDefinition jmsBinding;
+ protected JMSResourceFactory jmsResourceFactory;
+ protected OperationAndDataBinding requestOperationAndDataBinding;
+ protected OperationAndDataBinding responseOperationAndDataBinding;
+ protected Destination requestDest;
+ protected Destination replyDest;
+
+ public JMSReferenceBinding(String name,
+ CompositeComponent parent,
+ JMSBindingDefinition jmsBinding,
+ JMSResourceFactory jmsResourceFactory,
+ ServiceContract<?> bindingServiceContract,
+ OperationAndDataBinding requestOperationAndDataBinding,
+ OperationAndDataBinding responseOperationAndDataBinding,
+ Destination requestDest,
+ Destination replyDest) {
+
+ super(name, parent);
+ this.bindingServiceContract = bindingServiceContract;
+ this.jmsBinding = jmsBinding;
+ this.jmsResourceFactory = jmsResourceFactory;
+ this.requestOperationAndDataBinding = requestOperationAndDataBinding;
+ this.responseOperationAndDataBinding = responseOperationAndDataBinding;
+ this.requestDest = requestDest;
+ this.replyDest = replyDest;
+ }
+
+ public QName getBindingType() {
+ return BINDING_JMS;
+ }
+
+ public TargetInvoker createTargetInvoker(ServiceContract contract, Operation operation) {
+ return new JMSTargetInvoker(jmsResourceFactory, jmsBinding, operation.getName(),
+ requestOperationAndDataBinding, responseOperationAndDataBinding, requestDest,
+ replyDest);
+ }
+
+}
diff --git a/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/JMSResourceFactory.java b/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/JMSResourceFactory.java new file mode 100644 index 0000000000..dbc43a6d34 --- /dev/null +++ b/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/JMSResourceFactory.java @@ -0,0 +1,38 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.binding.jms;
+
+import javax.jms.Connection;
+import javax.jms.Destination;
+import javax.jms.JMSException;
+import javax.jms.Session;
+import javax.naming.NamingException;
+
+public interface JMSResourceFactory {
+
+ public abstract Connection getConnection() throws NamingException, JMSException;
+
+ public abstract Session createSession() throws JMSException, NamingException;
+
+ public abstract void startConnection() throws JMSException, NamingException;
+
+ public abstract void closeConnection() throws JMSException, NamingException;
+
+ public abstract Destination lookupDestination(String jndiName) throws NamingException;
+}
diff --git a/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/JMSServiceBinding.java b/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/JMSServiceBinding.java new file mode 100644 index 0000000000..16cf6efe39 --- /dev/null +++ b/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/JMSServiceBinding.java @@ -0,0 +1,100 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.binding.jms;
+
+import javax.jms.Destination;
+import javax.jms.JMSException;
+import javax.jms.MessageConsumer;
+import javax.jms.Session;
+import javax.naming.NamingException;
+import javax.xml.namespace.QName;
+
+import static org.osoa.sca.Version.XML_NAMESPACE_1_0;
+
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.extension.ServiceBindingExtension;
+import org.apache.tuscany.spi.model.ServiceContract;
+
+/**
+ * @version $Rev: 449970 $ $Date: 2006-09-26 06:05:35 -0400 (Tue, 26 Sep 2006) $
+ */
+public class JMSServiceBinding extends ServiceBindingExtension {
+ private static final QName BINDING_JMS = new QName(XML_NAMESPACE_1_0, "binding.jms");
+
+ private JMSBindingDefinition jmsBinding;
+ private JMSResourceFactory jmsResourceFactory;
+ private MessageConsumer consumer;
+ protected OperationAndDataBinding requestOperationAndDataBinding;
+ protected OperationAndDataBinding responseOperationAndDataBinding;
+
+ public JMSServiceBinding(String name,
+ CompositeComponent parent,
+ JMSBindingDefinition jmsBinding,
+ JMSResourceFactory jmsResourceFactory,
+ ServiceContract<?> serviceBindingContract,
+ OperationAndDataBinding requestOperationAndDataBinding,
+ OperationAndDataBinding responseOperationAndDataBinding,
+ Class<?> service) {
+ super(name, parent);
+
+ this.jmsBinding = jmsBinding;
+ this.jmsResourceFactory = jmsResourceFactory;
+ this.bindingServiceContract = serviceBindingContract;
+ this.requestOperationAndDataBinding = requestOperationAndDataBinding;
+ this.responseOperationAndDataBinding = responseOperationAndDataBinding;
+ }
+
+ public void start() {
+ super.start();
+ try {
+ registerListerner();
+ } catch (Exception e) {
+ throw new JMSBindingException("Error starting JMSServiceBinding", e);
+ }
+ }
+
+ public void stop() {
+
+ try {
+ consumer.close();
+ jmsResourceFactory.closeConnection();
+ } catch (Exception e) {
+ throw new JMSBindingException("Error stopping JMSServiceBinding", e);
+ }
+
+ super.stop();
+ }
+
+ private void registerListerner() throws NamingException, JMSException {
+
+ Session session = jmsResourceFactory.createSession();
+ Destination destination = session.createQueue(jmsBinding.getDestinationName());
+
+ consumer = session.createConsumer(destination);
+ consumer.setMessageListener(new JMSProxy(getInboundWire(), jmsResourceFactory, requestOperationAndDataBinding,
+ responseOperationAndDataBinding, jmsBinding.getCorrelationScheme()));
+
+ jmsResourceFactory.startConnection();
+
+ }
+
+ public QName getBindingType() {
+ return BINDING_JMS;
+ }
+}
diff --git a/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/JMSTargetInvoker.java b/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/JMSTargetInvoker.java new file mode 100644 index 0000000000..61e838c41a --- /dev/null +++ b/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/JMSTargetInvoker.java @@ -0,0 +1,119 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.binding.jms;
+
+import java.lang.reflect.InvocationTargetException;
+
+import javax.jms.Destination;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+import javax.naming.NamingException;
+
+import org.apache.tuscany.spi.extension.TargetInvokerExtension;
+
+/**
+ * Invoke a JMS reference.
+ */
+public class JMSTargetInvoker extends TargetInvokerExtension {
+
+ protected JMSBindingDefinition jmsBinding;
+ protected JMSResourceFactory jmsResourceFactory;
+
+ protected String operationName;
+ protected OperationAndDataBinding requestOperationAndDataBinding;
+ protected OperationAndDataBinding responseOperationAndDataBinding;
+
+ protected Destination requestDest;
+ protected Destination replyDest;
+
+ public JMSTargetInvoker(JMSResourceFactory jmsResourceFactory,
+ JMSBindingDefinition jmsBinding,
+ String operationName,
+ OperationAndDataBinding requestOperationAndDataBinding,
+ OperationAndDataBinding responseOperationAndDataBinding,
+ Destination requestDest,
+ Destination replyDest) {
+ super(null, null, null);
+ this.jmsBinding = jmsBinding;
+ this.jmsResourceFactory = jmsResourceFactory;
+ this.operationName = operationName;
+ this.requestOperationAndDataBinding = requestOperationAndDataBinding;
+ this.responseOperationAndDataBinding = responseOperationAndDataBinding;
+ this.requestDest = requestDest;
+ this.replyDest = replyDest;
+ }
+
+ public Object invokeTarget(Object payload, final short sequence) throws InvocationTargetException {
+ try {
+ Session session = jmsResourceFactory.createSession();
+ try {
+
+ Destination replyToDest = (replyDest != null) ? replyDest : session.createTemporaryQueue();
+ Message requestMsg = sendRequest((Object[])payload, session, replyToDest);
+ Message replyMsg = receiveReply(session, replyToDest, requestMsg.getJMSMessageID());
+
+ return responseOperationAndDataBinding.extractPayload(replyMsg);
+
+ } finally {
+ session.close();
+ }
+ } catch (JMSException e) {
+ throw new InvocationTargetException(e);
+ } catch (NamingException e) {
+ throw new InvocationTargetException(e);
+ }
+ }
+
+ protected Message sendRequest(Object[] payload, Session session, Destination replyToDest) throws JMSException {
+
+ Message requestMsg = requestOperationAndDataBinding.createJMSMessage(session, payload);
+
+ requestMsg.setJMSDeliveryMode(jmsBinding.getDeliveryMode());
+ requestMsg.setJMSPriority(jmsBinding.getPriority());
+
+ requestOperationAndDataBinding.setOperationName(operationName, requestMsg);
+ requestMsg.setJMSReplyTo(replyToDest);
+
+ MessageProducer producer = session.createProducer(requestDest);
+ try {
+ producer.send(requestMsg);
+ } finally {
+ producer.close();
+ }
+ return requestMsg;
+ }
+
+ protected Message receiveReply(Session session, Destination replyToDest, String requestMsgId) throws JMSException,
+ NamingException {
+ String msgSelector = "JMSCorrelationID = '" + requestMsgId + "'";
+ MessageConsumer consumer = session.createConsumer(replyToDest, msgSelector);
+ Message replyMsg;
+ try {
+ jmsResourceFactory.startConnection();
+ replyMsg = consumer.receive(jmsBinding.getTimeToLive());
+ } finally {
+ consumer.close();
+ }
+ return replyMsg;
+ }
+
+}
diff --git a/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/OperationAndDataBinding.java b/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/OperationAndDataBinding.java new file mode 100644 index 0000000000..9867f7d97b --- /dev/null +++ b/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/OperationAndDataBinding.java @@ -0,0 +1,49 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.binding.jms; + +import javax.jms.Message; +import javax.jms.Session; + +/** + * Interface for a component that does operation selection and message payload + * databinding + */ +public interface OperationAndDataBinding { + + /** + * Get the operation name from a JMS Message + */ + public abstract String getOperationName(Message message); + + /** + * Set the operation name on a JMS Message + */ + public abstract void setOperationName(String operationName, Message message); + + /** + * Extracts the payload from a JMS Message + */ + public abstract Object extractPayload(Message msg); + + /** + * Create a JMS Message containing the payload + */ + public abstract Message createJMSMessage(Session session, Object payload); +} diff --git a/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/SimpleJMSResourceFactory.java b/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/SimpleJMSResourceFactory.java new file mode 100644 index 0000000000..86cdfa272e --- /dev/null +++ b/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/SimpleJMSResourceFactory.java @@ -0,0 +1,114 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.binding.jms;
+
+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;
+
+public class SimpleJMSResourceFactory implements JMSResourceFactory {
+
+ private JMSBindingDefinition jmsBinding;
+ private Connection con;
+ private Context context;
+ private boolean isConnectionStarted;
+
+ public SimpleJMSResourceFactory(JMSBindingDefinition jmsBinding) {
+ this.jmsBinding = jmsBinding;
+ }
+
+ /*
+ * 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. For ex 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 Connection getConnection() throws NamingException, JMSException {
+ if (con == null) {
+ createConnection();
+ }
+ return con;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.tuscany.binding.jms.JMSResourceFactory#createSession()
+ */
+ public Session createSession() throws JMSException, NamingException {
+ return getConnection().createSession(false, Session.AUTO_ACKNOWLEDGE);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.tuscany.binding.jms.JMSResourceFactory#startConnection()
+ */
+ public void startConnection() throws JMSException, NamingException {
+ if (!isConnectionStarted) {
+ getConnection().start();
+ isConnectionStarted = true;
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.tuscany.binding.jms.JMSResourceFactory#closeConnection()
+ */
+ public void closeConnection() throws JMSException, NamingException {
+ if (con != null) {
+ con.close();
+ }
+ }
+
+ private void createConnection() throws NamingException, JMSException {
+ if (context == null) {
+ createInitialContext();
+ }
+ ConnectionFactory conFac = (ConnectionFactory)context.lookup(jmsBinding.getConnectionFactoryName());
+ con = conFac.createConnection();
+ }
+
+ private void createInitialContext() throws NamingException {
+ Properties props = new Properties();
+ props.setProperty(Context.INITIAL_CONTEXT_FACTORY, jmsBinding.getInitialContextFactoryName().trim());
+ props.setProperty(Context.PROVIDER_URL, jmsBinding.getJNDIProviderURL().trim());
+
+ context = new InitialContext(props);
+ }
+
+ public Destination lookupDestination(String jndiName) throws NamingException {
+ if (context == null) {
+ createInitialContext();
+ }
+ return (Destination)context.lookup(jndiName);
+ }
+
+}
diff --git a/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/databinding/AbstractJmsTransformer.java b/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/databinding/AbstractJmsTransformer.java new file mode 100644 index 0000000000..eb6e068462 --- /dev/null +++ b/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/databinding/AbstractJmsTransformer.java @@ -0,0 +1,100 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.binding.jms.databinding; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.io.ObjectStreamClass; + +import org.apache.tuscany.spi.databinding.DataBindingRegistry; +import org.apache.tuscany.spi.databinding.Mediator; +import org.apache.tuscany.spi.databinding.PullTransformer; +import org.apache.tuscany.spi.databinding.TransformationException; +import org.apache.tuscany.spi.databinding.extension.TransformerExtension; + +/** + * This is a special transformer to transform the input from one IDL to the + * other one + */ +public abstract class AbstractJmsTransformer<T> extends TransformerExtension<T, T> implements PullTransformer<T, T> { + + protected static final String IDL_INPUT = "idl:input"; + protected static final String JMS_INPUT = "jms:input"; + protected static final String IDL_OUTPUT = "idl:output"; + protected static final String JMS_OUTPUT = "jms:output"; + + protected DataBindingRegistry dataBindingRegistry; + + protected Mediator mediator; + + public AbstractJmsTransformer() { + super(); + } + + /** + * @see org.apache.tuscany.spi.databinding.Transformer#getWeight() + */ + public int getWeight() { + return 10; + } + + protected Object read(byte[] bytes) { + try { + ByteArrayInputStream bis = new ByteArrayInputStream(bytes); + ObjectInputStream ois = new ObjectInputStream(bis) { + + @Override + protected Class<?> resolveClass(ObjectStreamClass desc) throws IOException, ClassNotFoundException { + try { + return Class.forName(desc.getName(), false, this.getClass().getClassLoader()); + } catch (ClassNotFoundException e) { + return super.resolveClass(desc); + } + } + + }; + Object object = ois.readObject(); + ois.close(); + bis.close(); + + return object; + } catch (Exception e) { + throw new TransformationException(e); + } + } + + protected byte[] write(Object source) { + try { + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + ObjectOutputStream oos = new ObjectOutputStream(bos); + oos.writeObject(source); + oos.close(); + bos.close(); + return bos.toByteArray(); + } catch (IOException e) { + throw new TransformationException(e); + } + + } + +} diff --git a/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/databinding/Input2JmsInputTransformer.java b/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/databinding/Input2JmsInputTransformer.java new file mode 100644 index 0000000000..30add8e082 --- /dev/null +++ b/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/databinding/Input2JmsInputTransformer.java @@ -0,0 +1,68 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.binding.jms.databinding; + +import org.apache.tuscany.spi.databinding.TransformationContext; +import org.apache.tuscany.spi.databinding.Transformer; +import org.osoa.sca.annotations.Service; + +/** + * This is a special transformer to transform the input from one IDL to the + * other one + */ +@Service(Transformer.class) +public class Input2JmsInputTransformer extends AbstractJmsTransformer<Object[]> { + + public Input2JmsInputTransformer() { + super(); + } + + @Override + public String getSourceDataBinding() { + return IDL_INPUT; + } + + @Override + public String getTargetDataBinding() { + return JMS_INPUT; + } + + /** + * @see org.apache.tuscany.spi.databinding.extension.TransformerExtension#getSourceType() + */ + @Override + protected Class getSourceType() { + return Object[].class; + } + + /** + * @see org.apache.tuscany.spi.databinding.extension.TransformerExtension#getTargetType() + */ + @Override + protected Class getTargetType() { + return Object[].class; + } + + @SuppressWarnings("unchecked") + public Object[] transform(Object[] source, TransformationContext context) { + return new Object[] {write(source)}; + } + +} diff --git a/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/databinding/JmsInput2InputTransformer.java b/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/databinding/JmsInput2InputTransformer.java new file mode 100644 index 0000000000..65f84d1383 --- /dev/null +++ b/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/databinding/JmsInput2InputTransformer.java @@ -0,0 +1,67 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.binding.jms.databinding; + +import org.apache.tuscany.spi.databinding.TransformationContext; +import org.apache.tuscany.spi.databinding.Transformer; +import org.osoa.sca.annotations.Service; + +/** + * This is a special transformer to transform the input from one IDL to the + * other one + */ +@Service(Transformer.class) +public class JmsInput2InputTransformer extends AbstractJmsTransformer<Object[]> { + + public JmsInput2InputTransformer() { + super(); + } + + @Override + public String getSourceDataBinding() { + return JMS_INPUT; + } + + @Override + public String getTargetDataBinding() { + return IDL_INPUT; + } + + /** + * @see org.apache.tuscany.spi.databinding.extension.TransformerExtension#getSourceType() + */ + @Override + protected Class getSourceType() { + return Object[].class; + } + + /** + * @see org.apache.tuscany.spi.databinding.extension.TransformerExtension#getTargetType() + */ + @Override + protected Class getTargetType() { + return Object[].class; + } + + @SuppressWarnings("unchecked") + public Object[] transform(Object[] source, TransformationContext context) { + return (Object[])read((byte[])source[0]); + } +} diff --git a/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/databinding/JmsOutput2OutputTransformer.java b/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/databinding/JmsOutput2OutputTransformer.java new file mode 100644 index 0000000000..1696609743 --- /dev/null +++ b/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/databinding/JmsOutput2OutputTransformer.java @@ -0,0 +1,71 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.binding.jms.databinding; + +import org.apache.tuscany.spi.databinding.TransformationContext; +import org.apache.tuscany.spi.databinding.Transformer; +import org.osoa.sca.annotations.Service; + +/** + * This is a special transformer to transform the output from one IDL to the + * other one + */ +@Service(Transformer.class) +public class JmsOutput2OutputTransformer extends AbstractJmsTransformer<Object> { + + /** + * @param wrapperHandler + */ + public JmsOutput2OutputTransformer() { + super(); + } + + @Override + public String getSourceDataBinding() { + return JMS_OUTPUT; + } + + @Override + public String getTargetDataBinding() { + return IDL_OUTPUT; + } + + /** + * @see org.apache.tuscany.spi.databinding.extension.TransformerExtension#getSourceType() + */ + @Override + protected Class getSourceType() { + return Object.class; + } + + /** + * @see org.apache.tuscany.spi.databinding.extension.TransformerExtension#getTargetType() + */ + @Override + protected Class getTargetType() { + return Object.class; + } + + @SuppressWarnings("unchecked") + public Object transform(Object response, TransformationContext context) { + return read((byte[])response); + } + +} diff --git a/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/databinding/Output2JmsOutputTransformer.java b/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/databinding/Output2JmsOutputTransformer.java new file mode 100644 index 0000000000..5a82f912c5 --- /dev/null +++ b/sandbox/old/contrib/binding-jms/src/main/java/org/apache/tuscany/binding/jms/databinding/Output2JmsOutputTransformer.java @@ -0,0 +1,70 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.binding.jms.databinding; + +import org.apache.tuscany.spi.databinding.TransformationContext; +import org.apache.tuscany.spi.databinding.Transformer; +import org.osoa.sca.annotations.Service; + +/** + * This is a special transformer to transform the output from one IDL to the + * other one + */ +@Service(Transformer.class) +public class Output2JmsOutputTransformer extends AbstractJmsTransformer<Object> { + /** + * @param wrapperHandler + */ + public Output2JmsOutputTransformer() { + super(); + } + + @Override + public String getSourceDataBinding() { + return IDL_OUTPUT; + } + + @Override + public String getTargetDataBinding() { + return JMS_OUTPUT; + } + + /** + * @see org.apache.tuscany.spi.databinding.extension.TransformerExtension#getSourceType() + */ + @Override + protected Class getSourceType() { + return Object.class; + } + + /** + * @see org.apache.tuscany.spi.databinding.extension.TransformerExtension#getTargetType() + */ + @Override + protected Class getTargetType() { + return Object.class; + } + + @SuppressWarnings("unchecked") + public Object transform(Object response, TransformationContext context) { + return write(response); + } + +} diff --git a/sandbox/old/contrib/binding-jms/src/main/resources/META-INF/sca/default.scdl b/sandbox/old/contrib/binding-jms/src/main/resources/META-INF/sca/default.scdl new file mode 100644 index 0000000000..0c99331b4f --- /dev/null +++ b/sandbox/old/contrib/binding-jms/src/main/resources/META-INF/sca/default.scdl @@ -0,0 +1,52 @@ +<!--
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="org.apache.tuscany.binding.jms.JMSBinding">
+
+ <dependency xmlns="http://tuscany.apache.org/xmlns/1.0-SNAPSHOT">
+ <group>org.apache.tuscany.sca.extensions.jms</group>
+ <name>tuscany-jms</name>
+ <version>1.0-incubator-SNAPSHOT</version>
+ </dependency>
+
+ <component name="jms.bindingLoader">
+ <system:implementation.system class="org.apache.tuscany.binding.jms.JMSBindingLoader" />
+ </component>
+
+ <component name="jms.bindingBuilder">
+ <system:implementation.system class="org.apache.tuscany.binding.jms.JMSBindingBuilder" />
+ </component>
+
+ <!-- Transformers -->
+
+ <component name="transformer.JmsInput2InputTransformer">
+ <system:implementation.system class="org.apache.tuscany.binding.jms.databinding.JmsInput2InputTransformer" />
+ </component>
+
+ <component name="transformer.JmsOutput2OutputTransformer">
+ <system:implementation.system class="org.apache.tuscany.binding.jms.databinding.JmsOutput2OutputTransformer" />
+ </component>
+
+ <component name="transformer.Input2JmsInputTransformer">
+ <system:implementation.system class="org.apache.tuscany.binding.jms.databinding.Input2JmsInputTransformer" />
+ </component>
+
+ <component name="transformer.Output2JmsOutputTransformer">
+ <system:implementation.system class="org.apache.tuscany.binding.jms.databinding.Output2JmsOutputTransformer" />
+ </component>
+
+</composite>
diff --git a/sandbox/old/contrib/binding-jms/src/main/resources/META-INF/sca/jms.system.scdl b/sandbox/old/contrib/binding-jms/src/main/resources/META-INF/sca/jms.system.scdl new file mode 100644 index 0000000000..9f01162f5d --- /dev/null +++ b/sandbox/old/contrib/binding-jms/src/main/resources/META-INF/sca/jms.system.scdl @@ -0,0 +1,52 @@ +<!--
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="org.apache.tuscany.binding.jms.JMSBinding">
+
+ <dependency xmlns="http://tuscany.apache.org/xmlns/1.0-SNAPSHOT">
+ <group>org.apache.tuscany.sca.extensions.jms</group>
+ <name>tuscany-jms</name>
+ <version>1.0-incubator-SNAPSHOT</version>
+ </dependency>
+
+ <component name="jms.bindingLoader">
+ <system:implementation.system class="org.apache.tuscany.binding.jms.JMSBindingLoader" />
+ </component>
+
+ <component name="jms.bindingBuilder">
+ <system:implementation.system class="org.apache.tuscany.binding.jms.JMSBindingBuilder" />
+ </component>
+
+ <!-- Transformers -->
+
+ <component name="transformer.JmsInput2InputTransformer">
+ <system:implementation.system class="org.apache.tuscany.binding.jms.databinding.JmsInput2InputTransformer" />
+ </component>
+
+ <component name="transformer.JmsOutput2OutputTransformer">
+ <system:implementation.system class="org.apache.tuscany.binding.jms.databinding.JmsOutput2OutputTransformer" />
+ </component>
+
+ <component name="transformer.Input2JmsInputTransformer">
+ <system:implementation.system class="org.apache.tuscany.binding.jms.databinding.Input2JmsInputTransformer" />
+ </component>
+
+ <component name="transformer.Output2JmsOutputTransformer">
+ <system:implementation.system class="org.apache.tuscany.binding.jms.databinding.Output2JmsOutputTransformer" />
+ </component>
+
+</composite>
|