Java Reference
In-Depth Information
proxy :
LocalProxy
server :
BasicServer
dbm :
VolatileDB
employee :
Employee
User
: Counter UI
btConnect
_action
Perfomed
connect
(code,
password)
authenticate
(code,
password)
getEmployee
(code)
employee
getPassword
employee
employee
Figure 14.12
Connect scenario
obtained through the
DBManager
interface from the database, then the
provided password is compared with the one stored in the database.
14.5.3
Implementation
The interface
MarketProxy
defines all the operations that are available to the
counter terminal.
package
Counter;
public interface
MarketProxy {
// connect() and disconnect () implement the login/logout
// scenario
public
String connect(
long
employee, String password)
throws
Exception;
public
void disconnect();
// define the current customer and get its name
public
String getCustomer(
long
code)
throws
Exception;
// information about a product consists of name and price
public
String getName(
long
item)
throws
Exception ;
public
double getPrice(
long
item)
throws
Exception ;
// notify that the given quantity of a product has been
// bought
public
void buy(
long
item,
long
quantity)
throws
Exception;
// terminate the transaction and produces the sum of the
// check
public
void endTransaction()
throws
Exception;
}