Java Reference
In-Depth Information
// return the price of an item,
// 0.0 if it doesn't exist
public double getPrice( long item);
// start a new transaction
public long startTransaction( long customer,
long employee)
throws Exception;
// buy a given quantity of a product
// in a transaction
public void buy( long item, long quantity,
long transaction)
throws Exception;
// terminate the transaction
public void endTransaction( long transaction)
throws Exception;
The class BasicServer implements the market interface and manages the
requests coming from a client. The methods are very simple: they forward
the requests to the database and extract the required information from the
data provided by the database.
package Market;
import MarketDB.*;
public class BasicServer
implements Market {
private DBManager dbm;
public BasicServer(DBManager db) {
dbm # db;
public String authenticate( long code, String password){
Employee employee # dbm.getEmployee(code);
if (employee ! # null &&
return null ;
public String getCustomer( long code){
Customer customer # dbm.getCustomer(code);
if (customer ## null ) return null ;
public String getName( long code){
Item it # dbm.getItem(code);
if (it ## null ) return null ;
Search WWH ::

Custom Search