ccs.cpc
Interface ProfileModelElement


public interface ProfileModelElement

As more sophisticated internal viewers come onstream, they will require state persistence. For example, the Audio Player currently has controls whose state must be persisted. Since the set of viewers is extensible, so we need an extensible mechanism to store their state. Hence this interface. The ProfileModel contains a hashmap of ProfileModelElement entries. Each entry is keyed by the classname of the implementing class, plus a unique key string provided via the interface. The InternalViewerRuntime provides interface to get and put each viewer's instance. All implementing classes must provide a sensible, public, default constructor. This will be used to instantiate the element when loading the profile.


Method Summary
 java.lang.String getKey()
          Returns a unique key.
 int getVersion()
          Returns the current marshal version of this object.
 void marshal(java.io.DataOutputStream dos)
          Marshal the state onto the supplied stream.
 void unmarshal(java.io.DataInputStream dis, int marshalver)
          Unmarshal the state from the supplied stream.
 

Method Detail

getVersion

int getVersion()
Returns the current marshal version of this object. This mechanism - the same as used by CDBObjects - provides a simple way for a class to evolve without causing compatibility issues: always marshal to the current version, but include unmarshal code to cope with earlier versions.

Returns:
The current marshal version of the implementing object.

getKey

java.lang.String getKey()
Returns a unique key. This key is qualified before use, by the name of the implementing class. If the viewer in question shares one instance of its state between all instances of itself - a common approach - then this method can safely return the empty string. It can't return null.

Returns:
The key of this object.

marshal

void marshal(java.io.DataOutputStream dos)
             throws java.io.IOException
Marshal the state onto the supplied stream.

Parameters:
dos - the stream to marshal onto.
Throws:
java.io.IOException

unmarshal

void unmarshal(java.io.DataInputStream dis,
               int marshalver)
               throws java.io.IOException
Unmarshal the state from the supplied stream. Caution: your method must not throw IOExceptions, except those which come from dis.

Parameters:
dis - The stream to unmarshal from.
marshalver - The marshal version of the stream - i.e. it may represent a previous version of the object.
Throws:
java.io.IOException