Back to contents.
Compiling and running
To compile your RMI application against NexusRMI, your application needs to import
from the nexusrmi package instead of from the java.rmi package.
Basically, this comes down to changing every fully qualified name of an RMI object
and changing all import-statements for RMI classes. For instance:
For convenience, the scripts java2nexus and nexus2java will transform your application to use NexusRMI and JavaRMI respectively. Use this script with caution, however, since it will indiscriminately replace all occurrences without regarding any context.
Changing these fully qualified class names should be the only change to your source code required. Next step is to compile all your Java source files with your favorite Java compiler. This compilation step must be done first, since nexusrmis and nexusrmic may require the class files generated in this step (as does the original rmic).
The next step is to decide on the serialization protocol to use. NexusRMI comes with two serialization protocols: Javaize (which uses standard Java serialization) and Nexusize (which is NexusRMI's native object serialization protocol). If you are using Javaize you can proceed to the last step. If you are using Nexusize read the following carefully. The following is also important when devising your own object serialization protocol and want to use NexusRMI's facilities to add serialization methods to objects.
If using Nexusize you have to identify all classes that implement the interface java.io.Serializable. These classes must be transformed by nexusrmis to support the actual serialization process. For instance, if both MyClass and MyList implement java.io.Serializable, the following command must be run:
nexusrmis MyClass.java MyList.java
Currently, it is not possible to pass system classes that implement java.iu.Serializable, because these do not contain the necessary traversal routines. The classes java.lang.String, java.lang.Class, and java.lang.Vector have direct support for serialization in NexusRMI, so only these system classes can be passed as parameter or return value.
The last step is to generate stub and skeleton classes for all remote objects. The stub / skeleton compiler in NexusRMI is nexusrmic If MyRemote is a remote class, the stub and skeleton classes are generated by the following command:
Running the code is no different than running JavaRMI applications, except that the registry is run by nexusrmiregistry.
Back to contents.