[jboss-svn-commits] JBL Code SVN: r14099 - in labs/jbossesb/trunk/product: rosetta/src/org/jboss/soa/esb/listeners/message and 1 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Wed Aug 8 11:39:33 EDT 2007
Author: mark.little at jboss.com
Date: 2007-08-08 11:39:33 -0400 (Wed, 08 Aug 2007)
New Revision: 14099
Added:
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/addressing/util/DefaultFaultTo.java
Modified:
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/addressing/util/DefaultReplyTo.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/message/ActionProcessingPipeline.java
labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actions/CommandInterpreter.java
Log:
http://jira.jboss.com/jira/browse/JBESB-798
Added: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/addressing/util/DefaultFaultTo.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/addressing/util/DefaultFaultTo.java (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/addressing/util/DefaultFaultTo.java 2007-08-08 15:39:33 UTC (rev 14099)
@@ -0,0 +1,64 @@
+package org.jboss.soa.esb.addressing.util;
+
+import org.jboss.soa.esb.addressing.EPR;
+import org.jboss.soa.esb.message.Message;
+
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006,
+ * @author mark.little at jboss.com
+ */
+
+/**
+ * Provide some helper routines for common requirements.
+ */
+
+public class DefaultFaultTo
+{
+ /**
+ * Get the FaultTo EPR on this address. If it is not set, then try to return
+ * the From EPR. If that is not set, then return null.
+ *
+ * @param message
+ * the message to work on.
+ * @return the FaultTo EPR, or ReplyTo, or the From EPR, or null, in that order.
+ */
+
+ public static final EPR getFaultToAddress (Message message)
+ {
+ if (message == null)
+ return null;
+
+ try
+ {
+ if (message.getHeader().getCall().getFaultTo() != null)
+ return message.getHeader().getCall().getFaultTo();
+ else if (message.getHeader().getCall().getReplyTo() != null)
+ return message.getHeader().getCall().getReplyTo();
+ else
+ return message.getHeader().getCall().getFrom();
+ }
+ catch (final NullPointerException e)
+ {
+ // OK, it's not set... return null...
+ }
+
+ return null;
+ }
+
+}
\ No newline at end of file
Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/addressing/util/DefaultReplyTo.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/addressing/util/DefaultReplyTo.java 2007-08-08 15:31:39 UTC (rev 14098)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/addressing/util/DefaultReplyTo.java 2007-08-08 15:39:33 UTC (rev 14099)
@@ -18,6 +18,7 @@
import org.jboss.soa.esb.addressing.eprs.JMSEpr;
import org.jboss.soa.esb.addressing.eprs.SFTPEpr;
import org.jboss.soa.esb.couriers.CourierException;
+import org.jboss.soa.esb.message.Message;
/*
* JBoss, Home of Professional Open Source
@@ -93,4 +94,32 @@
+ toEpr.getClass().getSimpleName());
}
+ /**
+ * Get the ReplyTo EPR on this address. If it is not set, then try to return
+ * the From EPR. If that is not set, then return null.
+ *
+ * @param message
+ * the message to work on.
+ * @return the ReplyTo EPR, or the From EPR, or null, in that order.
+ */
+
+ public static final EPR getReplyToAddress (Message message)
+ {
+ if (message == null)
+ return null;
+
+ try
+ {
+ if (message.getHeader().getCall().getReplyTo() != null)
+ return message.getHeader().getCall().getReplyTo();
+ else
+ return message.getHeader().getCall().getFrom();
+ }
+ catch (final NullPointerException e)
+ {
+ // OK, it's not set... return null...
+ }
+
+ return null;
+ }
}
\ No newline at end of file
Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/message/ActionProcessingPipeline.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/message/ActionProcessingPipeline.java 2007-08-08 15:31:39 UTC (rev 14098)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/message/ActionProcessingPipeline.java 2007-08-08 15:39:33 UTC (rev 14099)
@@ -33,6 +33,8 @@
import org.jboss.soa.esb.actions.BeanConfiguredAction;
import org.jboss.soa.esb.addressing.EPR;
import org.jboss.soa.esb.addressing.MalformedEPRException;
+import org.jboss.soa.esb.addressing.util.DefaultFaultTo;
+import org.jboss.soa.esb.addressing.util.DefaultReplyTo;
import org.jboss.soa.esb.couriers.Courier;
import org.jboss.soa.esb.couriers.CourierException;
import org.jboss.soa.esb.couriers.CourierFactory;
@@ -235,7 +237,7 @@
*/
public boolean process(final Message message)
{
- final EPR faultToAddress = getFaultToAddress(message);
+ final EPR faultToAddress = DefaultFaultTo.getFaultToAddress(message);
long start = System.nanoTime();
if (active.get())
@@ -247,7 +249,7 @@
final int numProcessors = processors.length;
final Message[] messages = new Message[numProcessors];
- final EPR replyToAddress = getReplyToAddress(message);
+ final EPR replyToAddress = DefaultReplyTo.getReplyToAddress(message);
Message currentMessage = message;
@@ -334,35 +336,6 @@
}
/**
- * Get the ReplyTo EPR on this address. If it is not set, then try to return
- * the From EPR. If that is not set, then return null.
- *
- * @param message
- * the message to work on.
- * @return the ReplyTo EPR, or the From EPR, or null, in that order.
- */
-
- private EPR getReplyToAddress(Message message)
- {
- if (message == null)
- return null;
-
- try
- {
- if (message.getHeader().getCall().getReplyTo() != null)
- return message.getHeader().getCall().getReplyTo();
- else
- return message.getHeader().getCall().getFrom();
- }
- catch (final NullPointerException e)
- {
- // OK, it's not set... return null...
- }
-
- return null;
- }
-
- /**
* Send the reply.
*
* @param replyToAddress
@@ -374,7 +347,7 @@
private void replyTo(EPR replyToAddress, Message message)
{
Courier courier = null;
- EPR replyToEPR = getReplyToAddress(message);
+ EPR replyToEPR = DefaultReplyTo.getReplyToAddress(message);
if (replyToEPR != null)
replyToAddress = replyToEPR;
@@ -416,38 +389,6 @@
}
/**
- * Get the FaultTo EPR on this address. If it is not set, then try to return
- * the From EPR. If that is not set, then return null.
- *
- * @param message
- * the message to work on.
- * @return the FaultTo EPR, or ReplyTo, or the From EPR, or null, in that order.
- */
-
- private EPR getFaultToAddress(Message message)
- {
- if (message == null)
- return null;
-
- try
- {
- if (message.getHeader().getCall().getFaultTo() != null)
- return message.getHeader().getCall().getFaultTo();
- else
- if (message.getHeader().getCall().getReplyTo() != null)
- return message.getHeader().getCall().getReplyTo();
- else
- return message.getHeader().getCall().getFrom();
- }
- catch (final NullPointerException e)
- {
- // OK, it's not set... return null...
- }
-
- return null;
- }
-
- /**
* Send the fault message to the EPR.
*
* @param faultToAddress
@@ -459,7 +400,7 @@
private void faultTo(EPR faultToAddress, Message message)
{
Courier courier = null;
- EPR faultToEPR = getFaultToAddress(message);
+ EPR faultToEPR = DefaultFaultTo.getFaultToAddress(message);
if (faultToEPR != null)
faultToAddress = faultToEPR;
Modified: labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actions/CommandInterpreter.java
===================================================================
--- labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actions/CommandInterpreter.java 2007-08-08 15:31:39 UTC (rev 14098)
+++ labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actions/CommandInterpreter.java 2007-08-08 15:39:33 UTC (rev 14099)
@@ -28,6 +28,7 @@
import org.jboss.soa.esb.actions.ActionProcessingException;
import org.jboss.soa.esb.addressing.EPR;
import org.jboss.soa.esb.addressing.MalformedEPRException;
+import org.jboss.soa.esb.addressing.util.DefaultReplyTo;
import org.jboss.soa.esb.couriers.Courier;
import org.jboss.soa.esb.couriers.CourierException;
import org.jboss.soa.esb.couriers.CourierFactory;
@@ -93,7 +94,8 @@
public static Message defaultReply(Message message)
throws MalformedEPRException,CourierException
{
- EPR reply = message.getHeader().getCall().getReplyTo();
+ EPR reply = DefaultReplyTo.getReplyToAddress(message);
+
if (null==reply)
_logger.error("Null replyToEPR in message - response will not be sent to invoker");
else
More information about the jboss-svn-commits
mailing list