Package edu.caltech.nanodb.server
Class EventDispatcher
- java.lang.Object
-
- edu.caltech.nanodb.server.EventDispatcher
-
public class EventDispatcher extends java.lang.Object
The event dispatcher notifies listeners when specific events occur within the database, related to command execution and row processing operations. It is used, for example, to implement index updates and other such tasks.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.ArrayList<CommandEventListener>
commandEventListeners
A list of listeners that are registered to receive command event notifications.private static org.apache.logging.log4j.Logger
logger
A logging object for reporting anything interesting that happens.private java.util.ArrayList<RowEventListener>
rowEventListeners
A list of listeners that are registered to receive row event notifications.
-
Constructor Summary
Constructors Constructor Description EventDispatcher()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addCommandEventListener(CommandEventListener listener)
Add another command-event listener to the event dispatcher.void
addRowEventListener(RowEventListener listener)
Add another row-event listener to the event dispatcher.void
fireAfterCommandExecuted(Command cmd)
void
fireAfterRowDeleted(TableInfo tblFileInfo, Tuple oldValues)
void
fireAfterRowInserted(TableInfo tblFileInfo, Tuple newTuple)
void
fireAfterRowUpdated(TableInfo tblFileInfo, Tuple oldValues, Tuple newTuple)
void
fireBeforeCommandExecuted(Command cmd)
void
fireBeforeRowDeleted(TableInfo tblFileInfo, Tuple oldTuple)
void
fireBeforeRowInserted(TableInfo tblFileInfo, Tuple newValues)
void
fireBeforeRowUpdated(TableInfo tblFileInfo, Tuple oldTuple, Tuple newValues)
-
-
-
Field Detail
-
logger
private static org.apache.logging.log4j.Logger logger
A logging object for reporting anything interesting that happens.
-
commandEventListeners
private java.util.ArrayList<CommandEventListener> commandEventListeners
A list of listeners that are registered to receive command event notifications.
-
rowEventListeners
private java.util.ArrayList<RowEventListener> rowEventListeners
A list of listeners that are registered to receive row event notifications.
-
-
Method Detail
-
addCommandEventListener
public void addCommandEventListener(CommandEventListener listener)
Add another command-event listener to the event dispatcher. Note that if the same component is added twice, it will receive two notifications for each event.- Parameters:
listener
- the command-event listener
-
addRowEventListener
public void addRowEventListener(RowEventListener listener)
Add another row-event listener to the event dispatcher. Note that if the same component is added twice, it will receive two notifications for each event.- Parameters:
listener
- the row-event listener
-
fireBeforeCommandExecuted
public void fireBeforeCommandExecuted(Command cmd)
- Parameters:
cmd
- the command that is about to be executed
-
fireAfterCommandExecuted
public void fireAfterCommandExecuted(Command cmd)
- Parameters:
cmd
- the command that was just executed
-
fireBeforeRowUpdated
public void fireBeforeRowUpdated(TableInfo tblFileInfo, Tuple oldTuple, Tuple newValues)
-
fireAfterRowUpdated
public void fireAfterRowUpdated(TableInfo tblFileInfo, Tuple oldValues, Tuple newTuple)
-
-