You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by an...@apache.org on 2006/12/20 18:56:09 UTC

svn commit: r489160 - /incubator/tuscany/java/sca/services/bindings/binding.jms/src/main/java/org/apache/tuscany/binding/jms/JMSProxy.java

Author: antelder
Date: Wed Dec 20 09:56:08 2006
New Revision: 489160

URL: http://svn.apache.org/viewvc?view=rev&rev=489160
Log:
Formatting, no code changes 

Modified:
    incubator/tuscany/java/sca/services/bindings/binding.jms/src/main/java/org/apache/tuscany/binding/jms/JMSProxy.java

Modified: incubator/tuscany/java/sca/services/bindings/binding.jms/src/main/java/org/apache/tuscany/binding/jms/JMSProxy.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/services/bindings/binding.jms/src/main/java/org/apache/tuscany/binding/jms/JMSProxy.java?view=diff&rev=489160&r1=489159&r2=489160
==============================================================================
--- incubator/tuscany/java/sca/services/bindings/binding.jms/src/main/java/org/apache/tuscany/binding/jms/JMSProxy.java (original)
+++ incubator/tuscany/java/sca/services/bindings/binding.jms/src/main/java/org/apache/tuscany/binding/jms/JMSProxy.java Wed Dec 20 09:56:08 2006
@@ -34,73 +34,73 @@
 import org.apache.tuscany.spi.wire.InvocationChain;
 import org.apache.tuscany.spi.wire.MessageImpl;
 
-public class JMSProxy implements MessageListener{
-	
-	protected Method operationMethod;
-    private JMSResourceFactory jmsResourceFactory; 
-	private OperationSelector operationSelector;
-	private InboundWire inboundWire;
-    
-	public JMSProxy(InboundWire inboundWire,JMSResourceFactory jmsResourceFactory,OperationSelector operationSelector) throws NamingException{		
-		
-		this.jmsResourceFactory = jmsResourceFactory;
-		this.operationSelector = operationSelector;
-		this.inboundWire = inboundWire;
-	}   
-
-	public void onMessage(Message msg){
-		
-		
-        try{        
-			        	
-			String operationName = operationSelector.getOperationName(msg);
-			Operation op = (Operation) inboundWire.getServiceContract().getOperations().get(operationName);
-			
-		    InvocationChain chain = inboundWire.getInvocationChains().get(op);
-		    Interceptor headInterceptor = chain.getHeadInterceptor();		    
-		    
-		    org.apache.tuscany.spi.wire.Message tuscanyMsg = new MessageImpl();
-                    Object payload = jmsResourceFactory.getMessagePayload(msg);
-		    tuscanyMsg.setBody(payload);
-		    tuscanyMsg.setTargetInvoker(chain.getTargetInvoker());
-		    org.apache.tuscany.spi.wire.Message tuscanyResMsg = null;
-		    
-		    if (headInterceptor != null){
-		    	tuscanyResMsg = headInterceptor.invoke(tuscanyMsg);
-		    }
-		    	        
-		    // if result is null then the method can be assumed as oneway
-		    if (tuscanyResMsg != null && tuscanyResMsg.getBody() != null){
-                        
-		    	sendReply(msg,operationName, tuscanyResMsg);
-		    }
-
-		} catch (JMSBindingException e) {
-			throw new JMSBindingRuntimeException(e);
-		} catch (JMSException e) {
-			throw new JMSBindingRuntimeException(e);
-		} catch (NamingException e) {
-			throw new JMSBindingRuntimeException(e);
-                } catch (Exception e) {
-                    // TODO: need to not swallow these exceptions
-                    e.printStackTrace();
-                    throw new JMSBindingRuntimeException(e);
-                }
-                
-	}
-
-
-	private void sendReply(Message reqMsg,String operationName,org.apache.tuscany.spi.wire.Message tuscanyResMsg) throws JMSException, NamingException{
-        
-		Session session = jmsResourceFactory.createSession();
+public class JMSProxy implements MessageListener {
+
+    protected Method operationMethod;
+    private JMSResourceFactory jmsResourceFactory;
+    private OperationSelector operationSelector;
+    private InboundWire inboundWire;
+
+    public JMSProxy(InboundWire inboundWire, JMSResourceFactory jmsResourceFactory, OperationSelector operationSelector)
+        throws NamingException {
+
+        this.jmsResourceFactory = jmsResourceFactory;
+        this.operationSelector = operationSelector;
+        this.inboundWire = inboundWire;
+    }
+
+    public void onMessage(Message msg) {
+
+        try {
+
+            String operationName = operationSelector.getOperationName(msg);
+            Operation op = (Operation)inboundWire.getServiceContract().getOperations().get(operationName);
+
+            InvocationChain chain = inboundWire.getInvocationChains().get(op);
+            Interceptor headInterceptor = chain.getHeadInterceptor();
+
+            org.apache.tuscany.spi.wire.Message tuscanyMsg = new MessageImpl();
+            Object payload = jmsResourceFactory.getMessagePayload(msg);
+            tuscanyMsg.setBody(payload);
+            tuscanyMsg.setTargetInvoker(chain.getTargetInvoker());
+            org.apache.tuscany.spi.wire.Message tuscanyResMsg = null;
+
+            if (headInterceptor != null) {
+                tuscanyResMsg = headInterceptor.invoke(tuscanyMsg);
+            }
+
+            // if result is null then the method can be assumed as oneway
+            if (tuscanyResMsg != null && tuscanyResMsg.getBody() != null) {
+
+                sendReply(msg, operationName, tuscanyResMsg);
+            }
+
+        } catch (JMSBindingException e) {
+            throw new JMSBindingRuntimeException(e);
+        } catch (JMSException e) {
+            throw new JMSBindingRuntimeException(e);
+        } catch (NamingException e) {
+            throw new JMSBindingRuntimeException(e);
+        } catch (Exception e) {
+            // TODO: need to not swallow these exceptions
+            e.printStackTrace();
+            throw new JMSBindingRuntimeException(e);
+        }
+
+    }
+
+    private void sendReply(Message reqMsg, String operationName, org.apache.tuscany.spi.wire.Message tuscanyResMsg)
+        throws JMSException, NamingException {
+
+        Session session = jmsResourceFactory.createSession();
 
         Message message = jmsResourceFactory.createMessage(session, tuscanyResMsg.getBody());
-    	
-    	Destination destination = reqMsg.getJMSReplyTo();
-        
+
+        Destination destination = reqMsg.getJMSReplyTo();
+
         MessageProducer producer = session.createProducer(destination);
         producer.send(message);
         producer.close();
         session.close();
-	}
+    }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org