Java Reference
In-Depth Information
L ISTING 6.5 An Example Of The BankServer Download Policies File
6
#—-Bank Server download Policies file—-
client0-replace-items=BankClient.class;Clazz.class;BankClientLoader.java
client0-installed=1.0
client0-policy=newest
client0-launch=com.marinilli.b2.c6.bank.BankClient
This property file states that regarding the “ client0 ”client application, whenever it issues
another CHECK command, the files listed at line 2 have to be sent to its cache when there are
versions newer than 1.0 (that is recorded as the currently installed one). The main class to be
launched the next time the application helper is executed is specified in line 5. This is quite a
simplistic and unrealistic approach to resolution (as described in Chapter 2). Nevertheless, it
gives a concrete idea of how servers could keep track of client-deployed configurations, allow-
ing for total control over client applications.
Now let's have a look at what new applications will look like. Given our implementation, all
old code still runs on our application helper (that is, the OldBankClient class in Listing 6.1)
while newly designed applications are more rationally organized in a service provider class,
BankClientManager (detailed in Listing 6.6) and various transaction-oriented classes as the
one shown in Listing 6.7.
L ISTING 6.6 The BankClientManager Class
package com.marinilli.b2.c6.bank;
import java.lang.reflect.Method;
import java.lang.reflect.Constructor;
import java.io.*;
import java.net.MalformedURLException;
import java.net.Socket;
/**
* Chapter 6 - This class encapsulates business-related utility services
*
* @author Mauro Marinilli
* @version 1.0
*/
public class BankClientManager {
private String[] arguments;
private Socket socket = null;
private DataOutputStream out = null;
private DataInputStream in = null;
Search WWH ::




Custom Search