Java Reference
In-Depth Information
L ISTING 6.1 Continued
private void sendCommand(char c){
try {
out.writeChar;
System.out.println(“BankClient: send command “+c);
} catch (IOException exce) {
System.out.println(“BankClient- “+exce);
}
}
private void cache(String name, byte[] b) {
try {
FileOutputStream fos = new FileOutputStream(“cached/”+name);
fos.write(b);
fos.close();
} catch (IOException exce) {
System.out.println(“BankClient- cache(“+name+”) “+exce);
}
}
public static void main(String[] args) throws IOException {
OldBankClient c = new OldBankClient();
}
}
N OTE
For simplicity, we have omitted all security and other details in the code, to better
concentrate on the deployment aspects. One can imagine an SSL (Secure Socket
Layer) connection, and/or a more elaborate protocol, managing classloader permis-
sions, and so on.
Essentially, after the connection is established, our application performs some business trans-
action. When finished, it closes the connection. Branch Offices were allowed to modify the
code to add their special services (mortgages, statistics, and so on) as needed.
Once the socket connection is established with the server, our protocol (a very simple one) per-
mits the following operations:
Search WWH ::




Custom Search