1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17

We have therefore developed a set of Java classes, that is data structures and their associated handling methods, for several types of molecular object, including physicochemical (Fig.11) and 3D-structural information. These have been incorporated within an ObjectStore PSE object database21and a set of Java routines for retrieving and displaying the information from the database using the RMI in a multi-user application has been developed. Each new instance of a molecular object is created from file and added with an identifying key into a (persistence capable) Java hashtable, which is stored within the object database when complete. Methods for accessing the database are defined in a connection class which is called by the remote object running as a background process on the server. Sample code for the multi-user remote object, which manages multiple client calls by activating an array of threads, and for registering it with the RMI registry are shown in Figures 12 and 13.

import java.rmi.*;

public class RMIStart {

public static void main(String args[]) {

Install the security manager. This prevents this (server) object from accessing remote (client)
objects loaded from another host

System.setSecurityManager(new RMISecurityManager());

// // //

try {

// // //

Tell the process where it is - otherwise it will use the machines local name and give a security exception when you try to attach client object (applet).

System.getProperties().put("java.rmi.server.hostname",
" www.this_domain_name");

remotePSE servlet = new remotePSE ();
Naming.rebind("serviceName", servlet);
servlet.setMainThread(Thread.currentThread());

} catch (Exception e) { }
}

}

Figure 12. Standalone program to register the remote object
'remotePSE' with the RMI registry