com.sdm.quasar.client.core.data.plugin
Interface ValueHandler

All Known Implementing Classes:
AbstractIndexedValueHandler, AspectValueHandler, BaseValueHandler, ComputedValueHandler, EventNotificationValueHandler

public interface ValueHandler

Handles a request concerning the value of a node. ValueHandlers are created and added to a node by plug ins when the node is created. TODO Should ValueHandler and DataManager support index aware methods for hasValue and canModifyValue? (BOL: I think yes) MAH: nach Rel 2.0

Version:
1.0
Author:
Thomas Wolf, sd&m AG, Bernd Olleck, sd&m AG

Method Summary
 boolean canHandle(Node node)
          Tests whether the value handler can handle nodes of the given type.
 boolean canModifyValue(NodeController node, Context context, NestedValueHandler nestedValueHandler)
          Tests whether the value of the node can be modified.
 java.util.Set getIndexSet(NodeController node, Context context, NestedValueHandler nestedValueHandler)
          Retrieves a Set of the index values for the node.
 java.lang.Object getValue(NodeController node, Context context, NestedValueHandler nestedValueHandler)
          Retrieves the value of the node.
 boolean hasValue(NodeController node, Context context, NestedValueHandler nestedValueHandler)
          Tests whether the node has a indexed value.
 void notifyChildValueChanged(NodeController node, java.lang.String childKey)
          Called when the value of a node that depends on this node has changed.
 void notifyNodeValueChanged(NodeController node)
          Called when the value of the node has changed because of a change originating at the given node.
 void notifySourceValueChanged(NodeController node, java.lang.String sourceKey)
          Called when the value of a node that the node depends on or an ancestor further removed has changed.
 void setValue(NodeController node, Context context, java.lang.Object value, NestedValueHandler nestedValueHandler)
          Sets the indexed value of the node.
 

Method Detail

canHandle

public boolean canHandle(Node node)
Tests whether the value handler can handle nodes of the given type.

Parameters:
node - the node definition
Returns:
true iff the value handler can handle that node

hasValue

public boolean hasValue(NodeController node,
                        Context context,
                        NestedValueHandler nestedValueHandler)
Tests whether the node has a indexed value. If the implementation takes responsability for the storing of the value it should determine the result on its own. Otherwise it should query the nested value handler using NestedValueHandler#hasValue().

Parameters:
node - the concerned node
context - the context to resolve the indices
nestedValueHandler - the adapter to the next value handler
Returns:
true iff the node has a value
See Also:
NodeController.hasValue(Context)

getValue

public java.lang.Object getValue(NodeController node,
                                 Context context,
                                 NestedValueHandler nestedValueHandler)
Retrieves the value of the node. If this value handler does not take responsability for the storing of the value it must retrieve the value by using NestedValueHandler.getValue(Context).

Parameters:
node - the concerned node
context - the context to resolve the indices
nestedValueHandler - the adapter to the next value handler in the chain of value handlers of that node
Returns:
the value of the node

canModifyValue

public boolean canModifyValue(NodeController node,
                              Context context,
                              NestedValueHandler nestedValueHandler)
Tests whether the value of the node can be modified. If the implementation takes responsability for the storing of the value it should determine the result on its own. Otherwise it should query the nested value handler using NestedValueHandler#canModifyValue().

Parameters:
node - the concerned node
context - the context to resolve the indices
nestedValueHandler - the adapter to the next value handler
Returns:
true iff the value of the node has a value
See Also:
NodeController#canModifyValue()

setValue

public void setValue(NodeController node,
                     Context context,
                     java.lang.Object value,
                     NestedValueHandler nestedValueHandler)
Sets the indexed value of the node. If it takes responsability for the storing of the value it must notify the node of the change if appropriate by using NodeController.startNodeValueChangedNotification(). If it does not take responsability it must notify the nested value handler using NestedValueHandler.setValue(Context, Object).

Parameters:
node - the concerned node
context - the context to resolve the indices
value - the value to be set, may be null
nestedValueHandler - the adapter to the next value handler in the chain of value handlers of that node
See Also:
NodeController.setValue(Context, Object)

getIndexSet

public java.util.Set getIndexSet(NodeController node,
                                 Context context,
                                 NestedValueHandler nestedValueHandler)
Retrieves a Set of the index values for the node. If this value handler does not take responsability for the storing of the value it must retrieve the set by using NestedValueHandler.getIndexSet(com.sdm.quasar.client.core.data.Context).

Parameters:
node - the concerned node
context - the context to resolve the indices
nestedValueHandler - the adapter to the next value handler
Returns:
A Set of the index values for the node or null.

notifyNodeValueChanged

public void notifyNodeValueChanged(NodeController node)
Called when the value of the node has changed because of a change originating at the given node.

Parameters:
node - the node whose value has changed

notifySourceValueChanged

public void notifySourceValueChanged(NodeController node,
                                     java.lang.String sourceKey)
Called when the value of a node that the node depends on or an ancestor further removed has changed.

Parameters:
node - the node that is notified
sourceKey - the key of the source node whose value has changed

notifyChildValueChanged

public void notifyChildValueChanged(NodeController node,
                                    java.lang.String childKey)
Called when the value of a node that depends on this node has changed.

Parameters:
node - the node that is notified
childKey - the key of the child node whose value has changed