geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jgenen...@apache.org
Subject svn commit: r399419 - in /geronimo/daytrader/trunk/modules/ejb/src/main/java/org/apache/geronimo/samples/daytrader: TradeAction.java TradeServices.java direct/TradeDirect.java ejb/Trade.java ejb/TradeBean.java soap/TradeWebSoapProxy.java
Date Wed, 03 May 2006 20:40:02 GMT
Author: jgenender
Date: Wed May  3 13:40:01 2006
New Revision: 399419

URL: http://svn.apache.org/viewcvs?rev=399419&view=rev
Log:
Convert ejbs to throw RemoteExceptions to apply to spec

Modified:
    geronimo/daytrader/trunk/modules/ejb/src/main/java/org/apache/geronimo/samples/daytrader/TradeAction.java
    geronimo/daytrader/trunk/modules/ejb/src/main/java/org/apache/geronimo/samples/daytrader/TradeServices.java
    geronimo/daytrader/trunk/modules/ejb/src/main/java/org/apache/geronimo/samples/daytrader/direct/TradeDirect.java
    geronimo/daytrader/trunk/modules/ejb/src/main/java/org/apache/geronimo/samples/daytrader/ejb/Trade.java
    geronimo/daytrader/trunk/modules/ejb/src/main/java/org/apache/geronimo/samples/daytrader/ejb/TradeBean.java
    geronimo/daytrader/trunk/modules/ejb/src/main/java/org/apache/geronimo/samples/daytrader/soap/TradeWebSoapProxy.java

Modified: geronimo/daytrader/trunk/modules/ejb/src/main/java/org/apache/geronimo/samples/daytrader/TradeAction.java
URL: http://svn.apache.org/viewcvs/geronimo/daytrader/trunk/modules/ejb/src/main/java/org/apache/geronimo/samples/daytrader/TradeAction.java?rev=399419&r1=399418&r2=399419&view=diff
==============================================================================
--- geronimo/daytrader/trunk/modules/ejb/src/main/java/org/apache/geronimo/samples/daytrader/TradeAction.java
(original)
+++ geronimo/daytrader/trunk/modules/ejb/src/main/java/org/apache/geronimo/samples/daytrader/TradeAction.java
Wed May  3 13:40:01 2006
@@ -23,6 +23,7 @@
 import org.apache.geronimo.samples.daytrader.ejb.*;
 import org.apache.geronimo.samples.daytrader.util.*;
 
+import java.rmi.RemoteException;
 import java.util.Collection;
 import java.math.BigDecimal;
 // import com.ibm.websphere.cache.*;
@@ -373,7 +374,7 @@
 	 *            the account userID to lookup
 	 * @return User account data in AccountDataBean
 	 */
-	public AccountDataBean getAccountData(String userID) throws javax.ejb.FinderException, Exception
{
+	public AccountDataBean getAccountData(String userID) throws javax.ejb.FinderException, RemoteException
{
 		if (Log.doActionTrace())
 			Log.trace("TradeAction:getAccountData", userID);
 		AccountDataBean accountData = null;

Modified: geronimo/daytrader/trunk/modules/ejb/src/main/java/org/apache/geronimo/samples/daytrader/TradeServices.java
URL: http://svn.apache.org/viewcvs/geronimo/daytrader/trunk/modules/ejb/src/main/java/org/apache/geronimo/samples/daytrader/TradeServices.java?rev=399419&r1=399418&r2=399419&view=diff
==============================================================================
--- geronimo/daytrader/trunk/modules/ejb/src/main/java/org/apache/geronimo/samples/daytrader/TradeServices.java
(original)
+++ geronimo/daytrader/trunk/modules/ejb/src/main/java/org/apache/geronimo/samples/daytrader/TradeServices.java
Wed May  3 13:40:01 2006
@@ -201,7 +201,7 @@
 	 * @return User account data in AccountDataBean
 	 */	
    public AccountDataBean getAccountData(String userID) 
-   		throws javax.ejb.FinderException, Exception;                              
+   		throws javax.ejb.FinderException, RemoteException;                              
 
 	/**
 	 * Return an AccountProfileDataBean for userID providing the users profile

Modified: geronimo/daytrader/trunk/modules/ejb/src/main/java/org/apache/geronimo/samples/daytrader/direct/TradeDirect.java
URL: http://svn.apache.org/viewcvs/geronimo/daytrader/trunk/modules/ejb/src/main/java/org/apache/geronimo/samples/daytrader/direct/TradeDirect.java?rev=399419&r1=399418&r2=399419&view=diff
==============================================================================
--- geronimo/daytrader/trunk/modules/ejb/src/main/java/org/apache/geronimo/samples/daytrader/direct/TradeDirect.java
(original)
+++ geronimo/daytrader/trunk/modules/ejb/src/main/java/org/apache/geronimo/samples/daytrader/direct/TradeDirect.java
Wed May  3 13:40:01 2006
@@ -30,6 +30,7 @@
 import org.apache.geronimo.samples.daytrader.ejb.TradeHome;
 import org.apache.geronimo.samples.daytrader.util.*;
 
+import java.rmi.RemoteException;
 import java.sql.Connection;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
@@ -1001,8 +1002,9 @@
 	 * @see TradeServices#getAccountData(String)
 	 */
 	public AccountDataBean getAccountData(String userID)
-	throws Exception
+	throws RemoteException
 	{
+        try{
 		AccountDataBean accountData = null;
 		Connection conn=null;
 		try
@@ -1024,6 +1026,9 @@
 			releaseConn(conn);
 		}
 		return accountData;		
+        }catch (Exception e){
+           throw new RemoteException(e.getMessage(),e); 
+        }
 	}
 	private AccountDataBean getAccountData(Connection conn, String userID)
 	throws Exception

Modified: geronimo/daytrader/trunk/modules/ejb/src/main/java/org/apache/geronimo/samples/daytrader/ejb/Trade.java
URL: http://svn.apache.org/viewcvs/geronimo/daytrader/trunk/modules/ejb/src/main/java/org/apache/geronimo/samples/daytrader/ejb/Trade.java?rev=399419&r1=399418&r2=399419&view=diff
==============================================================================
--- geronimo/daytrader/trunk/modules/ejb/src/main/java/org/apache/geronimo/samples/daytrader/ejb/Trade.java
(original)
+++ geronimo/daytrader/trunk/modules/ejb/src/main/java/org/apache/geronimo/samples/daytrader/ejb/Trade.java
Wed May  3 13:40:01 2006
@@ -19,6 +19,8 @@
 
 import javax.ejb.EJBObject;
 import java.rmi.Remote;
+import java.rmi.RemoteException;
+
 import org.apache.geronimo.samples.daytrader.*;
 
 public interface Trade extends EJBObject, TradeServices, Remote {
@@ -35,7 +37,7 @@
 	 * @param orderID the Order being queued for processing
 	 * @return OrderDataBean providing the status of the completed order
 	 */
-	public void queueOrderOnePhase(Integer orderID) throws Exception;
+	public void queueOrderOnePhase(Integer orderID) throws RemoteException;
    /**
 	 * Complete the Order identified by orderID in a One Phase commit
 	 * 
@@ -50,7 +52,7 @@
 	 * @param orderID the Order to complete
 	 * @return OrderDataBean providing the status of the completed order
 	 */
-	public OrderDataBean completeOrderOnePhase(Integer orderID) throws Exception;
+	public OrderDataBean completeOrderOnePhase(Integer orderID) throws RemoteException;
 	
    /**
 	 * Complete the Order identified by orderID in a One Phase commit
@@ -69,7 +71,7 @@
 	 * @param orderID the Order to complete
 	 * @return OrderDataBean providing the status of the completed order
 	 */	
-    public OrderDataBean completeOrderOnePhaseDirect(Integer orderID) throws Exception;
+    public OrderDataBean completeOrderOnePhaseDirect(Integer orderID) throws RemoteException;
 
    /**
 	 * Cancel the Order identefied by orderID
@@ -83,7 +85,7 @@
 	 * @param orderID the Order to complete
 	 * @return OrderDataBean providing the status of the completed order
 	 */
-	public void cancelOrderOnePhase(Integer orderID) throws Exception;
+	public void cancelOrderOnePhase(Integer orderID) throws RemoteException;
 
    /**
 	 * Cancel the Order identefied by orderID
@@ -100,7 +102,7 @@
 	 * @param orderID the Order to complete
 	 * @return OrderDataBean providing the status of the completed order
 	 */
-	public void cancelOrderOnePhaseDirect(Integer orderID) throws Exception;
+	public void cancelOrderOnePhaseDirect(Integer orderID) throws RemoteException;
 	
    /**
 	 * Publish to the QuoteChange Message topic when a stock
@@ -114,7 +116,7 @@
 	 * @param oldPrice - the price of the Quote before the update
 	 * @param sharesTraded - the quantity of sharesTraded
 	 */
-	public void publishQuotePriceChange(QuoteDataBean quoteData, java.math.BigDecimal oldPrice,
java.math.BigDecimal changeFactor,  double sharesTraded) throws Exception;
+	public void publishQuotePriceChange(QuoteDataBean quoteData, java.math.BigDecimal oldPrice,
java.math.BigDecimal changeFactor,  double sharesTraded) throws RemoteException;
 	
 	/**
 	 * provides a simple session method with no database access to test performance of a simple
@@ -123,7 +125,7 @@
 	 * @param NetValue current value
 	 * @return return on investment as a percentage
 	 */
-	public double investmentReturn(double investment, double NetValue) throws Exception;	
+	public double investmentReturn(double investment, double NetValue) throws RemoteException;

 
 	/**
 	 * This method provides a ping test for a 2-phase commit operation
@@ -131,6 +133,6 @@
 	 * @param symbol to lookup
 	 * @return quoteData after sending JMS message
 	 */	
-	public QuoteDataBean pingTwoPhase(String symbol) throws Exception;
+	public QuoteDataBean pingTwoPhase(String symbol) throws RemoteException;
 
 }

Modified: geronimo/daytrader/trunk/modules/ejb/src/main/java/org/apache/geronimo/samples/daytrader/ejb/TradeBean.java
URL: http://svn.apache.org/viewcvs/geronimo/daytrader/trunk/modules/ejb/src/main/java/org/apache/geronimo/samples/daytrader/ejb/TradeBean.java?rev=399419&r1=399418&r2=399419&view=diff
==============================================================================
--- geronimo/daytrader/trunk/modules/ejb/src/main/java/org/apache/geronimo/samples/daytrader/ejb/TradeBean.java
(original)
+++ geronimo/daytrader/trunk/modules/ejb/src/main/java/org/apache/geronimo/samples/daytrader/ejb/TradeBean.java
Wed May  3 13:40:01 2006
@@ -24,6 +24,7 @@
 import org.apache.geronimo.samples.daytrader.util.*;
 
 import java.math.BigDecimal;
+import java.rmi.RemoteException;
 import java.util.Collection;
 import java.util.ArrayList;
 import java.util.Iterator;
@@ -117,10 +118,14 @@
 	 */
 
 	public void queueOrderOnePhase(Integer orderID)
-	    	throws javax.jms.JMSException, Exception
+	    	throws RemoteException
 	{
+        try{
 		if (Log.doTrace() ) Log.trace("TradeBean:queueOrderOnePhase", orderID);
 		queueOrderInternal(orderID, false);
+        } catch (Exception e){
+            throw new RemoteException(e.getMessage(), e);
+        }
 	}
 	
 	class quotePriceComparator implements java.util.Comparator {
@@ -301,7 +306,7 @@
 	}
 	
 	public void publishQuotePriceChange(QuoteDataBean quoteData, BigDecimal oldPrice, BigDecimal
changeFactor, double sharesTraded)
-	throws Exception
+	throws RemoteException
 	{
 		if ( publishQuotePriceChange == false)
 			return;
@@ -338,13 +343,17 @@
 		}
 		catch (Exception e)
 		{
-			throw e; // pass the exception back
+			throw new RemoteException(e.getMessage(),e); // pass the exception back
 		}	
 		finally {	
+            try{
 			if (conn != null)
 				conn.close();	
 			if (sess != null)
 			sess.close();		
+            }catch (Exception e){
+                throw new RemoteException(e.getMessage(),e); // pass the exception back
+            }
 		}
 	}	
 
@@ -574,9 +583,13 @@
 	//completeOrderOnePhase method is deployed w/ TXN_REQUIRES_NEW
 	//thus the completeOrder call from the MDB should not require a 2-phase commit
 	public OrderDataBean completeOrderOnePhase(Integer orderID)
-	throws Exception {
+	throws RemoteException {
+        try{
 		if (Log.doTrace()) Log.trace("TradeBean:completeOrderOnePhase", orderID);		
 		return completeOrderInternal(orderID);
+        }catch (Exception e){
+            throw new RemoteException(e.getMessage(),e);
+        }
 	}
 
 	private OrderDataBean completeOrderInternal(Integer orderID) 
@@ -687,16 +700,24 @@
 	// Basically these methods are deployed as txn requires new and invoke TradeDirect methods
 	// There is no mechanism outside of EJB to start a new transaction
     public OrderDataBean completeOrderOnePhaseDirect(Integer orderID)
-    throws Exception {
+    throws RemoteException {
+        try{
     	if (Log.doTrace())
     		Log.trace("TradeBean:completeOrderOnePhaseDirect -- completing order by calling TradeDirect
orderID=" +orderID);
-    	return (new org.apache.geronimo.samples.daytrader.direct.TradeDirect()).completeOrderOnePhase(orderID);
+    	    return (new org.apache.geronimo.samples.daytrader.direct.TradeDirect()).completeOrderOnePhase(orderID);
+        } catch (Exception e){
+            throw new RemoteException(e.getMessage(),e);
+        }
     }
 	public void cancelOrderOnePhaseDirect(Integer orderID) 
-	throws Exception {
+	throws RemoteException {
+        try{
     	if (Log.doTrace())
     		Log.trace("TradeBean:cancelOrderOnePhaseDirect -- cancelling order by calling TradeDirect
orderID=" +orderID);
 		(new org.apache.geronimo.samples.daytrader.direct.TradeDirect()).cancelOrderOnePhase(orderID);
+        } catch(Exception e){
+            throw new RemoteException(e.getMessage(),e);
+        }
 	}
 	
 	
@@ -717,9 +738,13 @@
 	//cancelOrderOnePhase method is deployed w/ TXN_REQUIRES_NEW
 	//thus the completeOrder call from the MDB should not require a 2-phase commit
 	public void cancelOrderOnePhase(Integer orderID)
-	throws Exception {
+	throws RemoteException {
+        try{
 		if (Log.doTrace()) Log.trace("TradeBean:cancelOrderOnePhase", orderID);		
 		cancelOrderInternal(orderID);
+        } catch (Exception e){
+            throw new RemoteException(e.getMessage(),e);
+        }
 	}
 	
 	
@@ -1045,7 +1070,7 @@
 	 * @return return on investment as a percentage
 	 */
 	public double investmentReturn(double investment, double NetValue)
-		throws Exception
+		throws RemoteException
 	{
 		if (Log.doTrace())
 			Log.trace("TradeBean:investmentReturn");
@@ -1063,8 +1088,9 @@
 	 * @return quoteData after sending JMS message
 	 */	
 	public QuoteDataBean pingTwoPhase(String symbol)
-	throws Exception
+	throws RemoteException
 	{
+        try{
 		if (Log.doTrace()) Log.trace("TradeBean:pingTwoPhase", symbol);
 		QuoteDataBean quoteData=null;
 		Connection conn = null;
@@ -1099,6 +1125,9 @@
 		}			
 		
 		return quoteData;
+        } catch (Exception e){
+            throw new RemoteException(e.getMessage(),e);
+        }
 	}	
 
 

Modified: geronimo/daytrader/trunk/modules/ejb/src/main/java/org/apache/geronimo/samples/daytrader/soap/TradeWebSoapProxy.java
URL: http://svn.apache.org/viewcvs/geronimo/daytrader/trunk/modules/ejb/src/main/java/org/apache/geronimo/samples/daytrader/soap/TradeWebSoapProxy.java?rev=399419&r1=399418&r2=399419&view=diff
==============================================================================
--- geronimo/daytrader/trunk/modules/ejb/src/main/java/org/apache/geronimo/samples/daytrader/soap/TradeWebSoapProxy.java
(original)
+++ geronimo/daytrader/trunk/modules/ejb/src/main/java/org/apache/geronimo/samples/daytrader/soap/TradeWebSoapProxy.java
Wed May  3 13:40:01 2006
@@ -119,7 +119,7 @@
 	/* (non-Javadoc)
 	 * @see org.apache.geronimo.samples.daytrader.TradeServices#getAccountData(java.lang.String)
 	 */
-	public AccountDataBean getAccountData(String userID) throws FinderException, Exception {
+	public AccountDataBean getAccountData(String userID) throws FinderException, RemoteException
{
 		return convertAccountDataBean(getTrade().getAccountData(userID));
 	}
 



Mime
View raw message