Listing 2

import java.rmi.server.*;

public class TradingSystemImpl 
    extends UnicastRemoteObject 
    implements TradingSystemInterface
{
    public TradeStockImpl() throws RemoteException {
    }
    // From C++ Trading System (ITradeStock)
    public String GetQuote(String stock) 
      throws RemoteException {
        return doGetQuote(stock);
    }
    public String Buy(String stock, int shares) 
      throws RemoteException {
        return doBuy(stock, shares);
    }
    public String Sell(String stock, int shares) 
      throws RemoteException {
        return doSell(stock, shares);
    }
    // From C++ Portfolio Manager
    public String AddHolding(String stock, int shares) 
      throws RemoteException {
        return doAddHolding(stock, shares);
    }
    public String RemoveHolding(String stock, int shares) 
      throws RemoteException {
        return doRemoveHolding(stock, shares);
    }
    public String EnumHoldings() 
      throws RemoteException {
        return doEnumHoldings(stock, shares);
    }
    public String GetPosition(String stock) 
      throws RemoteException {
        return doGetPosition(stock, shares);
    }
    /////////////////////////////////////////////////////
    // Native methods 
    // Calls the actual C++ Trading System (ITradeStock)
    native protected String doGetQuote(String stock);
    native protected String doBuy(String stock, int shares);
    native protected String doSell(String stock, int shares);
    // Calls the actual C++ Portfolio Manager
    native protected String doAddHolding(String stock, int shares);
    native protected String doRemoveHolding(String stock, int shares)
    native protected String doEnumHoldings()
    native protected String doGetPosition(String stock)
}