com.sdm.quasar.client.core.data.impl
Class DefaultDataManager

java.lang.Object
  extended bycom.sdm.quasar.client.core.data.impl.DefaultDataManager
All Implemented Interfaces:
DataManager

public class DefaultDataManager
extends java.lang.Object
implements DataManager

Default implementation for DataManager that delegates to a DataCore.

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

Constructor Summary
DefaultDataManager(DataCore dataCore)
          Constructor.
 
Method Summary
 boolean canModifyValue(java.lang.String key)
          Tests whether the value with the given name can be modified.
 java.util.Set getIndexSet(java.lang.String key)
          Returns a Set of the index values for the given key.
 java.util.Set getIndexSet(java.lang.String key, Context context)
          Returns a Set of the index values for the given key.
 DataManagerPlugIn getPlugIn(java.lang.Class dataManagerPlugInInterface)
          Returns the requested plugin implementation
 java.lang.Object getValue(java.lang.String key)
          Returns the value corresponding to the given name.
 java.lang.Object getValue(java.lang.String key, Context context)
          Returns a value that needs indices to be accessed.
 java.lang.Class getValueType(java.lang.String key)
          Returnes the Class of the value that may be stored at or recieved by the data node.
 boolean hasKey(java.lang.String key)
          Tests whether the DataManager has a node defined for the given key.
 boolean hasPlugIn(java.lang.Class dataManagerPlugInInterface)
          Tests whether the DataManager does have a specific plug in installed.
 boolean hasValue(java.lang.String key)
          Tests whether the node defined by the given key does have a value.
 void setValue(java.lang.String key, Context context, java.lang.Object value)
          Modifies a value that needs indices to be accessed.
 void setValue(java.lang.String key, java.lang.Object value)
          Sets the value corresponding to the given name.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultDataManager

public DefaultDataManager(DataCore dataCore)
Constructor.

Parameters:
dataCore - the data core to delegate to
Method Detail

getValue

public java.lang.Object getValue(java.lang.String key)
Description copied from interface: DataManager
Returns the value corresponding to the given name.

Specified by:
getValue in interface DataManager
Parameters:
key - the key of the data node
Returns:
the value, may be null iff the stored value is null or there is no stored value

getValueType

public java.lang.Class getValueType(java.lang.String key)
Description copied from interface: DataManager
Returnes the Class of the value that may be stored at or recieved by the data node.

Specified by:
getValueType in interface DataManager
Parameters:
key - the key of the data node
Returns:
class of the stored value

setValue

public void setValue(java.lang.String key,
                     java.lang.Object value)
Description copied from interface: DataManager
Sets the value corresponding to the given name.

Specified by:
setValue in interface DataManager
Parameters:
key - the of the data node
value - the new value, may be null if null is a valid value for the corresponding node

hasKey

public boolean hasKey(java.lang.String key)
Description copied from interface: DataManager
Tests whether the DataManager has a node defined for the given key.

This does not test whether the value is null or not, it tests solely if the DataManager is configured in a way that allows such a value to exist.

If DataManager.hasKey(String) returns false, DataManager.getValue(String) will return null. If DataManager.hasKey(String) returns true, DataManager.getValue(String) depends on the value of this node and the nodes it depends on.

Specified by:
hasKey in interface DataManager
Parameters:
key - the key of the node
Returns:
true iff the DataManager does have a node defined for the given key

hasValue

public boolean hasValue(java.lang.String key)
Description copied from interface: DataManager
Tests whether the node defined by the given key does have a value. This method will return false if some prerequisite is not fulfilled. Such a prerequisite might be that a node that this node depends on does return a value that is not null.

This does not test whether the value is null or not, it tests solely if the node could have a value other than null.

If DataManager.hasValue(String) returns false, DataManager.getValue(String) will return null. If DataManager.hasValue(String) returns true, DataManager.getValue(String) depends on the actually stored value but may return null.

Specified by:
hasValue in interface DataManager
Parameters:
key - the key of the node
Returns:
true iff the node does have a value

hasPlugIn

public boolean hasPlugIn(java.lang.Class dataManagerPlugInInterface)
Description copied from interface: DataManager
Tests whether the DataManager does have a specific plug in installed.

Specified by:
hasPlugIn in interface DataManager
Parameters:
dataManagerPlugInInterface - the interface class (extending DataManagerPlugIn) that defines the plugin
Returns:
true iff the DataManager does have the feature installed

getPlugIn

public DataManagerPlugIn getPlugIn(java.lang.Class dataManagerPlugInInterface)
Description copied from interface: DataManager
Returns the requested plugin implementation

Specified by:
getPlugIn in interface DataManager
Parameters:
dataManagerPlugInInterface - the interface class (extending DataManagerPlugIn) that defines the plugin
Returns:
the implementation of the requested plugin

canModifyValue

public boolean canModifyValue(java.lang.String key)
Description copied from interface: DataManager
Tests whether the value with the given name can be modified.

If DataManager.canModifyValue(String) returns false, then DataManager.setValue(String, Object) will throw an exception. Otherwise the call to DataManager.setValue(String, Object) should succeed, although it may fail for unexpected reasons.

Specified by:
canModifyValue in interface DataManager
Parameters:
key - the key of the node to be modified
Returns:
true iff the DataManager can modify the value for the given name

getValue

public java.lang.Object getValue(java.lang.String key,
                                 Context context)
Description copied from interface: DataManager
Returns a value that needs indices to be accessed. The values for these indices are supplied as context.

Specified by:
getValue in interface DataManager
Parameters:
key - the key of the data node
context - the context containing the indices needed to access the value
Returns:
the value, may be null iff the stored value is null or there is no stored value

setValue

public void setValue(java.lang.String key,
                     Context context,
                     java.lang.Object value)
Description copied from interface: DataManager
Modifies a value that needs indices to be accessed. The values for these indices are supplied as context.

Specified by:
setValue in interface DataManager
Parameters:
key - the key of the data node
context - the context containing the indices needed to access the value
value - the new value, may be null if null is a valid value for the corresponding node

getIndexSet

public java.util.Set getIndexSet(java.lang.String key)
Description copied from interface: DataManager
Returns a Set of the index values for the given key. The objects of the set may be used as index values within a Context together with the given key. The method returns null for not indexed nodes.

Specified by:
getIndexSet in interface DataManager
Parameters:
key - the key of the data node
Returns:
a Set of the index values for the given key or null.

getIndexSet

public java.util.Set getIndexSet(java.lang.String key,
                                 Context context)
Description copied from interface: DataManager
Returns a Set of the index values for the given key. The objects of the set may be used as additional index values within the given Context for access with the given key. The method returns null for not indexed nodes.

Specified by:
getIndexSet in interface DataManager
Parameters:
key - the key of the data node
context - the context containing the indices needed to access the value
Returns:
a Set of the index values for the given key and context or null.

toString

public java.lang.String toString()