Interface CdbDiffIterate
- All Superinterfaces:
ConfIterate
CdbDiffIterate
interface should be implemented
by any class whose instances are intended to process or iterate
through a set of changes.
A particular instance of the implemented class
should be provided to call to
CdbSubscription.diffIterate(int,CdbDiffIterate,EnumSet,Object)
.
The iterate
method will be called for each element
that has been modified and matches the subscription.
The iterate
callback receives the
ConfObject
array kp
which uniquely identifies which
node in the data tree that is affected, the operation, and optionally the
values it has before and after the
transaction. The op
parameter gives the modification as:
DiffIterateOperFlag.MOP_CREATED
The list entry, presence container, or leaf of type empty given bykp
has been created.DiffIterateOperFlag.MOP_DELETED
The list entry, presence container, or optional leaf given bykp
has been deleted.If the subscription was triggered because an ancestor was deleted, the
iterate
method will not called at all if the delete was above the subscription point. However if the flagDiffIterateFlags.ITER_WANT_ANCESTOR_DELETE
is passed todiffIterate
then deletes that trigger a descendant subscription will also generate a call toiterate
, and in this casekp
will be the path that was actually deleted.DiffIterateOperFlag.MOP_MODIFIED
A descendant of the list entry given bykp
has been modified.DiffIterateOperFlag.MOP_VALUE_SET
The value of the leaf given bykp
has been set tonew_value
.DiffIterateOperFlag.MOP_MOVED_AFTER
The list entry given bykp
, in an ordered-by user list, has been moved. Ifnew_value
is null, the entry has been moved first in the list, otherwise it has been moved after the entry given bynew
. In this casenew_value
identifying an entry in the list.
iterate
returns DiffIterateResultFlag.ITER_STOP
,
no more iteration is done. If iterate
returns
DiffIterateResultFlag.ITER_RECURSE
iteration continues with all
children to the node. If iterate
returns
DiffIterateResultFlag.ITER_CONTINUE
iteration ignores the
children to the node (if any), and continues with the node's sibling.-
Method Summary
Modifier and TypeMethodDescriptioniterate
(ConfObject[] kp, DiffIterateOperFlag op, ConfObject oldValue, ConfObject newValue, Object initstate) Iterate through a set of changes
-
Method Details
-
iterate
DiffIterateResultFlag iterate(ConfObject[] kp, DiffIterateOperFlag op, ConfObject oldValue, ConfObject newValue, Object initstate) Iterate through a set of changes- Parameters:
kp
- A keypath identifies which node in the data tree that was affectedop
- Operation code (MOP_CREATED
,MOP_DELETED
,MOP_VALUE_SET
, MOP_MOVED_AFTER)oldValue
- The old value is set to a subtype ofConfValue
when leaf value has been changed (MOP_VALUE_SET
)newValue
- The new value is set to a subtype ofConfValue
when a leaf have been set,MOP_VALUE_SET
. When theop
isMOP_MOVED_AFTER
thenewValue
type isConfKey
.initstate
- An arbitrary object passed todiffIterate
method.
-