|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--one.world.util.AbstractHandler
Implementation of an abstract event handler. An abstract event handler provides a skeleton implementation of an event handler as well as utility methods to send events and respond to events.
| Constructor Summary | |
AbstractHandler()
Create a new abstract handler. |
|
| Method Summary | |
void |
handle(Event e)
Handle the specified event. |
protected abstract boolean |
handle1(Event e)
Handle the specified event. |
protected boolean |
isNotValid(Event e)
Validate the specified event. |
protected void |
respond(Event request,
Event response)
Send the specified response to the source of the specified request. |
protected void |
respond(EventHandler remote,
Event request,
Event response)
Remotely send the specified response to the source of the specified request. |
protected void |
respond(EventHandler remote,
Event request,
SymbolicHandler source,
Throwable x)
Remotely send an exceptional event to the source of the specified request. |
protected void |
respond(EventHandler remote,
Object closure,
Event request,
Event response)
Remotely send the specified response to the source of the specified request. |
protected void |
respond(EventHandler remote,
Object closure,
Event request,
SymbolicHandler source,
Throwable x)
Remotely send an exceptional event to the source of the specified request. |
protected void |
respond(Event request,
Throwable x)
Send an exceptional event to the source of the specified request. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public AbstractHandler()
| Method Detail |
public void handle(Event e)
handle1() on the specified event. After that, it
simply returns for handled events. For unhandled events, it logs
exceptional events to the system log and responds with an unknown
event exception to the source of the specified event for all
other events.handle in interface EventHandlere - The event to handle.handle1(one.world.core.Event)protected abstract boolean handle1(Event e)
true. Otherwise it
returns false.
Note that the specified event may not be valid. Event handlers
can easily validate an event by using the isNotValid(Event) method.
e - The event to handle.true if the specified event was handled
by this method.protected boolean isNotValid(Event e)
false. Otherwise, it responds to the source of the
event with an appropriate tuple exception and returns
true.e - The event to validate.true if the specified event is not
valid.
protected void respond(Event request,
Event response)
request - The request to whose source to respond to.response - The response.NullPointerException - Signals that either of the specified
events is null.
protected void respond(Event request,
Throwable x)
request - The request to whose source to respond to.x - The throwable for the new exceptional event.NullPointerException - Signals that either request or
x is null.ExceptionalEvent
protected void respond(EventHandler remote,
Event request,
Event response)
null.remote - The event handler for processing remote events.request - The request.response - The response.NullPointerException - Signals that remote,
request, or response
is null.IllegalArgumentException - Signals that request.source is
not a symbolic handler.
protected void respond(EventHandler remote,
Object closure,
Event request,
Event response)
remote - The event handler for processing remote events.closure - The closure for the newly created remote event.request - The request.response - The response.NullPointerException - Signals that remote,
request, or response
is null.IllegalArgumentException - Signals that request.source is
not a symbolic handler.
protected void respond(EventHandler remote,
Event request,
SymbolicHandler source,
Throwable x)
null.remote - The event handler for processing remote events.request - The request.source - The source for the new exceptional event.x - The throwable for the new exceptional event.NullPointerException - Signals that remote,
request, source, or
x is null.IllegalArgumentException - Signals that request.source or
source is not a symbolic handler.ExceptionalEvent
protected void respond(EventHandler remote,
Object closure,
Event request,
SymbolicHandler source,
Throwable x)
remote - The event handler for processing remote events.closure - The closure for the newly created remote event.request - The request.source - The source for the new exceptional event.x - The throwable for the new exceptional event.NullPointerException - Signals that remote,
request, source, or
x is null.IllegalArgumentException - Signals that request.source or
source is not a symbolic handler.ExceptionalEvent
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||