[jboss-svn-commits] JBL Code SVN: r7956 - labs/jbossesb/trunk/product/samples/trailblazer2/esb/src/org/jboss/soa/esb/samples/trailblazer/actions

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Wed Nov 29 17:55:58 EST 2006


Author: daniel.brum at jboss.com
Date: 2006-11-29 17:55:56 -0500 (Wed, 29 Nov 2006)
New Revision: 7956

Added:
   labs/jbossesb/trunk/product/samples/trailblazer2/esb/src/org/jboss/soa/esb/samples/trailblazer/actions/BankResponseActions.java
Log:


Added: labs/jbossesb/trunk/product/samples/trailblazer2/esb/src/org/jboss/soa/esb/samples/trailblazer/actions/BankResponseActions.java
===================================================================
--- labs/jbossesb/trunk/product/samples/trailblazer2/esb/src/org/jboss/soa/esb/samples/trailblazer/actions/BankResponseActions.java	2006-11-29 22:51:18 UTC (rev 7955)
+++ labs/jbossesb/trunk/product/samples/trailblazer2/esb/src/org/jboss/soa/esb/samples/trailblazer/actions/BankResponseActions.java	2006-11-29 22:55:56 UTC (rev 7956)
@@ -0,0 +1,69 @@
+package org.jboss.soa.esb.samples.trailblazer.actions;
+
+/*
+ * 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
+ */
+
+import org.apache.log4j.Logger;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.samples.trailblazer.loanbroker.Customer;
+import org.jboss.soa.esb.samples.trailblazer.loanbroker.CustomerMasterFile;
+
+import org.jboss.soa.esb.samples.trailblazer.util.ProcessEmail;
+
+public class BankResponseActions {
+	
+	protected Message 		_message;
+	protected ConfigTree	_config;
+	
+	private static Logger _logger = Logger.getLogger(BankResponseActions.class);
+	
+	public BankResponseActions(ConfigTree config) { _config = config; }
+	
+	public Message processResponseFromJMSBank(Message message) throws Exception {
+		_message = message;
+		
+		_logger.debug("message received: " + new String(message.getBody().getContents()));
+		
+		//get the response from the bank and set it in the customer
+		ConfigTree tree = ConfigTree.fromXml(new String(message.getBody().getContents()));		
+		String quoteID = tree.getAttribute("quoteId");
+		String rate = tree.getAttribute("interestRate");
+		String errorCode = tree.getAttribute("errorCode");
+		String ssn = tree.getAttribute("customerUID");
+		
+		//load up from the same place the war creates the customer records from
+		CustomerMasterFile.getCustomers();
+		Customer customer = CustomerMasterFile.getCustomer(ssn);
+		customer.quoteID = quoteID;
+		customer.rateOffered = rate;
+		customer.quoteCode = errorCode;
+		
+		_logger.debug("preparing to send the quote response via email to customer");
+		ProcessEmail email = new ProcessEmail(customer);
+		email.sendEmail();
+		
+		
+		
+		return message;
+	}
+
+}




More information about the jboss-svn-commits mailing list