public abstract class AbstractSource<S extends SourceUpdatedEvent,B extends Backend<T>,E extends SourceUpdatedEvent,T extends BackendUpdatedEvent> extends Object implements Source<S,B,T>
| Modifier and Type | Method and Description |
|---|---|
void |
addSourceListener(SourceListener<S> listener)
Adds a listener that gets called whenever something changes.
|
void |
close()
|
protected void |
fireClosedUnexpectedly(SourceClosedUnexpectedlyEvent<S,B,T> e) |
protected void |
fireSourceUpdated(S e)
Notifies registered listeners that the source has been updated.
|
B[] |
getBackends()
Gets the backends registered to this source.
|
protected boolean |
isClosed() |
void |
removeSourceListener(SourceListener<S> listener)
Removes a listener so that changes to the source are no longer sent.
|
void |
setEventListeners(List<? extends ProtempaEventListener> eventListeners) |
void |
unrecoverableErrorOccurred(UnrecoverableBackendErrorEvent e)
Some unrecoverable error occurred while using a backend module, like a
connection to a server was lost.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitbackendUpdatedpublic void setEventListeners(List<? extends ProtempaEventListener> eventListeners)
setEventListeners in interface Source<S extends SourceUpdatedEvent,B extends Backend<T>,T extends BackendUpdatedEvent>public final B[] getBackends()
getBackends in interface Source<S extends SourceUpdatedEvent,B extends Backend<T>,T extends BackendUpdatedEvent>null.public final void addSourceListener(SourceListener<S> listener)
addSourceListener in interface Source<S extends SourceUpdatedEvent,B extends Backend<T>,T extends BackendUpdatedEvent>listener - a DataSourceListener.public final void removeSourceListener(SourceListener<S> listener)
removeSourceListener in interface Source<S extends SourceUpdatedEvent,B extends Backend<T>,T extends BackendUpdatedEvent>listener - a DataSourceListener.protected void fireSourceUpdated(S e)
e - a SourceUpdatedEvent representing an update.SourceListenerprotected void fireClosedUnexpectedly(SourceClosedUnexpectedlyEvent<S,B,T> e)
public void close()
throws SourceCloseException
Source as a listener to the Backends
provided to the constructor.
Must be called by subclasses, or proper cleanup will not occur.close in interface AutoCloseableclose in interface Source<S extends SourceUpdatedEvent,B extends Backend<T>,T extends BackendUpdatedEvent>SourceCloseExceptionprotected boolean isClosed()
public final void unrecoverableErrorOccurred(UnrecoverableBackendErrorEvent e)
BackendListenerunrecoverableErrorOccurred in interface BackendListener<T extends BackendUpdatedEvent>e - a UnrecoverableBackendErrorEvent.Copyright © 2012–2017 Emory University. All rights reserved.