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

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Wed Aug 9 12:10:13 EDT 2006


Author: daniel.brum at jboss.com
Date: 2006-08-09 12:10:10 -0400 (Wed, 09 Aug 2006)
New Revision: 5645

Added:
   labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/java/src/org/jboss/soa/esb/samples/loanbroker/creditagency/CreditCheckRequest.java
Removed:
   labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/java/src/org/jboss/soa/esb/samples/loanbroker/creditagency/CreditAgencyJMSConsumer.java
   labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/java/src/org/jboss/soa/esb/samples/loanbroker/creditagency/CreditCheckRequest.java
   labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/java/src/org/jboss/soa/esb/samples/loanbroker/creditagency/CreditCheckResponse.java
Modified:
   labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/java/src/org/jboss/soa/esb/samples/loanbroker/actions/ProcessCreditRequest.java
   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/creditagency/CreditAgency.java
   labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/java/src/org/jboss/soa/esb/samples/loanbroker/domain/LoanBrokerConstants.java
   labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/java/src/org/jboss/soa/esb/samples/loanbroker/web/LoanBrokerWS.java
Log:


Modified: labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/java/src/org/jboss/soa/esb/samples/loanbroker/actions/ProcessCreditRequest.java
===================================================================
--- labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/java/src/org/jboss/soa/esb/samples/loanbroker/actions/ProcessCreditRequest.java	2006-08-09 16:09:45 UTC (rev 5644)
+++ labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/java/src/org/jboss/soa/esb/samples/loanbroker/actions/ProcessCreditRequest.java	2006-08-09 16:10:10 UTC (rev 5645)
@@ -24,7 +24,7 @@
 
 import org.jboss.soa.esb.actions.*;
 import org.jboss.soa.esb.samples.loanbroker.creditagency.CreditCheckRequest;
-import org.jboss.soa.esb.samples.loanbroker.creditagency.CreditCheckResponse;
+import org.jboss.soa.esb.samples.loanbroker.creditagency.CreditCheckResponseNotification;
 import org.jboss.soa.esb.helpers.*;
 import org.jboss.soa.esb.listeners.GpListener;
 
@@ -41,7 +41,7 @@
 public class ProcessCreditRequest extends AbstractAction 
 {
 	public Integer creditScore;
-	private CreditCheckResponse creditResponse;
+	private CreditCheckResponseNotification creditResponse;
 	
 	/*
 	 * the base class sets up the parameter tree being used by this action class
@@ -83,9 +83,10 @@
 		//use a dummy score between 0 and 10
 		Random generator = new Random();
 		creditScore = new Integer(generator.nextInt(10));
-		//create our Response
-		creditResponse = new CreditCheckResponse(creditRequest.requestID, creditScore);
+		//create our Response						     
+		creditResponse = new CreditCheckResponseNotification(creditRequest.requestID, creditScore, creditRequest.customerID);
 		
+		
 	} //________________________________
 	
 	
@@ -97,7 +98,7 @@
 	//you could also send back a special ERROR credit score condition
 	public Serializable getOkNotification()
 	  {
-		  return creditResponse;
+		  return creditResponse.toArray();
 	  }
 	
 	@Override

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-09 16:09:45 UTC (rev 5644)
+++ labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/java/src/org/jboss/soa/esb/samples/loanbroker/actions/ProcessCreditResponse.java	2006-08-09 16:10:10 UTC (rev 5645)
@@ -26,14 +26,16 @@
 import java.util.Random;
 
 import javax.jms.Message;
-import javax.jms.ObjectMessage;
+import javax.jms.*;
 
 import org.jboss.soa.esb.actions.*;
 import org.jboss.soa.esb.helpers.DomElement;
 import org.jboss.soa.esb.listeners.GpListener;
 import org.jboss.soa.esb.samples.loanbroker.creditagency.CreditCheckRequest;
-import org.jboss.soa.esb.samples.loanbroker.creditagency.CreditCheckResponse;
+import org.jboss.soa.esb.samples.loanbroker.creditagency.CreditCheckResponseNotification;
 
+import com.thoughtworks.xstream.XStream;
+
 public class ProcessCreditResponse extends AbstractAction {
 
 	public ProcessCreditResponse(DomElement p_oP, Object p_oCurr) throws Exception {
@@ -49,8 +51,15 @@
 			throw new Exception("Message must be a ObjectMessage");
 		System.out.println(m_oCurr);
 		
-		//TODO: add code here to send information (customer and credit info to banks)
+		//TODO: add code here to send information (customer and credit info to banks)		
+		String[] msg = (String[])((ObjectMessage)m_oCurr).getObject();				
+		CreditCheckResponseNotification response = CreditCheckResponseNotification.fromArray(msg);
+		System.out.println(response.toString());
 		
+		
+		
+		
+		
 	} //________________________________
 	
 	public Serializable getOkNotification()

Modified: labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/java/src/org/jboss/soa/esb/samples/loanbroker/creditagency/CreditAgency.java
===================================================================
--- labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/java/src/org/jboss/soa/esb/samples/loanbroker/creditagency/CreditAgency.java	2006-08-09 16:09:45 UTC (rev 5644)
+++ labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/java/src/org/jboss/soa/esb/samples/loanbroker/creditagency/CreditAgency.java	2006-08-09 16:10:10 UTC (rev 5645)
@@ -24,7 +24,7 @@
 
 public class CreditAgency {
 	
-	public static CreditCheckResponse getScore(CreditCheckRequest cr) {
+	public static CreditCheckResponseNotification getScore(CreditCheckRequest cr) {
 		//return a score based on some random formula here
 		
 		return null;

Deleted: labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/java/src/org/jboss/soa/esb/samples/loanbroker/creditagency/CreditAgencyJMSConsumer.java
===================================================================
--- labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/java/src/org/jboss/soa/esb/samples/loanbroker/creditagency/CreditAgencyJMSConsumer.java	2006-08-09 16:09:45 UTC (rev 5644)
+++ labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/java/src/org/jboss/soa/esb/samples/loanbroker/creditagency/CreditAgencyJMSConsumer.java	2006-08-09 16:10:10 UTC (rev 5645)
@@ -1,93 +0,0 @@
-/*
- * 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.creditagency;
-
-import org.jboss.soa.esb.samples.loanbroker.domain.*;
-
-import javax.jms.*;
-import javax.naming.*;
-
-import org.jboss.soa.esb.helpers.*;
-
-public class CreditAgencyJMSConsumer
-{
-  private static final String JNDI_URL	= "localhost";
-  private static final String JNDI_TYPE = AppServerContext.SERVER_TYPE.jboss.toString();
- 
-  private Context m_oCtx;
-  
-  public CreditAgencyJMSConsumer(String p_sq) throws Exception
-  {
-	  consumeMessages(p_sq);
-	  Thread.sleep(1000);
-  } //__________________________________
-  
-  public int consumeMessages(String p_sName) throws Exception
-  { 
-	
-	m_oCtx = AppServerContext.getServerContext(JNDI_TYPE,JNDI_URL);
-	
-	MessageConsumer oCns = null;
-	oCns = getQueue(p_sName);
-	while (true)
-	{	Message oMsg = oCns.receive(200);
-		if (null==oMsg)		{			
-			continue;		}
-		CreditCheckRequest creditRequest = (CreditCheckRequest)((ObjectMessage)oMsg).getObject();
-//		System.out.println("JBossESB - CreditAgency received request...");
-//		dumpMessage(oMsg);	//comment out if you don't want to see this
-		
-	}
-	
-  } //__________________________________
-  
-  void dumpMessage(Message pM)
-  {
-	  System.out.println(pM);
-  } //__________________________________
-  
-  QueueReceiver getQueue(String p_sJndi) throws Exception
-  {
-	QueueConnection oQconn = null;
-	QueueSession 	oQsess = null;
-	QueueConnectionFactory qcf = (QueueConnectionFactory) m_oCtx
-		.lookup("ConnectionFactory");
-
-	oQconn = qcf.createQueueConnection();
-	oQsess = oQconn.createQueueSession(false
-			,QueueSession.AUTO_ACKNOWLEDGE);
-    javax.jms.Queue oQueue 
-    	= (javax.jms.Queue) m_oCtx.lookup(p_sJndi);
-
-    QueueReceiver oRcv = oQsess.createReceiver(oQueue);
-    oQconn.start();
-    return oRcv;
-  } //__________________________________
-
-  
-  
-  public static void main(String args[]) throws Exception{
-	  new CreditAgencyJMSConsumer(LoanBrokerConstants.CREDIT_CHECK_QUEUE);
-  }
-  
-} //____________________________________________________________________________

Deleted: labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/java/src/org/jboss/soa/esb/samples/loanbroker/creditagency/CreditCheckRequest.java
===================================================================
--- labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/java/src/org/jboss/soa/esb/samples/loanbroker/creditagency/CreditCheckRequest.java	2006-08-09 16:09:45 UTC (rev 5644)
+++ labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/java/src/org/jboss/soa/esb/samples/loanbroker/creditagency/CreditCheckRequest.java	2006-08-09 16:10:10 UTC (rev 5645)
@@ -1,63 +0,0 @@
-/*
- * 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.creditagency;
-
-import java.io.Serializable;
-import java.util.Date;
-import java.util.Random;
-
-/*
- * class used internally by the CreditAgency
- */
-
-public class CreditCheckRequest implements Serializable{
-	public long requestID;
-	public long timestamp;
-	public double amount, salary;
-	public int duration;
-	public String customerID;
-	
-	private static Random generator = new Random();
-	
-
-	public CreditCheckRequest(double salary, int duration, String customerID) {
-		this.requestID=generator.nextLong() ;	//generate some fake random number for the request ID
-		this.timestamp=System.currentTimeMillis();
-		this.salary=salary;
-		this.duration=duration;
-		this.customerID=customerID;
-	}
-	
-	public String toString() {
-		StringBuffer buff = new StringBuffer("-- JBossESB: CreditRequest message --");
-		buff.append("\t requestID: " + this.requestID + "\n");
-		buff.append("\t customer ID: " + this.customerID + "\n");
-		buff.append("\t amount: " + this.amount + "\n");
-		buff.append("\t duration: " + this.duration + "\n");
-		buff.append("\t salary: " + this.salary + "\n");
-		
-		return buff.toString();
-		
-	}
-
-}

Added: labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/java/src/org/jboss/soa/esb/samples/loanbroker/creditagency/CreditCheckRequest.java
===================================================================
--- labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/java/src/org/jboss/soa/esb/samples/loanbroker/creditagency/CreditCheckRequest.java	2006-08-09 16:09:45 UTC (rev 5644)
+++ labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/java/src/org/jboss/soa/esb/samples/loanbroker/creditagency/CreditCheckRequest.java	2006-08-09 16:10:10 UTC (rev 5645)
@@ -0,0 +1,63 @@
+/*
+ * 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.creditagency;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.util.Random;
+
+/*
+ * class used internally by the CreditAgency
+ */
+
+public class CreditCheckRequest implements Serializable{
+	public long requestID;
+	public long timestamp;
+	public double amount, salary;
+	public int duration;
+	public long customerID;
+	
+	private static Random generator = new Random();
+	
+
+	public CreditCheckRequest(double salary, int duration, long customerID) {
+		this.requestID=generator.nextLong() ;	//generate some fake random number for the request ID
+		this.timestamp=System.currentTimeMillis();
+		this.salary=salary;
+		this.duration=duration;
+		this.customerID=customerID;
+	}
+	
+	public String toString() {
+		StringBuffer buff = new StringBuffer("-- JBossESB: CreditRequest message --");
+		buff.append("\t requestID: " + this.requestID + "\n");
+		buff.append("\t customer ID: " + this.customerID + "\n");
+		buff.append("\t amount: " + this.amount + "\n");
+		buff.append("\t duration: " + this.duration + "\n");
+		buff.append("\t salary: " + this.salary + "\n");
+		
+		return buff.toString();
+		
+	}
+
+}

Deleted: labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/java/src/org/jboss/soa/esb/samples/loanbroker/creditagency/CreditCheckResponse.java
===================================================================
--- labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/java/src/org/jboss/soa/esb/samples/loanbroker/creditagency/CreditCheckResponse.java	2006-08-09 16:09:45 UTC (rev 5644)
+++ labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/java/src/org/jboss/soa/esb/samples/loanbroker/creditagency/CreditCheckResponse.java	2006-08-09 16:10:10 UTC (rev 5645)
@@ -1,38 +0,0 @@
-/*
- * 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.creditagency;
-
-import java.io.*;
-
-public class CreditCheckResponse implements Serializable{
-	public long requestID;
-	public long timestamp;
-	public int score;	
-	
-	public CreditCheckResponse(long requestID, int score) {
-		this.requestID=requestID;
-		this.timestamp=System.currentTimeMillis();
-		this.score = score;
-	}
-
-}

Modified: labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/java/src/org/jboss/soa/esb/samples/loanbroker/domain/LoanBrokerConstants.java
===================================================================
--- labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/java/src/org/jboss/soa/esb/samples/loanbroker/domain/LoanBrokerConstants.java	2006-08-09 16:09:45 UTC (rev 5644)
+++ labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/java/src/org/jboss/soa/esb/samples/loanbroker/domain/LoanBrokerConstants.java	2006-08-09 16:10:10 UTC (rev 5645)
@@ -27,6 +27,8 @@
 	public static final String CREDIT_CHECK_REQUEST 	= "creditRequest";
 	public static final String CREDIT_CHECK_RESPONSE 	= "creditResponse";
 	public static final String CREDIT_CHECK_QUEUE 		= "queue/A";
+	public static final String BANK_JMS_REQUEST_QUEUE	= "queue/C";
 	
+	
 
 }

Modified: labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/java/src/org/jboss/soa/esb/samples/loanbroker/web/LoanBrokerWS.java
===================================================================
--- labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/java/src/org/jboss/soa/esb/samples/loanbroker/web/LoanBrokerWS.java	2006-08-09 16:09:45 UTC (rev 5644)
+++ labs/jbossesb/trunk/product/docs/samples/trailblazer/bankloanbrokerdemo/java/src/org/jboss/soa/esb/samples/loanbroker/web/LoanBrokerWS.java	2006-08-09 16:10:10 UTC (rev 5645)
@@ -71,7 +71,7 @@
 		//we are not going to persist this request to the CreditAgency, but you might want to...
 		CreditCheckRequest creditRequest = new CreditCheckRequest(customer.salary,
 				customer.loanDuration,
-				Long.toString(lUid));			
+				lUid);			
 		
 		//Send the CreditRequest to the queue which the JMSListener process is listening to
 		Context ctx = AppServerContext.getServerContext(JNDI_TYPE, JNDI_URL);




More information about the jboss-svn-commits mailing list