servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r581822 - in /incubator/servicemix/trunk/deployables/serviceengines/servicemix-eip/src/main/java/org/apache/servicemix/eip/patterns: SplitAggregator.java StaticRecipientList.java
Date Thu, 04 Oct 2007 09:50:29 GMT
Author: gnodet
Date: Thu Oct  4 02:50:28 2007
New Revision: 581822

URL: http://svn.apache.org/viewvc?rev=581822&view=rev
Log:
SM-1081: A StaticRecipientListAggregator

Modified:
    incubator/servicemix/trunk/deployables/serviceengines/servicemix-eip/src/main/java/org/apache/servicemix/eip/patterns/SplitAggregator.java
    incubator/servicemix/trunk/deployables/serviceengines/servicemix-eip/src/main/java/org/apache/servicemix/eip/patterns/StaticRecipientList.java

Modified: incubator/servicemix/trunk/deployables/serviceengines/servicemix-eip/src/main/java/org/apache/servicemix/eip/patterns/SplitAggregator.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/serviceengines/servicemix-eip/src/main/java/org/apache/servicemix/eip/patterns/SplitAggregator.java?rev=581822&r1=581821&r2=581822&view=diff
==============================================================================
--- incubator/servicemix/trunk/deployables/serviceengines/servicemix-eip/src/main/java/org/apache/servicemix/eip/patterns/SplitAggregator.java
(original)
+++ incubator/servicemix/trunk/deployables/serviceengines/servicemix-eip/src/main/java/org/apache/servicemix/eip/patterns/SplitAggregator.java
Thu Oct  4 02:50:28 2007
@@ -50,16 +50,16 @@
  */
 public class SplitAggregator extends AbstractAggregator {
 
-    private Expression count = new PropertyExpression(AbstractSplitter.SPLITTER_COUNT);
-    private Expression index = new PropertyExpression(AbstractSplitter.SPLITTER_INDEX);
-    private Expression corrId = new PropertyExpression(AbstractSplitter.SPLITTER_CORRID);
+    protected Expression count = new PropertyExpression(AbstractSplitter.SPLITTER_COUNT);
+    protected Expression index = new PropertyExpression(AbstractSplitter.SPLITTER_INDEX);
+    protected Expression corrId = new PropertyExpression(AbstractSplitter.SPLITTER_CORRID);
     
-    private QName aggregateElementName = new QName("aggregate");
-    private QName messageElementName = new QName("message");
-    private String countAttribute = "count";
-    private String indexAttribute = "index";
+    protected QName aggregateElementName = new QName("aggregate");
+    protected QName messageElementName = new QName("message");
+    protected String countAttribute = "count";
+    protected String indexAttribute = "index";
     
-    private long timeout;
+    protected long timeout;
     
     /**
      * @return the aggregateElementName
@@ -244,17 +244,21 @@
         root.setAttribute(countAttribute, Integer.toString(messages.length));
         for (int i = 0; i < messages.length; i++) {
             if (messages[i] != null) {
-                Element msg = createChildElement(messageElementName, root);
-                msg.setAttribute(indexAttribute, Integer.toString(i));
                 Element elem = st.toDOMElement(messages[i]);
-                msg.appendChild(doc.importNode(elem, true));
+                if (messageElementName != null) {
+                    Element msg = createChildElement(messageElementName, root);
+                    msg.setAttribute(indexAttribute, Integer.toString(i));
+                    msg.appendChild(doc.importNode(elem, true));
+                } else {
+                    root.appendChild(doc.importNode(elem, true));
+                }
             }
         }
         message.setContent(new DOMSource(doc));
         message.setProperty(AbstractSplitter.SPLITTER_CORRID, correlationId);
     }
     
-    private Element createChildElement(QName name, Node parent) {
+    protected Element createChildElement(QName name, Node parent) {
         Document doc = parent instanceof Document ? (Document) parent : parent.getOwnerDocument();
         Element elem;
         if ("".equals(name.getNamespaceURI())) {

Modified: incubator/servicemix/trunk/deployables/serviceengines/servicemix-eip/src/main/java/org/apache/servicemix/eip/patterns/StaticRecipientList.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/serviceengines/servicemix-eip/src/main/java/org/apache/servicemix/eip/patterns/StaticRecipientList.java?rev=581822&r1=581821&r2=581822&view=diff
==============================================================================
--- incubator/servicemix/trunk/deployables/serviceengines/servicemix-eip/src/main/java/org/apache/servicemix/eip/patterns/StaticRecipientList.java
(original)
+++ incubator/servicemix/trunk/deployables/serviceengines/servicemix-eip/src/main/java/org/apache/servicemix/eip/patterns/StaticRecipientList.java
Thu Oct  4 02:50:28 2007
@@ -41,6 +41,10 @@
  */
 public class StaticRecipientList extends EIPEndpoint {
 
+    public static final String RECIPIENT_LIST_COUNT = "org.apache.servicemix.eip.recipientList.count";
+    public static final String RECIPIENT_LIST_INDEX = "org.apache.servicemix.eip.recipientList.index";
+    public static final String RECIPIENT_LIST_CORRID = "org.apache.servicemix.eip.recipientList.corrid";
+
     /**
      * List of recipients
      */
@@ -114,6 +118,9 @@
         for (int i = 0; i < recipients.length; i++) {
             MessageExchange me = getExchangeFactory().createExchange(exchange.getPattern());
             recipients[i].configureTarget(me, getContext());
+            in.setProperty(RECIPIENT_LIST_COUNT, new Integer(recipients.length));
+            in.setProperty(RECIPIENT_LIST_INDEX, new Integer(i));
+            in.setProperty(RECIPIENT_LIST_CORRID, exchange.getExchangeId());
             MessageUtil.transferToIn(in, me);
             sendSync(me);
             if (me.getStatus() == ExchangeStatus.ERROR && reportErrors) {



Mime
View raw message