|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.extex.framework.Registrar
public final class Registrar
This class provides a means to reconnect an object to a managing factory after it has been disconnected. The disconnection might happen during serialization and deserialization.
Whenever an object is deserialized Java tries to invoke the method readResolve(). This method can be used to get a hand on the object which has just been reconstructed. Here the object can be replaced by another one or some other action can be applied.
Any class which is serializable and wants to participate in the reconnection
mechanism should implement the method readResolve. In this
method the method reconnect() of the
Registrar should be invoked. This is shown in the
following example:
protected Object readResolve() throws ObjectStreamException {
return Registrar.reconnect(this);
}
Any factory which wants to participate in the reconnection mechanism should
implement the interface
RegistrarObserver.
Finally, before an object is deserialized, the interested parties should
register an observer at the Registrar.
| Method Summary | |
|---|---|
static Registrar |
activate()
Create a new registrar and activate it. |
static void |
activate(Registrar registrar)
Activate an existing registrar. |
static void |
deactivate(Registrar registrar)
Deactivate a currently active registrar. |
static java.lang.Object |
reconnect(java.lang.Object object)
Find anyone interested in an object and let the object be integrated into their views of the world. |
static java.lang.Object |
register(RegistrarObserver observer,
java.lang.Class<?> type)
This method registers an observer at the registrar. |
static boolean |
unregister(java.lang.Object obs)
Unregister a registered observer. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static Registrar activate()
throws RegistrarException
RegistrarException - in case of an error
public static void activate(Registrar registrar)
throws RegistrarException
registrar - the registrar to activate
RegistrarException - in case of an error
public static void deactivate(Registrar registrar)
throws RegistrarException
registrar - the registrar to deactivate
RegistrarException - in case of an error
public static java.lang.Object reconnect(java.lang.Object object)
throws RegistrarException
object - the object to reconnect
RegistrarException - in case of a problem with registration
public static java.lang.Object register(RegistrarObserver observer,
java.lang.Class<?> type)
observer - the observertype - the interface or class to be observed
public static boolean unregister(java.lang.Object obs)
obs - the reference obtained from register()
true iff the removal succeeded
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||