[jboss-svn-commits] JBL Code SVN: r5696 - labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/java/src/org/jboss/soa/esb/samples/loanbroker/actions

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Thu Aug 10 03:07:15 EDT 2006


Author: daniel.brum at jboss.com
Date: 2006-08-10 03:07:14 -0400 (Thu, 10 Aug 2006)
New Revision: 5696

Added:
   labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/java/src/org/jboss/soa/esb/samples/loanbroker/actions/ProcessBanksFileResponse.java
Modified:
   labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/java/src/org/jboss/soa/esb/samples/loanbroker/actions/ProcessCreditResponse.java
Log:


Added: labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/java/src/org/jboss/soa/esb/samples/loanbroker/actions/ProcessBanksFileResponse.java
===================================================================
--- labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/java/src/org/jboss/soa/esb/samples/loanbroker/actions/ProcessBanksFileResponse.java	2006-08-10 06:44:53 UTC (rev 5695)
+++ labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/java/src/org/jboss/soa/esb/samples/loanbroker/actions/ProcessBanksFileResponse.java	2006-08-10 07:07:14 UTC (rev 5696)
@@ -0,0 +1,82 @@
+/*
+* 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.
+*/
+
+
+package org.jboss.soa.esb.samples.loanbroker.actions;
+
+import java.io.File;
+import java.io.Serializable;
+
+import org.jboss.soa.esb.actions.AbstractFileAction;
+import org.jboss.soa.esb.common.SystemProperties;
+import org.jboss.soa.esb.helpers.DomElement;
+import org.jboss.soa.esb.jboss.loanbroker.util.*;
+import org.jboss.soa.esb.samples.loanbroker.domain.Customer;
+import org.jboss.soa.esb.samples.loanbroker.domain.LoanOffer;
+import org.jboss.soa.esb.services.IpersistHandler;
+import org.jboss.soa.esb.services.PersistHandlerFactory;
+
+public class ProcessBanksFileResponse extends AbstractFileAction {
+
+	public ProcessBanksFileResponse(DomElement p_oP, Object p_oCurr) {
+		super(p_oP, p_oCurr);		
+	}
+
+	@Override
+	public void processCurrentObject() throws Exception {
+		m_oLogger.info("processObject was called with <<"
+				+m_oCurr.toString()+">>");
+		
+		File file = getInputFile();
+		String message = FileUtil.readTextFile(file);
+		String[] messagePart = message.split(",");
+		long uid = Long.parseLong(messagePart[3]);
+		
+//		get handle to the JBossESB Event object store
+		IpersistHandler esbHandler = PersistHandlerFactory.getPersistHandler("remote", 
+				SystemProperties.getJndiServerType(), 
+				SystemProperties.getJndiServerURL());
+
+		Customer customer = (Customer) esbHandler.getObject(org.jboss.soa.esb.samples.loanbroker.domain.Customer.class, uid);
+//		now update this Customer with a LoanOffer based on the response from the Bank
+		LoanOffer offer = new LoanOffer((String)null);
+		offer.setField(LoanOffer.ATTRIB.interestRate, 	messagePart[0]);
+		offer.setField(LoanOffer.ATTRIB.quoteId, 		messagePart[1]);
+		offer.setField(LoanOffer.ATTRIB.errorCode, 		messagePart[2]);
+//		System.out.println("CUSTOMER JUST BEFORE OFFER IS ADDED");
+//		System.out.println(customer.);
+		customer.addOffer(offer);
+		esbHandler.rplObject(customer);	//update the object store
+
+	}
+
+	@Override
+	public Serializable getOkNotification() {
+		return "OK NOTIF: " + this.getClass();
+	}
+
+	@Override
+	public Serializable getErrorNotification() {
+		return "ERR NOTIFICATION: "+this.getClass();
+	}
+
+}

Modified: labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/java/src/org/jboss/soa/esb/samples/loanbroker/actions/ProcessCreditResponse.java
===================================================================
--- labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/java/src/org/jboss/soa/esb/samples/loanbroker/actions/ProcessCreditResponse.java	2006-08-10 06:44:53 UTC (rev 5695)
+++ labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/java/src/org/jboss/soa/esb/samples/loanbroker/actions/ProcessCreditResponse.java	2006-08-10 07:07:14 UTC (rev 5696)
@@ -64,7 +64,7 @@
 		//get the credit response information and send to banks		
 		String[] msg = (String[])((ObjectMessage)m_oCurr).getObject();				
 		CreditCheckResponseNotification response = CreditCheckResponseNotification.fromArray(msg);
-		System.out.println(response.toString());
+//		System.out.println(response.toString());
 		
 //		get handle to the JBossESB Event object store
 		IpersistHandler esbHandler = PersistHandlerFactory.getPersistHandler("remote", 
@@ -75,11 +75,9 @@
 		CreditRating rating = new CreditRating((String)null);
 		rating.setScore(response.score);
 		customer.setRating(rating);
-		esbHandler.rplObject(customer);	//update the object store
+		esbHandler.rplObject(customer);	//update the object store		
 		
-		//TODO: send JMS message to bank
 		sendJMSToBank(customer);
-		//TODO: send file csv to bank
 		sendFileToBank(customer);
 	} //________________________________
 	




More information about the jboss-svn-commits mailing list