servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r391653 - in /incubator/servicemix/trunk: servicemix-components/src/main/java/org/apache/servicemix/components/activesoap/ servicemix-components/src/main/java/org/apache/servicemix/components/drools/ servicemix-components/src/main/java/org/...
Date Wed, 05 Apr 2006 15:58:37 GMT
Author: gnodet
Date: Wed Apr  5 08:58:31 2006
New Revision: 391653

URL: http://svn.apache.org/viewcvs?rev=391653&view=rev
Log:
SM-385: implify writing lighweight components inheriting the o.a.s.components.util.OutBinding

Modified:
    incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/activesoap/ASInOutBinding.java
    incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/activesoap/ASOutBinding.java
    incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/drools/DroolsComponent.java
    incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/email/MimeMailSender.java
    incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/email/SimpleMailSender.java
    incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/file/FileWriter.java
    incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/jabber/JabberChatSender.java
    incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/jabber/JabberGroupChatSender.java
    incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/jabber/JabberReceiver.java
    incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/jaxrpc/JaxRpcInBinding.java
    incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/jms/JmsSenderComponent.java
    incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/net/FTPSender.java
    incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/reflection/ReflectionOutBinding.java
    incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/rss/FeedWriter.java
    incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/vfs/FileWriter.java
    incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/wsif/WSIFOperationMap.java
    incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/wsif/WSIFOutBinding.java
    incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/xfire/XFireBinding.java
    incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/xfire/XFireOutBinding.java
    incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/components/util/OutBinding.java
    incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/components/util/StreamWriterComponent.java

Modified: incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/activesoap/ASInOutBinding.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/activesoap/ASInOutBinding.java?rev=391653&r1=391652&r2=391653&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/activesoap/ASInOutBinding.java (original)
+++ incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/activesoap/ASInOutBinding.java Wed Apr  5 08:58:31 2006
@@ -17,11 +17,8 @@
 
 import java.io.StringWriter;
 
-import javax.jbi.messaging.ExchangeStatus;
 import javax.jbi.messaging.MessageExchange;
-import javax.jbi.messaging.MessagingException;
 import javax.jbi.messaging.NormalizedMessage;
-import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
 import javax.xml.stream.XMLStreamWriter;
 
@@ -53,33 +50,22 @@
 
     // Implementation methods
     //-------------------------------------------------------------------------
-    protected void process(MessageExchange messageExchange, NormalizedMessage inMessage) throws MessagingException {
-        try {
+    protected void process(MessageExchange messageExchange, NormalizedMessage inMessage) throws Exception {
+        XMLStreamReader in = marshaler.createStreamReader(inMessage);
 
-            XMLStreamReader in = marshaler.createStreamReader(inMessage);
+        StringWriter buffer = new StringWriter();
+        XMLStreamWriter out = marshaler.createStreamWriter(buffer);
 
-            StringWriter buffer = new StringWriter();
-            XMLStreamWriter out = marshaler.createStreamWriter(buffer);
+        org.codehaus.activesoap.MessageExchange asExchange = service.createMessageExchange(in, out);
+        marshaler.fromNMS(asExchange, inMessage);
 
-            org.codehaus.activesoap.MessageExchange asExchange = service.createMessageExchange(in, out);
-            marshaler.fromNMS(asExchange, inMessage);
-
-            service.invoke(asExchange);
-
-            NormalizedMessage outMessage = messageExchange.createMessage();
-
-            marshaler.setContent(outMessage, buffer.toString());
-            marshaler.toNMS(outMessage, asExchange);
-
-            answer(messageExchange, outMessage);
-        }
-        catch (XMLStreamException e) {
-            messageExchange.setError(e);
-            messageExchange.setStatus(ExchangeStatus.ERROR);
-        }
-        catch (Exception e) {
-            messageExchange.setError(e);
-            messageExchange.setStatus(ExchangeStatus.ERROR);
-        }
+        service.invoke(asExchange);
+
+        NormalizedMessage outMessage = messageExchange.createMessage();
+
+        marshaler.setContent(outMessage, buffer.toString());
+        marshaler.toNMS(outMessage, asExchange);
+
+        answer(messageExchange, outMessage);
     }
 }

Modified: incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/activesoap/ASOutBinding.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/activesoap/ASOutBinding.java?rev=391653&r1=391652&r2=391653&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/activesoap/ASOutBinding.java (original)
+++ incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/activesoap/ASOutBinding.java Wed Apr  5 08:58:31 2006
@@ -16,9 +16,7 @@
 package org.apache.servicemix.components.activesoap;
 
 import javax.jbi.messaging.MessageExchange;
-import javax.jbi.messaging.MessagingException;
 import javax.jbi.messaging.NormalizedMessage;
-import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
 
 import org.apache.servicemix.components.util.OutBinding;
@@ -49,19 +47,13 @@
 
     // Implementation methods
     //-------------------------------------------------------------------------
-    protected void process(MessageExchange messageExchange, NormalizedMessage inMessage) throws MessagingException {
-        try {
-            XMLStreamReader in = marshaler.createStreamReader(inMessage);
-    
-            org.codehaus.activesoap.MessageExchange asExchange = service.createMessageExchange(in, null);
-            marshaler.fromNMS(asExchange, inMessage);
-            service.invoke(asExchange);
-    
-            done(messageExchange);
-        } catch (XMLStreamException e) {
-            throw new MessagingException(e);
-        } catch (Exception e) {
-            throw new MessagingException(e);
-        }
+    protected void process(MessageExchange messageExchange, NormalizedMessage inMessage) throws Exception {
+        XMLStreamReader in = marshaler.createStreamReader(inMessage);
+
+        org.codehaus.activesoap.MessageExchange asExchange = service.createMessageExchange(in, null);
+        marshaler.fromNMS(asExchange, inMessage);
+        service.invoke(asExchange);
+
+        done(messageExchange);
     }
 }

Modified: incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/drools/DroolsComponent.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/drools/DroolsComponent.java?rev=391653&r1=391652&r2=391653&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/drools/DroolsComponent.java (original)
+++ incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/drools/DroolsComponent.java Wed Apr  5 08:58:31 2006
@@ -110,16 +110,11 @@
         }
     }
 
-    protected void process(MessageExchange exchange, NormalizedMessage in) throws MessagingException {
-        try {
-            WorkingMemory memory = ruleBase.newWorkingMemory();
-            populateWorkingMemory(memory, exchange, in);
-            memory.fireAllRules();
-            done(exchange);
-        }
-        catch (FactException e) {
-            throw new FactMessagingException(e);
-        }
+    protected void process(MessageExchange exchange, NormalizedMessage in) throws Exception {
+        WorkingMemory memory = ruleBase.newWorkingMemory();
+        populateWorkingMemory(memory, exchange, in);
+        memory.fireAllRules();
+        done(exchange);
     }
 
     protected void populateWorkingMemory(WorkingMemory memory, MessageExchange exchange, NormalizedMessage in) throws MessagingException, FactException {

Modified: incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/email/MimeMailSender.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/email/MimeMailSender.java?rev=391653&r1=391652&r2=391653&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/email/MimeMailSender.java (original)
+++ incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/email/MimeMailSender.java Wed Apr  5 08:58:31 2006
@@ -16,7 +16,6 @@
 package org.apache.servicemix.components.email;
 
 import org.apache.servicemix.components.util.OutBinding;
-import org.springframework.mail.MailException;
 import org.springframework.mail.javamail.JavaMailSender;
 import org.springframework.mail.javamail.MimeMessagePreparator;
 
@@ -64,17 +63,13 @@
         }
     }
 
-    protected void process(final MessageExchange exchange, final NormalizedMessage message) throws javax.jbi.messaging.MessagingException {
+    protected void process(final MessageExchange exchange, final NormalizedMessage message) throws Exception {
         MimeMessagePreparator preparator = new MimeMessagePreparator() {
             public void prepare(MimeMessage mimeMessage) throws MessagingException {
                 marshaler.prepareMessage(mimeMessage, exchange, message);
             }
         };
-        try {
-            sender.send(preparator);
-        } catch (MailException e) {
-            throw new javax.jbi.messaging.MessagingException(e);
-        }
+        sender.send(preparator);
         done(exchange);
     }
 }

Modified: incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/email/SimpleMailSender.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/email/SimpleMailSender.java?rev=391653&r1=391652&r2=391653&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/email/SimpleMailSender.java (original)
+++ incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/email/SimpleMailSender.java Wed Apr  5 08:58:31 2006
@@ -17,11 +17,9 @@
 
 import javax.jbi.JBIException;
 import javax.jbi.messaging.MessageExchange;
-import javax.jbi.messaging.MessagingException;
 import javax.jbi.messaging.NormalizedMessage;
 
 import org.apache.servicemix.components.util.OutBinding;
-import org.springframework.mail.MailException;
 import org.springframework.mail.MailSender;
 import org.springframework.mail.SimpleMailMessage;
 
@@ -61,17 +59,10 @@
         }
     }
 
-    protected void process(final MessageExchange exchange, final NormalizedMessage message) throws MessagingException {
-        try {
-            SimpleMailMessage email = new SimpleMailMessage();
-            marshaler.prepareMessage(email, exchange, message);
-            sender.send(email);
-            done(exchange);
-        }
-        catch (MailException e) {
-            throw new MessagingException(e);
-        } catch (javax.mail.MessagingException e) {
-            throw new MessagingException(e);
-        }
+    protected void process(final MessageExchange exchange, final NormalizedMessage message) throws Exception {
+        SimpleMailMessage email = new SimpleMailMessage();
+        marshaler.prepareMessage(email, exchange, message);
+        sender.send(email);
+        done(exchange);
     }
 }

Modified: incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/file/FileWriter.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/file/FileWriter.java?rev=391653&r1=391652&r2=391653&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/file/FileWriter.java (original)
+++ incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/file/FileWriter.java Wed Apr  5 08:58:31 2006
@@ -23,7 +23,6 @@
 
 import javax.jbi.JBIException;
 import javax.jbi.messaging.MessageExchange;
-import javax.jbi.messaging.MessagingException;
 import javax.jbi.messaging.NormalizedMessage;
 import java.io.BufferedOutputStream;
 import java.io.File;
@@ -105,7 +104,7 @@
         super.init();
     }
 
-    protected void process(MessageExchange exchange, NormalizedMessage message) throws MessagingException {
+    protected void process(MessageExchange exchange, NormalizedMessage message) throws Exception {
         OutputStream out = null;
         try {
             String name = marshaler.getOutputName(exchange, message);
@@ -119,15 +118,6 @@
             out = new BufferedOutputStream(new FileOutputStream(newFile));
             marshaler.writeMessage(exchange, message, out, name);
             done(exchange);
-        }
-        catch (IOException e) {
-            throw new MessagingException(e);
-        }
-        catch (MessagingException e) {
-        	throw e;
-        }
-        catch (JBIException e) {
-            throw new MessagingException(e);
         }
         finally {
             if (out != null) {

Modified: incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/jabber/JabberChatSender.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/jabber/JabberChatSender.java?rev=391653&r1=391652&r2=391653&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/jabber/JabberChatSender.java (original)
+++ incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/jabber/JabberChatSender.java Wed Apr  5 08:58:31 2006
@@ -16,14 +16,11 @@
 package org.apache.servicemix.components.jabber;
 
 import org.jivesoftware.smack.Chat;
-import org.jivesoftware.smack.XMPPException;
 import org.jivesoftware.smack.packet.Message;
 
 import javax.jbi.JBIException;
 import javax.jbi.messaging.MessageExchange;
-import javax.jbi.messaging.MessagingException;
 import javax.jbi.messaging.NormalizedMessage;
-import javax.xml.transform.TransformerException;
 
 /**
  * Sends one way messages to a private Jabber {@link Chat}
@@ -76,18 +73,10 @@
 
     // Implementation methods
     //-------------------------------------------------------------------------
-    protected void process(MessageExchange messageExchange, NormalizedMessage normalizedMessage) throws MessagingException {
-        try {
-            Message message = chat.createMessage();
-            getMarshaler().fromNMS(message, normalizedMessage);
-            chat.sendMessage(message);
-            done(messageExchange);
-        }
-        catch (TransformerException e) {
-            throw new MessagingException(e);
-        }
-        catch (XMPPException e) {
-            throw new MessagingException(e);
-        }
+    protected void process(MessageExchange messageExchange, NormalizedMessage normalizedMessage) throws Exception {
+        Message message = chat.createMessage();
+        getMarshaler().fromNMS(message, normalizedMessage);
+        chat.sendMessage(message);
+        done(messageExchange);
     }
 }

Modified: incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/jabber/JabberGroupChatSender.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/jabber/JabberGroupChatSender.java?rev=391653&r1=391652&r2=391653&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/jabber/JabberGroupChatSender.java (original)
+++ incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/jabber/JabberGroupChatSender.java Wed Apr  5 08:58:31 2006
@@ -17,12 +17,9 @@
 
 import javax.jbi.JBIException;
 import javax.jbi.messaging.MessageExchange;
-import javax.jbi.messaging.MessagingException;
 import javax.jbi.messaging.NormalizedMessage;
-import javax.xml.transform.TransformerException;
 
 import org.jivesoftware.smack.GroupChat;
-import org.jivesoftware.smack.XMPPException;
 import org.jivesoftware.smack.packet.Message;
 
 /**
@@ -81,19 +78,11 @@
 
     // Implementation methods
     //-------------------------------------------------------------------------
-    protected void process(MessageExchange messageExchange, NormalizedMessage normalizedMessage) throws MessagingException {
-        try {
-            Message message = chat.createMessage();
-            getMarshaler().fromNMS(message, normalizedMessage);
-            chat.sendMessage(message);
-            done(messageExchange);
-        }
-        catch (TransformerException e) {
-            throw new MessagingException(e);
-        }
-        catch (XMPPException e) {
-            throw new MessagingException(e);
-        }
+    protected void process(MessageExchange messageExchange, NormalizedMessage normalizedMessage) throws Exception {
+        Message message = chat.createMessage();
+        getMarshaler().fromNMS(message, normalizedMessage);
+        chat.sendMessage(message);
+        done(messageExchange);
     }
 
 }

Modified: incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/jabber/JabberReceiver.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/jabber/JabberReceiver.java?rev=391653&r1=391652&r2=391653&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/jabber/JabberReceiver.java (original)
+++ incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/jabber/JabberReceiver.java Wed Apr  5 08:58:31 2006
@@ -58,7 +58,7 @@
 
     // Implementation methods
     //-------------------------------------------------------------------------
-    protected void process(MessageExchange exchange, NormalizedMessage message) throws MessagingException {
+    protected void process(MessageExchange exchange, NormalizedMessage message) throws Exception {
         throw new MessagingException("This component is not meant to receive inbound messages but received: " + message);
     }
 }

Modified: incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/jaxrpc/JaxRpcInBinding.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/jaxrpc/JaxRpcInBinding.java?rev=391653&r1=391652&r2=391653&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/jaxrpc/JaxRpcInBinding.java (original)
+++ incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/jaxrpc/JaxRpcInBinding.java Wed Apr  5 08:58:31 2006
@@ -15,13 +15,12 @@
  */
 package org.apache.servicemix.components.jaxrpc;
 
-import org.apache.servicemix.components.util.OutBinding;
-
 import javax.jbi.messaging.MessageExchange;
-import javax.jbi.messaging.MessagingException;
 import javax.jbi.messaging.NormalizedMessage;
 import javax.xml.rpc.Call;
 
+import org.apache.servicemix.components.util.OutBinding;
+
 /**
  * @version $Revision$
  */
@@ -29,7 +28,7 @@
     private JaxRpcMarshaler marshaler = new JaxRpcMarshaler();
 
 
-    protected void process(MessageExchange messageExchange, NormalizedMessage inMessage) throws MessagingException {
+    protected void process(MessageExchange messageExchange, NormalizedMessage inMessage) throws Exception {
         Call call = marshaler.createCall(inMessage);
         Object[] params = marshaler.getCallParams(inMessage);
 

Modified: incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/jms/JmsSenderComponent.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/jms/JmsSenderComponent.java?rev=391653&r1=391652&r2=391653&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/jms/JmsSenderComponent.java (original)
+++ incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/jms/JmsSenderComponent.java Wed Apr  5 08:58:31 2006
@@ -15,21 +15,19 @@
  */
 package org.apache.servicemix.components.jms;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.servicemix.components.util.OutBinding;
-import org.springframework.jms.JmsException;
-import org.springframework.jms.core.JmsTemplate;
-import org.springframework.jms.core.MessageCreator;
-
 import javax.jbi.messaging.MessageExchange;
-import javax.jbi.messaging.MessagingException;
 import javax.jbi.messaging.NormalizedMessage;
 import javax.jms.JMSException;
 import javax.jms.Message;
 import javax.jms.Session;
 import javax.xml.transform.TransformerException;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.servicemix.components.util.OutBinding;
+import org.springframework.jms.core.JmsTemplate;
+import org.springframework.jms.core.MessageCreator;
+
 /**
  * Consumers JBI messages and sends them to a JMS destination using the Spring
  * {@link JmsTemplate}
@@ -64,29 +62,23 @@
 
     // Implementation methods
     //-------------------------------------------------------------------------
-    protected void process(MessageExchange exchange, final NormalizedMessage inMessage) throws MessagingException {
-        try {
-            template.send(new MessageCreator() {
-                public Message createMessage(Session session) throws JMSException {
-                    try {
-                        Message message = marshaler.createMessage(inMessage, session);
-                        if (log.isTraceEnabled()) {
-                            log.trace("Sending message to: " + template.getDefaultDestinationName() + " message: " + message);
-                        }
-                        return message;
-                    }
-                    catch (TransformerException e) {
-                        JMSException jmsEx =  new JMSException("Failed to create JMS Message: " + e);
-                        jmsEx.setLinkedException(e);
-                        throw jmsEx;
+    protected void process(MessageExchange exchange, final NormalizedMessage inMessage) throws Exception {
+        template.send(new MessageCreator() {
+            public Message createMessage(Session session) throws JMSException {
+                try {
+                    Message message = marshaler.createMessage(inMessage, session);
+                    if (log.isTraceEnabled()) {
+                        log.trace("Sending message to: " + template.getDefaultDestinationName() + " message: " + message);
                     }
+                    return message;
+                }
+                catch (TransformerException e) {
+                    JMSException jmsEx =  new JMSException("Failed to create JMS Message: " + e);
+                    jmsEx.setLinkedException(e);
+                    throw jmsEx;
                 }
-            });
-            done(exchange);
-        }
-        catch (JmsException e) {
-            e.printStackTrace();
-            throw new MessagingException(e);
-        }
+            }
+        });
+        done(exchange);
     }
 }

Modified: incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/net/FTPSender.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/net/FTPSender.java?rev=391653&r1=391652&r2=391653&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/net/FTPSender.java (original)
+++ incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/net/FTPSender.java Wed Apr  5 08:58:31 2006
@@ -15,6 +15,13 @@
  */
 package org.apache.servicemix.components.net;
 
+import java.io.IOException;
+import java.io.OutputStream;
+
+import javax.jbi.JBIException;
+import javax.jbi.messaging.MessageExchange;
+import javax.jbi.messaging.NormalizedMessage;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.commons.net.SocketClient;
@@ -23,13 +30,6 @@
 import org.apache.servicemix.components.util.FileMarshaler;
 import org.apache.servicemix.components.util.OutBinding;
 
-import javax.jbi.JBIException;
-import javax.jbi.messaging.MessageExchange;
-import javax.jbi.messaging.MessagingException;
-import javax.jbi.messaging.NormalizedMessage;
-import java.io.OutputStream;
-import java.io.IOException;
-
 /**
  * A component which sends a message to a file using FTP via the
  * <a href="http://jakarta.apache.org/commons/net.html">Jakarta Commons Net</a> library
@@ -93,7 +93,7 @@
         super.init();
     }
 
-    protected void process(MessageExchange exchange, NormalizedMessage message) throws MessagingException {
+    protected void process(MessageExchange exchange, NormalizedMessage message) throws Exception {
         FTPClient client = null;
         OutputStream out = null;
         try {
@@ -119,16 +119,10 @@
                 }
             }
             if (out == null) {
-                throw new MessagingException("No output stream available for output name: " + name + ". Maybe the file already exists?");
+                throw new IOException("No output stream available for output name: " + name + ". Maybe the file already exists?");
             }
             marshaler.writeMessage(exchange, message, out, name);
             done(exchange);
-        }
-        catch (MessagingException e) {
-            throw e;
-        }
-        catch (Exception e) {
-            throw new MessagingException(e);
         }
         finally {
             returnClient(client);

Modified: incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/reflection/ReflectionOutBinding.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/reflection/ReflectionOutBinding.java?rev=391653&r1=391652&r2=391653&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/reflection/ReflectionOutBinding.java (original)
+++ incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/reflection/ReflectionOutBinding.java Wed Apr  5 08:58:31 2006
@@ -15,11 +15,9 @@
  */
 package org.apache.servicemix.components.reflection;
 
-import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 
 import javax.jbi.messaging.MessageExchange;
-import javax.jbi.messaging.MessagingException;
 import javax.jbi.messaging.NormalizedMessage;
 
 import org.apache.servicemix.components.util.OutBinding;
@@ -42,20 +40,11 @@
     
     // Implementation methods
     //-------------------------------------------------------------------------
-    protected void process(MessageExchange messageExchange, NormalizedMessage inMessage) throws MessagingException {
+    protected void process(MessageExchange messageExchange, NormalizedMessage inMessage) throws Exception {
         
         Method method = (Method) inMessage.getProperty("method");
         Object []args = (Object[]) inMessage.getProperty("args");
-                
-        try {
-            method.invoke(target, args);
-            done(messageExchange);
-        } catch (IllegalArgumentException e) {
-            throw new MessagingException(e);
-        } catch (IllegalAccessException e) {
-            throw new MessagingException(e);
-        } catch (InvocationTargetException e) {
-            throw new MessagingException(e);
-        }
+        method.invoke(target, args);
+        done(messageExchange);
     }
 }

Modified: incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/rss/FeedWriter.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/rss/FeedWriter.java?rev=391653&r1=391652&r2=391653&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/rss/FeedWriter.java (original)
+++ incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/rss/FeedWriter.java Wed Apr  5 08:58:31 2006
@@ -184,23 +184,12 @@
         }
     }
 
-    protected void process(MessageExchange exchange, NormalizedMessage message) throws MessagingException {
-        try {
-            SyndFeed feed = getCachedFeed();
-            addMessageToFeed(feed, exchange, message);
-            removeExpiredEntries(feed);
-            writeFeed(feed, exchange, message);
-            done(exchange);
-        }
-        catch (IOException e) {
-            throw new MessagingException(e);
-        }
-        catch (FeedException e) {
-            throw new MessagingException(e);
-        }
-        catch (TransformerException e) {
-            throw new MessagingException(e);
-        }
+    protected void process(MessageExchange exchange, NormalizedMessage message) throws Exception {
+        SyndFeed feed = getCachedFeed();
+        addMessageToFeed(feed, exchange, message);
+        removeExpiredEntries(feed);
+        writeFeed(feed, exchange, message);
+        done(exchange);
     }
 
     protected void addMessageToFeed(SyndFeed feed, MessageExchange exchange, NormalizedMessage message) throws TransformerException, MessagingException {

Modified: incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/vfs/FileWriter.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/vfs/FileWriter.java?rev=391653&r1=391652&r2=391653&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/vfs/FileWriter.java (original)
+++ incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/vfs/FileWriter.java Wed Apr  5 08:58:31 2006
@@ -103,7 +103,7 @@
         super.init();
     }
 
-    protected void process(MessageExchange exchange, NormalizedMessage message) throws MessagingException {
+    protected void process(MessageExchange exchange, NormalizedMessage message) throws Exception {
         OutputStream out = null;
         try {
             String name = marshaler.getOutputName(exchange, message);
@@ -123,15 +123,6 @@
             }
             marshaler.writeMessage(exchange, message, out, name);
             done(exchange);
-        }
-        catch (IOException e) {
-            throw new MessagingException(e);
-        }
-        catch (MessagingException e) {
-        	throw e;
-        }
-        catch (JBIException e) {
-            throw new MessagingException(e);
         }
         finally {
             if (out != null) {

Modified: incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/wsif/WSIFOperationMap.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/wsif/WSIFOperationMap.java?rev=391653&r1=391652&r2=391653&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/wsif/WSIFOperationMap.java (original)
+++ incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/wsif/WSIFOperationMap.java Wed Apr  5 08:58:31 2006
@@ -15,20 +15,20 @@
  */
 package org.apache.servicemix.components.wsif;
 
-import org.apache.servicemix.jbi.NoSuchOperationException;
-import org.apache.wsif.WSIFException;
-import org.apache.wsif.WSIFOperation;
-import org.apache.wsif.WSIFService;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
 
+import javax.jbi.messaging.MessageExchange;
 import javax.wsdl.Binding;
 import javax.wsdl.BindingOperation;
 import javax.wsdl.Operation;
 import javax.xml.namespace.QName;
-import javax.jbi.messaging.MessageExchange;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
+
+import org.apache.servicemix.jbi.NoSuchOperationException;
+import org.apache.wsif.WSIFException;
+import org.apache.wsif.WSIFService;
 
 /**
  * Maintains a Map of the available operations for the binding.

Modified: incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/wsif/WSIFOutBinding.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/wsif/WSIFOutBinding.java?rev=391653&r1=391652&r2=391653&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/wsif/WSIFOutBinding.java (original)
+++ incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/wsif/WSIFOutBinding.java Wed Apr  5 08:58:31 2006
@@ -15,16 +15,13 @@
  */
 package org.apache.servicemix.components.wsif;
 
+import javax.jbi.messaging.MessageExchange;
+import javax.jbi.messaging.NormalizedMessage;
+
 import org.apache.servicemix.components.util.OutBinding;
-import org.apache.wsif.WSIFException;
 import org.apache.wsif.WSIFMessage;
 import org.apache.wsif.WSIFOperation;
 
-import javax.jbi.messaging.ExchangeStatus;
-import javax.jbi.messaging.MessageExchange;
-import javax.jbi.messaging.MessagingException;
-import javax.jbi.messaging.NormalizedMessage;
-
 /**
  * Consumers JBI messages and sends them as a oneway into WSIF
  *
@@ -53,18 +50,12 @@
 
     // Implementation methods
     //-------------------------------------------------------------------------
-    protected void process(MessageExchange exchange, NormalizedMessage normalizedMessage) throws MessagingException {
-        try {
-            WSIFOperationInfo operationInfo = operationMap.getOperationForExchange(exchange);
-            WSIFOperation operation = operationInfo.createWsifOperation();
-            WSIFMessage message = operation.createInputMessage();
-            marshaler.fromNMS(operationInfo, message, normalizedMessage, getBody(normalizedMessage));
-            operation.executeInputOnlyOperation(message);
-            done(exchange);
-        }
-        catch (WSIFException e) {
-            exchange.setError(e);
-            exchange.setStatus(ExchangeStatus.ERROR);
-        }
+    protected void process(MessageExchange exchange, NormalizedMessage normalizedMessage) throws Exception {
+        WSIFOperationInfo operationInfo = operationMap.getOperationForExchange(exchange);
+        WSIFOperation operation = operationInfo.createWsifOperation();
+        WSIFMessage message = operation.createInputMessage();
+        marshaler.fromNMS(operationInfo, message, normalizedMessage, getBody(normalizedMessage));
+        operation.executeInputOnlyOperation(message);
+        done(exchange);
     }
 }

Modified: incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/xfire/XFireBinding.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/xfire/XFireBinding.java?rev=391653&r1=391652&r2=391653&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/xfire/XFireBinding.java (original)
+++ incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/xfire/XFireBinding.java Wed Apr  5 08:58:31 2006
@@ -15,6 +15,13 @@
  */
 package org.apache.servicemix.components.xfire;
 
+import java.io.ByteArrayOutputStream;
+
+import javax.jbi.JBIException;
+import javax.jbi.messaging.MessageExchange;
+import javax.jbi.messaging.NormalizedMessage;
+import javax.xml.stream.XMLStreamReader;
+
 import org.apache.servicemix.components.util.OutBinding;
 import org.codehaus.xfire.MessageContext;
 import org.codehaus.xfire.XFire;
@@ -23,14 +30,6 @@
 import org.codehaus.xfire.transport.Transport;
 import org.codehaus.xfire.transport.local.LocalTransport;
 
-import javax.jbi.JBIException;
-import javax.jbi.messaging.MessageExchange;
-import javax.jbi.messaging.MessagingException;
-import javax.jbi.messaging.NormalizedMessage;
-import javax.xml.stream.XMLStreamReader;
-
-import java.io.ByteArrayOutputStream;
-
 public class XFireBinding extends OutBinding {
     private XMarshaler marshaler;
 
@@ -43,39 +42,31 @@
         this.marshaler = new XMarshaler();
     }
     
-    protected void process(MessageExchange messageExchange, NormalizedMessage nm)
-            throws MessagingException {
-        try {
-            XMLStreamReader reader = marshaler.createStreamReader(nm);
-
-            if (reader == null) 
-            {
-                fail(messageExchange, new JBIException("Could not get source as XMLStreamReader."));
-                return;
-            }
-            
-            InMessage in = new InMessage(reader, "");
-            MessageContext context = new MessageContext();
-            context.setXFire(xfire);
-            context.setService(xfire.getServiceRegistry().getService(getService().getLocalPart()));
-
-            ByteArrayOutputStream buffer = new ByteArrayOutputStream();
-            context.setProperty(Channel.BACKCHANNEL_URI, buffer);
-            
-            Transport transport = 
-                xfire.getTransportManager().getTransport(LocalTransport.BINDING_ID);
-            Channel channel = transport.createChannel();
-            channel.receive(context, in);
-
-            NormalizedMessage outMessage = messageExchange.createMessage();
-
-            marshaler.setContent(outMessage, buffer.toString());
-            marshaler.toNMS(outMessage, context.getOutMessage());
-
-            answer(messageExchange, outMessage);
-        } catch (Exception e) {
-            fail(messageExchange, e);
+    protected void process(MessageExchange messageExchange, NormalizedMessage nm) throws Exception {
+        
+        XMLStreamReader reader = marshaler.createStreamReader(nm);
+        if (reader == null) {
+            throw new JBIException("Could not get source as XMLStreamReader.");
         }
+        
+        InMessage in = new InMessage(reader, "");
+        MessageContext context = new MessageContext();
+        context.setXFire(xfire);
+        context.setService(xfire.getServiceRegistry().getService(getService().getLocalPart()));
+
+        ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+        context.setProperty(Channel.BACKCHANNEL_URI, buffer);
+        
+        Transport transport =  xfire.getTransportManager().getTransport(LocalTransport.BINDING_ID);
+        Channel channel = transport.createChannel();
+        channel.receive(context, in);
+
+        NormalizedMessage outMessage = messageExchange.createMessage();
+
+        marshaler.setContent(outMessage, buffer.toString());
+        marshaler.toNMS(outMessage, context.getOutMessage());
+
+        answer(messageExchange, outMessage);
     }
 
     public XFire getXfire() {

Modified: incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/xfire/XFireOutBinding.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/xfire/XFireOutBinding.java?rev=391653&r1=391652&r2=391653&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/xfire/XFireOutBinding.java (original)
+++ incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/xfire/XFireOutBinding.java Wed Apr  5 08:58:31 2006
@@ -23,8 +23,8 @@
 import org.codehaus.xfire.transport.Transport;
 import org.codehaus.xfire.transport.local.LocalTransport;
 
+import javax.jbi.JBIException;
 import javax.jbi.messaging.MessageExchange;
-import javax.jbi.messaging.MessagingException;
 import javax.jbi.messaging.NormalizedMessage;
 import javax.xml.stream.XMLStreamReader;
 
@@ -40,25 +40,23 @@
         this.marshaller = new XMarshaler();
     }
     
-    protected void process(MessageExchange messageExchange, NormalizedMessage nm)
-            throws MessagingException {
-        try {
-            XMLStreamReader reader = marshaller.createStreamReader(nm);
-
-            InMessage in = new InMessage(reader, "");
-            MessageContext context = new MessageContext();
-            context.setXFire(xfire);
-            context.setService(xfire.getServiceRegistry().getService(getService().getLocalPart()));
-
-            Transport transport = 
-                xfire.getTransportManager().getTransport(LocalTransport.BINDING_ID);
-            Channel channel = transport.createChannel();
-            channel.receive(context, in);
-
-            done(messageExchange);
-        } catch (Exception e) {
-            fail(messageExchange, e);
+    protected void process(MessageExchange messageExchange, NormalizedMessage nm) throws Exception {
+        
+        XMLStreamReader reader = marshaller.createStreamReader(nm);
+        if (reader == null) {
+            throw new JBIException("Could not get source as XMLStreamReader.");
         }
+
+        InMessage in = new InMessage(reader, "");
+        MessageContext context = new MessageContext();
+        context.setXFire(xfire);
+        context.setService(xfire.getServiceRegistry().getService(getService().getLocalPart()));
+
+        Transport transport = xfire.getTransportManager().getTransport(LocalTransport.BINDING_ID);
+        Channel channel = transport.createChannel();
+        channel.receive(context, in);
+
+        done(messageExchange);
     }
 
     public XFire getXfire() {

Modified: incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/components/util/OutBinding.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/components/util/OutBinding.java?rev=391653&r1=391652&r2=391653&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/components/util/OutBinding.java (original)
+++ incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/components/util/OutBinding.java Wed Apr  5 08:58:31 2006
@@ -48,10 +48,11 @@
                 process(exchange, message);
             }
             catch (Exception e) {
+                if (log.isDebugEnabled()) {
+                    log.debug("Exchange failed", e);
+                }
                 fail(exchange, e);
             }
-        } else if (exchange.getStatus() == ExchangeStatus.ERROR) {
-            done(exchange);
         }
     }
 
@@ -115,11 +116,14 @@
     }
 
     /**
-     * Process incoming
+     * Process incoming exchange.
+     * The exchange is in the ACTIVE state.
+     * The method should end by a call to done() or answer().
+     * When an exception is thrown, the fail() method will be called.
      *
-     * @param messageExchange
-     * @param message
-     * @throws MessagingException
+     * @param messageExchange the exchange to process
+     * @param message the input message of the exchange
+     * @throws Exception if an error occurs
      */
-    protected abstract void process(MessageExchange messageExchange, NormalizedMessage message) throws MessagingException;
+    protected abstract void process(MessageExchange messageExchange, NormalizedMessage message) throws Exception;
 }

Modified: incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/components/util/StreamWriterComponent.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/components/util/StreamWriterComponent.java?rev=391653&r1=391652&r2=391653&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/components/util/StreamWriterComponent.java (original)
+++ incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/components/util/StreamWriterComponent.java Wed Apr  5 08:58:31 2006
@@ -19,12 +19,10 @@
 import org.w3c.dom.Node;
 
 import javax.jbi.messaging.MessageExchange;
-import javax.jbi.messaging.MessagingException;
 import javax.jbi.messaging.NormalizedMessage;
 import javax.xml.transform.OutputKeys;
 import javax.xml.transform.Source;
 import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerException;
 import javax.xml.transform.TransformerFactory;
 import javax.xml.transform.dom.DOMSource;
 import javax.xml.transform.stream.StreamResult;
@@ -60,24 +58,19 @@
     // -------------------------------------------------------------------------
     
 
-    protected void process(MessageExchange exchange, NormalizedMessage message) throws MessagingException {
-        try {
-            TransformerFactory tFactory = TransformerFactory.newInstance();
-            Transformer transformer = tFactory.newTransformer();
-            transformer.setOutputProperty(OutputKeys.INDENT, "yes");
-            Source content = null;
-            Node document = (Node) message.getProperty(SourceTransformer.CONTENT_DOCUMENT_PROPERTY);
-            if (document != null) {
-                content = new DOMSource(document);
-            }
-            else {
-                content = message.getContent();
-            }
-            transformer.transform(content, new StreamResult(out));
-            done(exchange);
+    protected void process(MessageExchange exchange, NormalizedMessage message) throws Exception {
+        TransformerFactory tFactory = TransformerFactory.newInstance();
+        Transformer transformer = tFactory.newTransformer();
+        transformer.setOutputProperty(OutputKeys.INDENT, "yes");
+        Source content = null;
+        Node document = (Node) message.getProperty(SourceTransformer.CONTENT_DOCUMENT_PROPERTY);
+        if (document != null) {
+            content = new DOMSource(document);
         }
-        catch (TransformerException e) {
-            throw new MessagingException(e);
+        else {
+            content = message.getContent();
         }
+        transformer.transform(content, new StreamResult(out));
+        done(exchange);
     }
 }



Mime
View raw message