From 86f556b8a9314edd5a9095727bfe4e67a3aff163 Mon Sep 17 00:00:00 2001 From: antelder Date: Sun, 13 Jul 2008 09:02:10 +0000 Subject: No code changes, just format the code git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@676284 13f79535-47bb-0310-9956-ffa450edef68 --- .../jms/provider/AbstractMessageProcessor.java | 12 +- .../binding/jms/provider/JMSBindingInvoker.java | 149 +++++++++++---------- .../binding/jms/provider/JMSBindingListener.java | 42 +++--- .../jms/provider/JMSBindingProviderFactory.java | 8 +- .../JMSBindingReferenceBindingProvider.java | 8 +- .../provider/JMSBindingServiceBindingProvider.java | 90 ++++++------- .../binding/jms/provider/JMSMessageProcessor.java | 2 +- .../jms/provider/JMSMessageProcessorUtil.java | 4 +- .../binding/jms/provider/JMSResourceFactory.java | 33 +++-- .../jms/provider/ObjectMessageProcessor.java | 5 +- .../binding/jms/provider/TextMessageProcessor.java | 7 +- .../jms/provider/XMLTextMessageProcessor.java | 9 +- 12 files changed, 178 insertions(+), 191 deletions(-) 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 index 0b7de9f401..2fcb07a07f 100644 --- 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 @@ -30,7 +30,7 @@ import org.osoa.sca.ServiceRuntimeException; /** * Base MessageProcessor for the JMSBinding. - * + * * @version $Rev$ $Date$ */ public abstract class AbstractMessageProcessor implements JMSMessageProcessor { @@ -44,7 +44,7 @@ public abstract class AbstractMessageProcessor implements JMSMessageProcessor { /* * (non-Javadoc) - * + * * @see org.apache.tuscany.binding.jms.OperationAndDataBinding#getOperationName(javax.jms.Message) */ public String getOperationName(Message message) { @@ -59,7 +59,7 @@ public abstract class AbstractMessageProcessor implements JMSMessageProcessor { /* * (non-Javadoc) - * + * * @see org.apache.tuscany.binding.jms.OperationAndDataBinding#setOperationName(javax.jms.Message, java.lang.String) */ public void setOperationName(String operationName, Message message) { @@ -74,7 +74,7 @@ public abstract class AbstractMessageProcessor implements JMSMessageProcessor { /* * (non-Javadoc) - * + * * @see org.apache.tuscany.binding.jms.OperationAndDataBinding#extractPayload(javax.jms.Session, java.lang.Object) */ public Message insertPayloadIntoJMSMessage(Session session, Object o) { @@ -83,13 +83,13 @@ public abstract class AbstractMessageProcessor implements JMSMessageProcessor { /* * (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)) { - throw new ServiceRuntimeException("remote service exception, see nested exception",(Throwable)((ObjectMessage)msg).getObject()); + throw new ServiceRuntimeException("remote service exception, see nested exception", (Throwable)((ObjectMessage)msg).getObject()); } } 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/JMSBindingInvoker.java b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingInvoker.java index a94df5a166..1c79c973fd 100644 --- a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingInvoker.java +++ b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingInvoker.java @@ -68,19 +68,19 @@ public class JMSBindingInvoker implements Invoker, DataExchangeSemantics { this.reference = reference; this.requestMessageProcessor = JMSMessageProcessorUtil.getRequestMessageProcessor(jmsBinding); this.responseMessageProcessor = JMSMessageProcessorUtil.getResponseMessageProcessor(jmsBinding); - + try { requestDest = lookupDestination(); replyDest = lookupResponseDestination(); - + } catch (NamingException e) { throw new JMSBindingException(e); } } - /** + /** * Looks up the Destination Queue for the JMS Binding * * @return The Destination Queue @@ -116,18 +116,19 @@ public class JMSBindingInvoker implements Invoker, DataExchangeSemantics { * See the SCA JMS Binding specification for more information. *

* - * @param isReponseQueue true if we are creating a response queue. false if we are - * creating a request queue + * @param isReponseQueue true if we are creating a response queue. + * false 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 + * @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 "; @@ -140,7 +141,7 @@ public class JMSBindingInvoker implements Invoker, DataExchangeSemantics { queueType = "JMS Destination "; qCreateMode = jmsBinding.getDestinationCreate(); } - + Destination dest = jmsResourceFactory.lookupDestination(queueName); if (qCreateMode.equals(JMSBindingConstants.CREATE_ALWAYS)) { @@ -189,7 +190,7 @@ public class JMSBindingInvoker implements Invoker, DataExchangeSemantics { public org.apache.tuscany.sca.invocation.Message invoke(org.apache.tuscany.sca.invocation.Message tuscanyMsg) { try { - + Object resp = invokeTarget(tuscanyMsg); tuscanyMsg.setBody(resp); @@ -237,21 +238,22 @@ public class JMSBindingInvoker implements Invoker, DataExchangeSemantics { } } - protected Destination getReplyToDestination(Session session) throws JMSException, JMSBindingException, NamingException { - Destination replyToDest; - if (operation.isNonBlocking()) { - replyToDest = null; - } else { - if (replyDest != null) { - replyToDest = replyDest; - } else { - replyToDest = session.createTemporaryQueue(); - } - } - return replyToDest; - } - - protected Message sendRequest(org.apache.tuscany.sca.invocation.Message tuscanyMsg, Session session, Destination replyToDest) throws JMSException, JMSBindingException, NamingException { + protected Destination getReplyToDestination(Session session) throws JMSException, JMSBindingException, NamingException { + Destination replyToDest; + if (operation.isNonBlocking()) { + replyToDest = null; + } else { + if (replyDest != null) { + replyToDest = replyDest; + } else { + replyToDest = session.createTemporaryQueue(); + } + } + return replyToDest; + } + + protected Message sendRequest(org.apache.tuscany.sca.invocation.Message tuscanyMsg, Session session, Destination replyToDest) throws JMSException, JMSBindingException, + NamingException { Message requestMsg = requestMessageProcessor.insertPayloadIntoJMSMessage(session, tuscanyMsg.getBody()); @@ -264,8 +266,8 @@ public class JMSBindingInvoker implements Invoker, DataExchangeSemantics { requestMsg.setJMSReplyTo(replyToDest); Destination requestDest = getRequestDestination(tuscanyMsg, session); - - MessageProducer producer = session.createProducer(requestDest); + + MessageProducer producer = session.createProducer(requestDest); try { producer.send(requestMsg); } finally { @@ -275,52 +277,51 @@ public class JMSBindingInvoker implements Invoker, DataExchangeSemantics { } protected Destination getRequestDestination(org.apache.tuscany.sca.invocation.Message tuscanyMsg, Session session) throws JMSBindingException, NamingException, JMSException { - Destination requestDestination; - if (reference.isCallback()) { - String toURI = tuscanyMsg.getTo().getURI(); - if (toURI != null && toURI.startsWith("jms:")) { - // the msg to uri contains the callback destination name - // this is an jms physical name not a jndi name so need to use session.createQueue - requestDestination = session.createQueue(toURI.substring(4)); - } else { - requestDestination = lookupDestination(); - } - } else { - requestDestination = requestDest; - } - - return requestDestination; - } - - protected void setCallbackHeaders(org.apache.tuscany.sca.invocation.Message tuscanyMsg, Message jmsMsg) throws JMSException { - if (hasCallback()) { - - ReferenceParameters parameters = tuscanyMsg.getFrom().getReferenceParameters(); - - if (parameters.getCallbackID() != null) { - jmsMsg.setStringProperty(JMSBindingConstants.CALLBACK_ID_PROPERTY, parameters.getCallbackID().toString()); - } - - String callbackDestName = getCallbackDestinationName(reference); - if (callbackDestName != null) { - jmsMsg.setStringProperty(JMSBindingConstants.CALLBACK_Q_PROPERTY, callbackDestName); - } - - } - } - - protected boolean hasCallback() { - if (operation.getInterface() instanceof JavaInterface) { - JavaInterface jiface = (JavaInterface) operation.getInterface(); - if (jiface.getCallbackClass() != null) { - return true; - } - } - return false; - } - - protected Message receiveReply(Session session, Destination replyToDest, String requestMsgId) throws JMSException, - NamingException { + Destination requestDestination; + if (reference.isCallback()) { + String toURI = tuscanyMsg.getTo().getURI(); + if (toURI != null && toURI.startsWith("jms:")) { + // the msg to uri contains the callback destination name + // this is an jms physical name not a jndi name so need to use session.createQueue + requestDestination = session.createQueue(toURI.substring(4)); + } else { + requestDestination = lookupDestination(); + } + } else { + requestDestination = requestDest; + } + + return requestDestination; + } + + protected void setCallbackHeaders(org.apache.tuscany.sca.invocation.Message tuscanyMsg, Message jmsMsg) throws JMSException { + if (hasCallback()) { + + ReferenceParameters parameters = tuscanyMsg.getFrom().getReferenceParameters(); + + if (parameters.getCallbackID() != null) { + jmsMsg.setStringProperty(JMSBindingConstants.CALLBACK_ID_PROPERTY, parameters.getCallbackID().toString()); + } + + String callbackDestName = getCallbackDestinationName(reference); + if (callbackDestName != null) { + jmsMsg.setStringProperty(JMSBindingConstants.CALLBACK_Q_PROPERTY, callbackDestName); + } + + } + } + + protected boolean hasCallback() { + if (operation.getInterface() instanceof JavaInterface) { + JavaInterface jiface = (JavaInterface)operation.getInterface(); + if (jiface.getCallbackClass() != null) { + return true; + } + } + return false; + } + + protected Message receiveReply(Session session, Destination replyToDest, String requestMsgId) throws JMSException, NamingException { String msgSelector = "JMSCorrelationID = '" + requestMsgId + "'"; MessageConsumer consumer = session.createConsumer(replyToDest, msgSelector); Message replyMsg; @@ -335,7 +336,7 @@ public class JMSBindingInvoker implements Invoker, DataExchangeSemantics { } return replyMsg; } - + protected String getCallbackDestinationName(RuntimeComponentReference reference) { RuntimeComponentService s = (RuntimeComponentService)reference.getCallbackService(); JMSBinding b = s.getBinding(JMSBinding.class); diff --git a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingListener.java b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingListener.java index 1f47cc8fb9..f04ef38f26 100644 --- a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingListener.java +++ b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingListener.java @@ -45,7 +45,7 @@ import org.apache.tuscany.sca.runtime.RuntimeComponentService; /** * Listener for the JMSBinding. - * + * * @version $Rev$ $Date$ */ public class JMSBindingListener implements MessageListener { @@ -60,9 +60,7 @@ public class JMSBindingListener implements MessageListener { private JMSMessageProcessor responseMessageProcessor; private String correlationScheme; - public JMSBindingListener(JMSBinding jmsBinding, - JMSResourceFactory jmsResourceFactory, - RuntimeComponentService service) throws NamingException { + public JMSBindingListener(JMSBinding jmsBinding, JMSResourceFactory jmsResourceFactory, RuntimeComponentService service) throws NamingException { this.jmsBinding = jmsBinding; this.jmsResourceFactory = jmsResourceFactory; this.service = service; @@ -121,8 +119,7 @@ public class JMSBindingListener implements MessageListener { } if (operation == null) { - throw new JMSBindingException("Can't find operation " + (operationName != null ? operationName - : ON_MESSAGE_METHOD_NAME)); + throw new JMSBindingException("Can't find operation " + (operationName != null ? operationName : ON_MESSAGE_METHOD_NAME)); } MessageImpl tuscanyMsg = new MessageImpl(); @@ -134,38 +131,41 @@ public class JMSBindingListener implements MessageListener { return service.getRuntimeWire(jmsBinding).invoke(operation, tuscanyMsg); } - protected void setCallbackProperties(Message requestJMSMsg, MessageImpl tuscanyMsg, Operation operation) throws JMSException { - if (service.getInterfaceContract().getCallbackInterface() != null) { + protected void setCallbackProperties(Message requestJMSMsg, MessageImpl tuscanyMsg, Operation operation) throws JMSException { + if (service.getInterfaceContract().getCallbackInterface() != null) { + + EndpointReference from = new EndpointReferenceImpl(null); + tuscanyMsg.setFrom(from); + + from.setCallbackEndpoint(new EndpointReferenceImpl("/")); // TODO: + // whats + // this + // for? - EndpointReference from = new EndpointReferenceImpl(null); - tuscanyMsg.setFrom(from); - - from.setCallbackEndpoint(new EndpointReferenceImpl("/")); // TODO: whats this for? - ReferenceParameters parameters = from.getReferenceParameters(); - + String callbackdestName = requestJMSMsg.getStringProperty(JMSBindingConstants.CALLBACK_Q_PROPERTY); if (callbackdestName == null && operation.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 + // 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 = requestJMSMsg.getJMSReplyTo(); if (replyTo != null) { - callbackdestName = (replyTo instanceof Queue) ? ((Queue)replyTo).getQueueName() : ((Topic)replyTo).getTopicName(); + 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 + // 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 = requestJMSMsg.getStringProperty(JMSBindingConstants.CALLBACK_ID_PROPERTY); + String callbackID = requestJMSMsg.getStringProperty(JMSBindingConstants.CALLBACK_ID_PROPERTY); if (callbackID != null) { parameters.setCallbackID(callbackID); } } - } + } protected void sendReply(Message requestJMSMsg, Object responsePayload, boolean isFault) { try { 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 index 57fc0e1230..5afe0abf34 100644 --- 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 @@ -44,15 +44,11 @@ public class JMSBindingProviderFactory implements BindingProviderFactory jmsBindingInvokers = new ArrayList(); private JMSResourceFactory jmsResourceFactory; - public JMSBindingReferenceBindingProvider(RuntimeComponent component, - RuntimeComponentReference reference, - JMSBinding binding) { + public JMSBindingReferenceBindingProvider(RuntimeComponent component, RuntimeComponentReference reference, JMSBinding binding) { this.reference = reference; this.jmsBinding = binding; jmsResourceFactory = new JMSResourceFactory(binding.getConnectionFactoryName(), binding.getInitialContextFactoryName(), binding.getJndiURL()); @@ -77,9 +75,9 @@ public class JMSBindingReferenceBindingProvider implements ReferenceBindingProvi public Invoker createInvoker(Operation operation) { if (jmsBinding.getDestinationName().equals(JMSBindingConstants.DEFAULT_DESTINATION_NAME)) { - if (!reference.isCallback()) { + if (!reference.isCallback()) { throw new JMSBindingException("No destination specified for reference " + reference.getName()); - } + } } JMSBindingInvoker invoker = new JMSBindingInvoker(jmsBinding, operation, jmsResourceFactory, reference); 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 index b21ae81cc4..5881b37b7c 100644 --- 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 @@ -56,12 +56,9 @@ public class JMSBindingServiceBindingProvider implements ServiceBindingProvider private WorkScheduler workScheduler; private boolean running; - private Destination destination; + private Destination destination; - public JMSBindingServiceBindingProvider(RuntimeComponent component, - RuntimeComponentService service, - JMSBinding binding, - WorkScheduler workScheduler) { + public JMSBindingServiceBindingProvider(RuntimeComponent component, RuntimeComponentService service, JMSBinding binding, WorkScheduler workScheduler) { this.service = service; this.jmsBinding = binding; this.workScheduler = workScheduler; @@ -69,10 +66,10 @@ public class JMSBindingServiceBindingProvider implements ServiceBindingProvider jmsResourceFactory = new JMSResourceFactory(binding.getConnectionFactoryName(), binding.getInitialContextFactoryName(), binding.getJndiURL()); if (jmsBinding.getDestinationName().equals(JMSBindingConstants.DEFAULT_DESTINATION_NAME)) { - if (!service.isCallback()) { + if (!service.isCallback()) { // use the SCA service name as the default destination name jmsBinding.setDestinationName(service.getName()); - } + } } if (XMLTextMessageProcessor.class.isAssignableFrom(JMSMessageProcessorUtil.getRequestMessageProcessor(jmsBinding).getClass())) { @@ -130,9 +127,7 @@ public class JMSBindingServiceBindingProvider implements ServiceBindingProvider Session session = jmsResourceFactory.createSession(); destination = lookupDestinationQueue(); if (destination == null) { - // TODO: temporary callback queues don't work yet as i can't see how to get the - // serice side to look up the temporary destination name - destination = session.createTemporaryQueue(); + destination = session.createTemporaryQueue(); } consumer = session.createConsumer(destination); @@ -144,7 +139,7 @@ public class JMSBindingServiceBindingProvider implements ServiceBindingProvider jmsResourceFactory.startConnection(); } catch (javax.jms.IllegalStateException e) { - + // setMessageListener not allowed in JEE container so use Tuscany threads jmsResourceFactory.startConnection(); @@ -152,25 +147,28 @@ public class JMSBindingServiceBindingProvider implements ServiceBindingProvider 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(); - } - }}); + 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 " + (service.isCallback() ? "callback service" : "service") + - " '" + service.getName() + "' listening on destination " + - ((destination instanceof Queue) ? ((Queue)destination).getQueueName() : ((Topic)destination).getTopicName())); + logger.log(Level.INFO, "JMS " + (service.isCallback() ? "callback service" : "service") + + " '" + + service.getName() + + "' listening on destination " + + ((destination instanceof Queue) ? ((Queue)destination).getQueueName() : ((Topic)destination).getTopicName())); } /** @@ -187,19 +185,17 @@ public class JMSBindingServiceBindingProvider implements ServiceBindingProvider * * @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 + * @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 (service.isCallback() && JMSBindingConstants.DEFAULT_DESTINATION_NAME.equals(jmsBinding.getDestinationName())) { - // if its a callback service returning null indicates to use a temporary queue - // TODO: temporary callback queues don't work yet as i can't see how to get the - // serice side to look up the temporary destination name - return null; - } - Destination destination = jmsResourceFactory.lookupDestination(jmsBinding.getDestinationName()); + if (service.isCallback() && JMSBindingConstants.DEFAULT_DESTINATION_NAME.equals(jmsBinding.getDestinationName())) { + // 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)) { @@ -246,18 +242,18 @@ public class JMSBindingServiceBindingProvider implements ServiceBindingProvider 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); - } + 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/provider/JMSMessageProcessor.java b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSMessageProcessor.java index 733cebacac..821b9d7873 100644 --- 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 @@ -23,7 +23,7 @@ import javax.jms.Session; /** * Interface for a component that does operation selection and message payload processing - * + * * @version $Rev$ $Date$ */ public interface JMSMessageProcessor { 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 index 4a757a5c50..62133b1697 100644 --- 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 @@ -26,13 +26,13 @@ import org.apache.tuscany.sca.binding.jms.impl.JMSBindingException; /** * Utility methods to load JMS message processors. - * + * * @version $Rev: $ $Date: $ */ public class JMSMessageProcessorUtil { /** - * Used to create instances of the JMSResourceFactory and RequestMessageProcessor and ResponseMessageProcessor from + * Used to create instances of the JMSResourceFactory and RequestMessageProcessor and ResponseMessageProcessor from * string based class name provided in the configuration * * @param cl ClassLoader 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 index 9b5e8e64b9..e4a403e0b2 100644 --- 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 @@ -33,7 +33,7 @@ import org.apache.tuscany.sca.binding.jms.impl.JMSBindingException; /** * Abstracts away any JMS provide specific feature from the JMS binding - * + * * @version $Rev$ $Date$ */ public class JMSResourceFactory { @@ -60,7 +60,7 @@ public class 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 + * 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() @@ -115,7 +115,7 @@ public class JMSResourceFactory { private synchronized Context getInitialContext() throws NamingException { if (context == null) { Properties props = new Properties(); - + if (initialContextFactoryName != null) { props.setProperty(Context.INITIAL_CONTEXT_FACTORY, initialContextFactoryName); } @@ -132,30 +132,29 @@ public class JMSResourceFactory { /** * 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 + * environment property needs to be set to initialize the ORB correctly. + * See: http://www-1.ibm.com/support/docview.wss?uid=swg24012804 */ private 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"); - } - } - } - - public Destination lookupDestination(String jndiName) throws NamingException { + 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"); + } + } + } + + public Destination lookupDestination(String jndiName) throws NamingException { return (Destination)jndiLookUp(jndiName); } /** - * 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 + * 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 Destination createDestination(String jndiName) throws NamingException { return lookupDestination("dynamicQueues/" + jndiName); } - + protected Object jndiLookUp(String name) { Object o = null; try { 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 index e63c1ec19b..bfcc39daaa 100644 --- 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 @@ -29,9 +29,8 @@ import org.apache.tuscany.sca.binding.jms.impl.JMSBinding; import org.apache.tuscany.sca.binding.jms.impl.JMSBindingException; /** - * MessageProcessor for sending/receiving Serializable objects with - * the JMSBinding. - * + * MessageProcessor for sending/receiving Serializable objects with the JMSBinding. + * * @version $Rev$ $Date$ */ public class ObjectMessageProcessor extends AbstractMessageProcessor { 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 index cf9f6ce88b..d8490c6223 100644 --- 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 @@ -27,9 +27,8 @@ import org.apache.tuscany.sca.binding.jms.impl.JMSBinding; import org.apache.tuscany.sca.binding.jms.impl.JMSBindingException; /** - * MessageProcessor for sending/receiving javax.jms.TextMessage with - * the JMSBinding. - * + * MessageProcessor for sending/receiving javax.jms.TextMessage with the JMSBinding. + * * @version $Rev$ $Date$ */ public class TextMessageProcessor extends AbstractMessageProcessor { @@ -46,7 +45,7 @@ public class TextMessageProcessor extends AbstractMessageProcessor { throw new IllegalStateException("expecting JMS TextMessage: " + msg); } - return new Object[]{((TextMessage)msg).getText()}; + return new Object[] {((TextMessage)msg).getText()}; } 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/XMLTextMessageProcessor.java b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/XMLTextMessageProcessor.java index 8f4237b4bf..88dd41cc57 100644 --- 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 @@ -34,9 +34,8 @@ import org.apache.tuscany.sca.binding.jms.impl.JMSBinding; import org.apache.tuscany.sca.binding.jms.impl.JMSBindingException; /** - * MessageProcessor for sending/receiving XML javax.jms.TextMessage with - * the JMSBinding. - * + * MessageProcessor for sending/receiving XML javax.jms.TextMessage with the JMSBinding. + * * @version $Rev$ $Date$ */ public class XMLTextMessageProcessor extends AbstractMessageProcessor { @@ -54,9 +53,9 @@ public class XMLTextMessageProcessor extends AbstractMessageProcessor { if (xml != null) { XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(new StringReader(xml)); StAXOMBuilder builder = new StAXOMBuilder(reader); - os = new Object[] { builder.getDocumentElement() }; + os = new Object[] {builder.getDocumentElement()}; } else { - os = new Object[]{}; + os = new Object[] {}; } return os; -- cgit v1.2.3