public class DatabaseEventManager extends Object
Modifier and Type | Class and Description |
---|---|
private static class |
DatabaseEventManager.Type
Types for aggregation.
|
Modifier and Type | Field and Description |
---|---|
private boolean |
accumulateDataStoreEvents
Indicates whether DataStoreEvents should be accumulated and fired as one
event on demand.
|
private DatabaseEventManager.Type |
currentDataStoreEventType
The type of the current DataStoreEvent to be accumulated.
|
private List<DataStoreListener> |
dataListenerList
Holds the listeners for data store changes
|
private HashSetModifiableDBIDs |
dataStoreObjects
The objects that were changed in the current DataStoreEvent.
|
private List<ResultListener> |
resultListenerList
Holds the listeners for result changes.
|
Constructor and Description |
---|
DatabaseEventManager() |
Modifier and Type | Method and Description |
---|---|
void |
accumulateDataStoreEvents()
Collects successive insertion, deletion or update events.
|
void |
addListener(DataStoreListener l)
Adds a
DataStoreListener for a DataStoreEvent
posted after the content of the database changes. |
void |
addListener(ResultListener l)
Adds a
ResultListener to be notified on new results. |
private void |
fireObjectChanged(DBIDRef object,
DatabaseEventManager.Type type)
Handles a DataStoreEvent with the specified type.
|
void |
fireObjectInserted(DBIDRef insertion)
Event when a new object was inserted.
|
protected void |
fireObjectRemoved(DBIDRef deletion)
Event when an objects was removed / deleted.
|
private void |
fireObjectsChanged(DBIDs objects,
DatabaseEventManager.Type type)
Handles a DataStoreEvent with the specified type.
|
void |
fireObjectsInserted(DBIDs insertions)
Event when new objects are inserted.
|
protected void |
fireObjectsRemoved(DBIDs deletions)
Event when objects were removed / deleted.
|
void |
fireObjectsUpdated(DBIDRef update)
Event when an object was changed / updated.
|
void |
fireObjectsUpdated(DBIDs updates)
Event when objects have changed / were updated.
|
void |
fireResultAdded(Result r,
Result parent)
Informs all registered
ResultListener that a new result was
added. |
void |
fireResultRemoved(Result r,
Result parent)
Informs all registered
ResultListener that a new result has
been removed. |
void |
flushDataStoreEvents()
Fires all collected insertion, deletion or update events as one
DataStoreEvent, i.e. notifies all registered DataStoreListener how the
content of the database has been changed since
accumulateDataStoreEvents() was called. |
void |
removeListener(DataStoreListener l)
Removes a
DataStoreListener previously added with
addListener(DataStoreListener) . |
void |
removeListener(ResultListener l)
Removes a
ResultListener previously added with
addListener(ResultListener) . |
private List<DataStoreListener> dataListenerList
private List<ResultListener> resultListenerList
private boolean accumulateDataStoreEvents
private DatabaseEventManager.Type currentDataStoreEventType
private HashSetModifiableDBIDs dataStoreObjects
public void accumulateDataStoreEvents()
flushDataStoreEvents()
is called or a
different event type occurs.flushDataStoreEvents()
,
DataStoreEvent
public void flushDataStoreEvents()
accumulateDataStoreEvents()
was called.public void addListener(DataStoreListener l)
DataStoreListener
for a DataStoreEvent
posted after the content of the database changes.l
- the listener to addremoveListener(DataStoreListener)
,
DataStoreListener
,
DataStoreEvent
public void removeListener(DataStoreListener l)
DataStoreListener
previously added with
addListener(DataStoreListener)
.l
- the listener to removeaddListener(DataStoreListener)
,
DataStoreListener
,
DataStoreEvent
public void addListener(ResultListener l)
ResultListener
to be notified on new results.l
- the listener to addremoveListener(ResultListener)
,
ResultListener
,
Result
public void removeListener(ResultListener l)
ResultListener
previously added with
addListener(ResultListener)
.l
- the listener to removeaddListener(ResultListener)
,
ResultListener
,
Result
public void fireObjectsInserted(DBIDs insertions)
insertions
- the objects that have been insertedpublic void fireObjectInserted(DBIDRef insertion)
insertion
- the object that was insertedpublic void fireObjectsUpdated(DBIDs updates)
updates
- the objects that have been updatedpublic void fireObjectsUpdated(DBIDRef update)
update
- the object that was updatedprotected void fireObjectsRemoved(DBIDs deletions)
deletions
- the objects that have been removedprotected void fireObjectRemoved(DBIDRef deletion)
deletion
- the object that has was removedprivate void fireObjectsChanged(DBIDs objects, DatabaseEventManager.Type type)
accumulateDataStoreEvents
is set, otherwise all registered
DataStoreListener
will be notified immediately that the
content of the database has been changed.objects
- the objects that have been changed, i.e. inserted, deleted
or updatedprivate void fireObjectChanged(DBIDRef object, DatabaseEventManager.Type type)
accumulateDataStoreEvents
is set, otherwise all registered
DataStoreListener
will be notified immediately that the
content of the database has been changed.object
- the object that has been changed, i.e. inserted, deleted or
updatedpublic void fireResultAdded(Result r, Result parent)
ResultListener
that a new result was
added.r
- New child result addedparent
- Parent result that was added toCopyright © 2015 ELKI Development Team, Lehr- und Forschungseinheit für Datenbanksysteme, Ludwig-Maximilians-Universität München. License information.