[jboss-svn-commits] JBL Code SVN: r21027 - in labs/jbossesb/trunk/product: samples/quickstarts/business_rules_service/src/org/jboss/soa/esb/samples/quickstart/businessrules and 1 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Mon Jul 14 11:06:06 EDT 2008
Author: beve
Date: 2008-07-14 11:06:06 -0400 (Mon, 14 Jul 2008)
New Revision: 21027
Added:
labs/jbossesb/trunk/product/samples/quickstarts/business_rules_service/src/org/jboss/soa/esb/samples/quickstart/businessrules/UpdateCustomerStatus.java
Modified:
labs/jbossesb/trunk/product/samples/quickstarts/business_rules_service/jboss-esb.xml
labs/jbossesb/trunk/product/samples/quickstarts/business_rules_service/readme.txt
labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/soa/esb/actions/ContentBasedWiretap.java
Log:
Work for JBESB-1808 "business_rules_service QS is missing an action"
Modified: labs/jbossesb/trunk/product/samples/quickstarts/business_rules_service/jboss-esb.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/business_rules_service/jboss-esb.xml 2008-07-14 14:32:42 UTC (rev 21026)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_rules_service/jboss-esb.xml 2008-07-14 15:06:06 UTC (rev 21027)
@@ -41,11 +41,7 @@
</jms-listener>
</listeners>
<actions mep="OneWay">
- <!--
- <action name="print-before" class="org.jboss.soa.esb.actions.SystemPrintln">
- <property name="message" value="Message before transformation" />
- </action>
- -->
+
<action name="transform"
class="org.jboss.soa.esb.smooks.SmooksAction">
@@ -56,6 +52,12 @@
<action name="map_order_components" class="org.jboss.soa.esb.actions.scripting.GroovyActionProcessor">
<property name="script" value="/map_order_components.groovy" />
</action>
+
+ <!-- Update Customer Status -->
+ <action name="updateCustomerStatus"
+ class="org.jboss.soa.esb.samples.quickstart.businessrules.UpdateCustomerStatus">
+ <property name="status" value="60"/>
+ </action>
<!-- Use the BRP to calculate the order priority -->
<action
Modified: labs/jbossesb/trunk/product/samples/quickstarts/business_rules_service/readme.txt
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/business_rules_service/readme.txt 2008-07-14 14:32:42 UTC (rev 21026)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_rules_service/readme.txt 2008-07-14 15:06:06 UTC (rev 21027)
@@ -40,8 +40,11 @@
Review the 3 different .drl files to see the distinction between business
rules used for calculation/validation and rules used for routing.
- The customer status is actually set in the jboss-esb.xml via the SetupMessage
+ The customer status is actually set in the jboss-esb.xml via the UpdateCusutomerStatus
action since it is not provided with the inbound XML. You don't want a
customer to determine their status. In a real world situation, another
system would be integrated via an action/service, that first calculates the
- customer's status (frequent flier, volume of previous purchases, etc.)
\ No newline at end of file
+ customer's status (frequent flier, volume of previous purchases, etc.)
+ Try setting the "status" to different values and see how the customer
+ status is used in MyBusinessRules.drl.
+
Added: labs/jbossesb/trunk/product/samples/quickstarts/business_rules_service/src/org/jboss/soa/esb/samples/quickstart/businessrules/UpdateCustomerStatus.java
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/business_rules_service/src/org/jboss/soa/esb/samples/quickstart/businessrules/UpdateCustomerStatus.java (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_rules_service/src/org/jboss/soa/esb/samples/quickstart/businessrules/UpdateCustomerStatus.java 2008-07-14 15:06:06 UTC (rev 21027)
@@ -0,0 +1,48 @@
+/*
+ * 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 JBoss Inc.
+ */
+package org.jboss.soa.esb.samples.quickstart.businessrules;
+
+import java.util.HashMap;
+import org.jboss.soa.esb.actions.AbstractActionPipelineProcessor;
+import org.jboss.soa.esb.actions.ActionProcessingException;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.samples.quickstart.businessrules.dvdstore.Customer;
+import org.jboss.soa.esb.samples.quickstart.businessrules.dvdstore.OrderHeader;
+
+public class UpdateCustomerStatus extends AbstractActionPipelineProcessor {
+
+ private int status;
+
+ public Message process(Message message) throws ActionProcessingException {
+
+ OrderHeader order = (OrderHeader) message.getBody().get("orderHeader");
+ Customer customer = (Customer) message.getBody().get("customer");
+ customer.setStatus( status );
+ System.out.println("{ Updated customer status to " + status + "}" );
+ return message;
+ }
+
+ public UpdateCustomerStatus(ConfigTree configTree) {
+ status = Integer.parseInt(configTree.getAttribute("status"));
+ }
+
+}
Modified: labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/soa/esb/actions/ContentBasedWiretap.java
===================================================================
--- labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/soa/esb/actions/ContentBasedWiretap.java 2008-07-14 14:32:42 UTC (rev 21026)
+++ labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/soa/esb/actions/ContentBasedWiretap.java 2008-07-14 15:06:06 UTC (rev 21027)
@@ -123,11 +123,7 @@
}
}
- public void initialise() {
- if (messageMulticaster.getRecipientCount() == 0) {
- _logger.info("Missing or empty destination list - This action class won't have any effect");
- }
- }
+ public void initialise() { }
/**
* Router the message to one or more destinations, using the
@@ -204,12 +200,6 @@
*/
protected void checkMyParms() throws ConfigurationException {
_ruleSet = _config.getAttribute(ListenerTagNames.RULE_SET_TAG);
- /* now longer a required attribute
- if (_ruleSet == null) {
- throw new ConfigurationException("Required attribute "
- + ListenerTagNames.RULE_SET_TAG + " not found.");
- }
- */
_ruleLanguage = _config.getAttribute(ListenerTagNames.RULE_LANGUAGE_TAG);
String ruleReload = _config.getAttribute(ListenerTagNames.RULE_RELOAD_TAG);
if (ruleReload != null && "true".equals(ruleReload)) {
More information about the jboss-svn-commits
mailing list