|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.rmi.server.RemoteObject
java.rmi.server.RemoteServer
java.rmi.server.UnicastRemoteObject
net.dpml.station.server.DefaultModel
public abstract class DefaultModel
A abstract base class that established an event queue and handles event dispatch operations for listeners declared in classes extending this base class.
| Field Summary |
|---|
| Fields inherited from class java.rmi.server.RemoteObject |
|---|
ref |
| Constructor Summary | |
|---|---|
DefaultModel(Logger logger)
Creation of a new model. |
|
DefaultModel(String name)
Creation of a new model. |
|
| Method Summary | |
|---|---|
protected void |
addListener(EventListener listener)
Add a listener to the set of listeners handled by the model. |
protected void |
enqueueEvent(EventObject event)
Enqueue an event for delivery to registered listeners unless there are no registered listeners. |
protected void |
enqueueEvent(EventObject event,
boolean asynchronouse)
Enqueue an event for delivery to registered listeners unless there are no registered listeners. |
protected Object |
getLock()
Return the internal synchronization lock object. |
protected Logger |
getLogger()
Return the assigned logging channel. |
protected EventListener[] |
listeners()
Return the set of registered listeners. |
protected abstract void |
processEvent(EventObject event)
Abstract method that must be implemented by classes extending this class. |
protected void |
removeListener(EventListener listener)
Remove a listener to the set of listeners handled by this producer. |
| Methods inherited from class java.rmi.server.UnicastRemoteObject |
|---|
clone, exportObject, exportObject, exportObject, unexportObject |
| Methods inherited from class java.rmi.server.RemoteServer |
|---|
getClientHost, getLog, setLog |
| Methods inherited from class java.rmi.server.RemoteObject |
|---|
equals, getRef, hashCode, toString, toStub |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public DefaultModel(String name)
throws RemoteException
name - the name used to construct a logging channel
RemoteException - if a remote exception occurs
public DefaultModel(Logger logger)
throws NullPointerException,
RemoteException
logger - the assigned logging channel
NullPointerException - if the supplied logging channel is null
RemoteException - if a remote exception occurs| Method Detail |
|---|
protected abstract void processEvent(EventObject event)
protected void processEvent( EventObject eventObject )
{
if( eventObject instanceof ProxyEvent )
{
ProxyEvent event = (ProxyEvent) eventObject;
processProxyEvent( event );
}
else
{
final String error =
"Event class not recognized: " + eventObject.getClass().getName();
throw new IllegalArgumentException( error );
}
}
private void processProxyEvent( ProxyEvent event )
{
EventListener[] listeners = super.listeners();
for( int i=0; i<listeners.length; i++ )
{
EventListener listener = listeners[i];
if( listener instanceof ProxyListener )
{
ProxyListener pl = (ProxyListener) listener;
try
{
pl.proxyChanged( event );
}
catch( Throwable e )
{
final String error =
"Proxy listener notification error.";
getLogger().error( error, e );
}
}
}
}
event - the event to processprotected Logger getLogger()
protected void addListener(EventListener listener)
throws NullPointerException
listener - the event listener
NullPointerException - if the supplied listener is null
protected void removeListener(EventListener listener)
throws NullPointerException
listener - the event listener
NullPointerException - if the supplied listener is nullprotected Object getLock()
protected EventListener[] listeners()
protected void enqueueEvent(EventObject event)
event - the event object to add to the queue
protected void enqueueEvent(EventObject event,
boolean asynchronouse)
event - the event object to add to the queueasynchronouse - TRUE if asynchronouse delivery
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||