[jboss-svn-commits] JBL Code SVN: r10942 - labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/actions.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Thu Apr 12 16:00:12 EDT 2007
Author: kurt.stam at jboss.com
Date: 2007-04-12 16:00:12 -0400 (Thu, 12 Apr 2007)
New Revision: 10942
Added:
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/ContentBasedFilter.java
Log:
When using a filter it's ok for the outcome to be "no distinations"
Added: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/ContentBasedFilter.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/ContentBasedFilter.java (rev 0)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/ContentBasedFilter.java 2007-04-12 20:00:12 UTC (rev 10942)
@@ -0,0 +1,83 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY 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 along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+/**
+ * Routes the Message argument to a fixed list of services ([category,name])
+ * @author <a href="mailto:schifest at heuristica.com.ar">schifest at heuristica.com.ar</a>
+ * @since Version 4.0
+ */
+package org.jboss.soa.esb.actions;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.apache.log4j.Logger;
+import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.addressing.MalformedEPRException;
+import org.jboss.soa.esb.couriers.CourierException;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.services.registry.RegistryException;
+import org.jboss.soa.esb.services.routing.MessageRouter;
+import org.jboss.soa.esb.services.routing.MessageRouterException;
+
+public class ContentBasedFilter extends ContentBasedRouter
+{
+ public static final String ROUTE_TO_TAG = "route-to";
+ private Logger log = Logger.getLogger(this.getClass());
+
+ public ContentBasedFilter(ConfigTree config) throws ConfigurationException, RegistryException, MessageRouterException
+ {
+ super(config);
+ }
+ /**
+ * Inspect the content of the message using a rule set
+ * Router the message to one or more destinations, using the ContentBasedRouter to figure out
+ * to which destinations it is going to be routed too.
+ *
+ * @param message
+ * @return
+ * @throws MalformedEPRException
+ * @throws RegistryException
+ * @throws CourierException
+ * @throws MessageRouterException
+ */
+ public Message process(Message message) throws MalformedEPRException, RegistryException, CourierException, MessageRouterException
+ {
+ List<String> destinations = _cbr.route(_ruleSet, _ruleLanguage, _ruleReload, message);
+ Collection<String[]> outgoingDestinations = new ArrayList<String[]>();
+ for (String destination : destinations) {
+ if (_destinations.containsKey(destination)) {
+ outgoingDestinations.add(_destinations.get(destination));
+ }
+ }
+ if (outgoingDestinations.size()>0) {
+ MessageRouter.deliverMessages(outgoingDestinations, message);
+ } else if (destinations.size() > 0) {
+ log.debug("No destinations where found, the Message is filter");
+ }
+ return message;
+ }
+
+
+}
Property changes on: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/ContentBasedFilter.java
___________________________________________________________________
Name: svn:eol-style
+ native
More information about the jboss-svn-commits
mailing list