The MarshalledObject class provides a flexible mechanism for passing persistence or initialization data through the ActivationDesc , registered with rmid , rather than hard-coding values into the implementation's class file. It uses the MarshalledObject , that it passes to the ActivationDesc constructor, to store a java.io.File object that represents the location of the persistent data storage. In this example, if the persistentObjectStore.ser file exists, the activatable object implementation is initialized with the persistent data from the file. Otherwise, if the file does not exist, the activatable object initializes itself as though this is the first time a client has tried to send data. The reason for this omission, is that the client code for activatable objects is no different than the RMI client code for accessing non-activatable remote objects.
Activation is strictly a server-side implementation decision.
For this example, the remote interface will be examples.activation.YetAnotherRemoteInterface . For this example, the implementation class will be examples.activation.MyPersistentClass . Make the appropriate imports in the implementation class import java.io. In the constructor, in addition to the normal call to the superclass's constructor, in this example the MarshalledObject is used to specify the file name of the persistent data store. If the file object doesn't exist, then the vector is manually initialized.