Interface CellSetListener
-
public interface CellSetListener
Listener interface for receiving events when the contents of aCellSet
have changed.NOTE: This functionality is experimental and is subject to change or removal without notice.
The client can ask the server to provide the listener with a specific
granularity
of events, but the server can decline to provide that granularity.Fine granularity deals with changes such as cell values changing (and reports the before and after value, before and after formatted value), positions being deleted, positions being changed.
When an atomic change happens on the server (say a cache flush, if the server is mondrian) then an event will arrive on the client containing all of those changes. Although
CellSetListener.CellSetChange.getCellChanges()
andCellSetListener.CellSetChange.getAxisChanges()
return lists, the client should assume that all of the events in these lists simultaneously.At any point, the server is free to throw up its hands and say 'there are too many changes' by sending null values for
getCellChanges
orgetAxisChanges
. This prevents situations where there are huge numbers of changes that might overwhelm the server, the network link, or the client, such as might happen if a large axis is re-sorted.The client should always be ready for that to happen (even for providers that claim to provide fine granularity events), and should re-execute the query to get the cell set. In fact, we recommend that clients re-execute the query to get a new cellset whenever they get an event. Then the client can use the details in the event to highlight cells that have changed.
Notes for implementors
The purpose of registering a listener before creating a cell set is to ensure that no events "leak out" between creating a cell set and registering a listener, or while a statement is being re-executed to produce a new cell set.
The
cellSetOpened(CellSet)
andcellSetClosed(CellSet)
methods are provided so that the listener knows what is going on when a statement is re-executed. In particular, suppose a statement receives an change event decides to re-execute. The listener is attached to the statement, so receives notifications about both old and new cell sets. The driver implicitls closes the previous cell set and callscellSetClosed
, then callscellSetOpened
with the new cell set.If changes are occurring regularly on the server, there will soon be a call to
cellSetChanged(org.olap4j.CellSetListener.CellSetChange)
. It is important to note that this event contains only changes that have occurred since the new cell set was opened.The granularity parameter is provided to
OlapStatement.addListener(org.olap4j.CellSetListener.Granularity, org.olap4j.CellSetListener)
for the server's benefit. If granularity is onlyCellSetListener.Granularity.COARSE
, the server may be able to store less information in order to track the cell set.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
CellSetListener.AxisChange
Description of a change to a particularCellSetAxis
; part of aCellSetListener.CellSetChange
.static interface
CellSetListener.CellChange
Description of a change to a particularCell
; part of aCellSetListener.CellSetChange
.static interface
CellSetListener.CellSetChange
Description of changes that have occurred to the cell set.static class
CellSetListener.Granularity
Granularity of notifications that should be sent to a cellset listener.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
cellSetChanged(CellSetListener.CellSetChange cellSetChange)
Invoked when a cell set has changed.void
cellSetClosed(CellSet cellSet)
Invoked when a cell set is closed.void
cellSetOpened(CellSet cellSet)
Invoked when a cell set is opened.
-
-
-
Method Detail
-
cellSetOpened
void cellSetOpened(CellSet cellSet)
Invoked when a cell set is opened.- Parameters:
cellSet
- Cell set
-
cellSetClosed
void cellSetClosed(CellSet cellSet)
Invoked when a cell set is closed.- Parameters:
cellSet
- Cell set
-
cellSetChanged
void cellSetChanged(CellSetListener.CellSetChange cellSetChange)
Invoked when a cell set has changed.- Parameters:
cellSetChange
- Change descriptor
-
-