WebLogic Server 6.1 Code Examples, BEA Systems, Inc.

examples.iiop.ejb.stateless.server.wls
Class TraderBean

java.lang.Object
  |
  +--examples.iiop.ejb.stateless.server.wls.TraderBean
All Implemented Interfaces:
javax.ejb.EnterpriseBean, java.io.Serializable, javax.ejb.SessionBean

public class TraderBean
extends java.lang.Object
implements javax.ejb.SessionBean

TraderBean is a stateless Session Bean. This bean illustrates:

Author:
Copyright (c) 1998 by WebLogic, Inc. All Rights Reserved., Copyright (c) 1999-2001 by BEA Systems, Inc. All Rights Reserved.

Constructor Summary
TraderBean()
           
 
Method Summary
 TradeResult buy(java.lang.String stockSymbol, int shares)
          Buys shares of a stock for a named customer.
 TradeResult buyRemote(java.lang.String stockSymbol, int shares)
          Buys shares of a stock for a named customer from a delegate bean.
 void createRemote()
          Creates a remote instance of the Trader bean.
 void ejbActivate()
          This method is required by the EJB Specification, but is not used by this example.
 void ejbCreate()
          This method corresponds to the create method in the home interface "TraderHome.java".
 void ejbPassivate()
          This method is required by the EJB Specification, but is not used by this example.
 void ejbRemove()
          This method is required by the EJB Specification, but is not used by this example.
 TradeResult sell(java.lang.String stockSymbol, int shares)
          Sells shares of a stock for a named customer.
 TradeResult sellRemote(java.lang.String stockSymbol, int shares)
          Sells shares of a stock for a named customer from a delegate bean.
 void setSessionContext(javax.ejb.SessionContext ctx)
          Sets the session context.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TraderBean

public TraderBean()
Method Detail

buy

public TradeResult buy(java.lang.String stockSymbol,
                       int shares)
                throws java.rmi.RemoteException
Buys shares of a stock for a named customer.
Parameters:
customerName - String Customer name
stockSymbol - String Stock symbol
shares - int Number of shares to buy
Returns:
TradeResult Trade Result if there is an error while buying the shares

buyRemote

public TradeResult buyRemote(java.lang.String stockSymbol,
                             int shares)
                      throws java.rmi.RemoteException,
                             javax.ejb.CreateException
Buys shares of a stock for a named customer from a delegate bean.
Parameters:
customerName - String Customer name
stockSymbol - String Stock symbol
shares - int Number of shares to buy
Returns:
TradeResult Trade Result if there is an error while buying the shares

createRemote

public void createRemote()
                  throws javax.ejb.CreateException
Creates a remote instance of the Trader bean.
Throws:
javax.ejb.CreateException - if there is a communications or systems failure
See Also:
Trader

ejbActivate

public void ejbActivate()
This method is required by the EJB Specification, but is not used by this example.
Specified by:
ejbActivate in interface javax.ejb.SessionBean

ejbCreate

public void ejbCreate()
               throws javax.ejb.CreateException
This method corresponds to the create method in the home interface "TraderHome.java". The parameter sets of the two methods are identical. When the client calls TraderHome.create(), the container allocates an instance of the EJBean and calls ejbCreate().
Throws:
javax.ejb.CreateException - if there is a communications or systems failure
See Also:
Trader

ejbPassivate

public void ejbPassivate()
This method is required by the EJB Specification, but is not used by this example.
Specified by:
ejbPassivate in interface javax.ejb.SessionBean

ejbRemove

public void ejbRemove()
               throws java.rmi.RemoteException
This method is required by the EJB Specification, but is not used by this example.
Specified by:
ejbRemove in interface javax.ejb.SessionBean

sell

public TradeResult sell(java.lang.String stockSymbol,
                        int shares)
                 throws java.rmi.RemoteException
Sells shares of a stock for a named customer.
Parameters:
customerName - String Customer name
stockSymbol - String Stock symbol
shares - int Number of shares to buy
Returns:
TradeResult Trade Result if there is an error while selling the shares

sellRemote

public TradeResult sellRemote(java.lang.String stockSymbol,
                              int shares)
                       throws java.rmi.RemoteException,
                              javax.ejb.CreateException
Sells shares of a stock for a named customer from a delegate bean.
Parameters:
customerName - String Customer name
stockSymbol - String Stock symbol
shares - int Number of shares to buy
Returns:
TradeResult Trade Result if there is an error while selling the shares

setSessionContext

public void setSessionContext(javax.ejb.SessionContext ctx)
Sets the session context.
Specified by:
setSessionContext in interface javax.ejb.SessionBean
Parameters:
ctx - SessionContext Context for session

Documentation is available at
http://e-docs.bea.com/wls/docs61

Copyright © 2001 BEA Systems, Inc. All Rights Reserved.