Java Reference
In-Depth Information
It is possible to run a simplified test running both the client and the server
on the same machine. In this case a single application contains all the
components:
import Counter.SocketProxy;
import CounterUI.*;
import Market.StubFactory;
import Market.BasicServer;
import MarketDB.VolatileDB;
public class TestSocket {
public static void main(String[] args) {
// instantiate the server components
BasicServer server # new BasicServer(new VolatileDB());
StubFactory factory # new StubFactory(server);
( new Thread(factory)).start();
// instantiate the client components
CounterFrame counter # new CounterFrame(
new SocketProxy("localhost"));
counter.show();
BarCodeReaderUI reader # new BarCodeReaderUI();
reader.setLocation(100300);
reader.show();
reader.setListener(counter);
}}
14.7
Prototype 4: Data persistence
This prototype addresses the last concern: the persistence of data. Infor-
mation on product availability and history of acquisitions must be kept
permanently. The former information is required so that new supplies can
be ordered, the latter so that statistical analyses can be performed.
14.7.1
Analysis
The main issue in this prototype is the selection of the information that has
to be made persistent. The pertinent information has been identified in
Section 14.5.1 and described in Figure 14.9; we don't need to add anything.
The persistence solution to be adopted must guarantee ease of access to
specific information. For instance, given a key we should be able to access
the corresponding employee. In addition it should be possible to store the
associations between product data.
14.7.2
Design
Decision point
What kind of persistent storage do we use?
 
Search WWH ::




Custom Search