com.funambol.syncclient.spdm
Class NodeImpl

java.lang.Object
  extended by com.funambol.syncclient.spdm.NodeImpl
All Implemented Interfaces:
ManagementNode

public class NodeImpl
extends java.lang.Object
implements ManagementNode

This is an implementation of ManagamentNode that uses file system directories for contexts and properties file for leaf nodes. $Id: NodeImpl.java,v 1.4 2007/01/11 19:21:40 nichele Exp $


Constructor Summary
NodeImpl(ManagementNode parent, java.lang.String context)
          Creates a NodeImpl object for the given management context and parent node.
 
Method Summary
 ManagementNode getChildNode(java.lang.String subcontext)
          Retrieves the subnode with the given name
 ManagementNode[] getChildren()
          Retrieves the children subnodes of the current node.
 java.lang.String getContext()
          Returns the node's context
 java.lang.String getFullContext()
          Returns the entire node's context path (concatenation of all parent context paths).
 java.lang.Object getManagementObject(java.lang.String node)
          Reads the properties of the given node and creates an object with the values read.
 java.lang.Object getNodeValue(java.lang.String node, java.lang.String name)
          Retrieves a value from the given management subnode name.
 java.util.Hashtable getNodeValues(java.lang.String node)
          Provides direct access to a management subtree relative to the node's fullContext.
 ManagementNode getParent()
          Retrieves this node's parent.
 java.lang.Object getValue(java.lang.String name)
          Returns the given config parameter
 java.util.Hashtable getValues()
           
 void removeNode(java.lang.String node)
          Remove subnode from configuration three.
 void setValue(java.lang.String name, java.lang.Object value)
          Sets a node value as a whole object.
 void setValue(java.lang.String node, java.lang.String name, java.lang.Object value)
          Sets a subnode specific value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NodeImpl

public NodeImpl(ManagementNode parent,
                java.lang.String context)
Creates a NodeImpl object for the given management context and parent node.

Parameters:
parent - the parent context; if null, create a root node
context - the context
Method Detail

getContext

public java.lang.String getContext()
Returns the node's context

Specified by:
getContext in interface ManagementNode
Returns:
the node's context

getFullContext

public java.lang.String getFullContext()
Returns the entire node's context path (concatenation of all parent context paths).

Specified by:
getFullContext in interface ManagementNode
Returns:
the entire node's context path

getValue

public java.lang.Object getValue(java.lang.String name)
                          throws DMException
Description copied from interface: ManagementNode
Returns the given config parameter

Specified by:
getValue in interface ManagementNode
Parameters:
name - the configration parameter name
Returns:
value
Throws:
DMException - in case of errors.

getValues

public java.util.Hashtable getValues()
                              throws DMException
Specified by:
getValues in interface ManagementNode
Returns:
values
Throws:
DMException - in case of errors.

getNodeValues

public java.util.Hashtable getNodeValues(java.lang.String node)
                                  throws DMException
Provides direct access to a management subtree relative to the node's fullContext.

Specified by:
getNodeValues in interface ManagementNode
Parameters:
node - the name of the subnode (it may contain directories)
Returns:
the node values
Throws:
DMException - in case of errors.

getNodeValue

public java.lang.Object getNodeValue(java.lang.String node,
                                     java.lang.String name)
                              throws DMException
Retrieves a value from the given management subnode name.

Specified by:
getNodeValue in interface ManagementNode
Parameters:
node - the subnode containing the config value specified by name
name - the name of the configuration value to return
Returns:
the node value
Throws:
DMException - in case of errors.

getManagementObject

public java.lang.Object getManagementObject(java.lang.String node)
                                     throws DMException
Reads the properties of the given node and creates an object with the values read.

Specified by:
getManagementObject in interface ManagementNode
Parameters:
node - the subnode containing the required config values
Returns:
the object
Throws:
DMException - in case of errors.

getChildren

public ManagementNode[] getChildren()
                             throws DMException
Retrieves the children subnodes of the current node. Subnodes may be directories or property files. In the latter case, the node context is the name of the file without the extension.

Specified by:
getChildren in interface ManagementNode
Returns:
an array of ManagementNode containing this node's children
Throws:
DMException - in case of errors.

getChildNode

public ManagementNode getChildNode(java.lang.String subcontext)
                            throws DMException
Retrieves the subnode with the given name

Specified by:
getChildNode in interface ManagementNode
Returns:
subcontext the subnode context (name)
Throws:
DMException - in case of errors.

getParent

public ManagementNode getParent()
Retrieves this node's parent.

Specified by:
getParent in interface ManagementNode
Returns:
the node's parent
Throws:
DMException - in case of errors.

setValue

public void setValue(java.lang.String name,
                     java.lang.Object value)
              throws DMException
Sets a node value as a whole object.

Specified by:
setValue in interface ManagementNode
Parameters:
name -
value - the value
Throws:
DMException - in case of errors.

setValue

public void setValue(java.lang.String node,
                     java.lang.String name,
                     java.lang.Object value)
              throws DMException
Sets a subnode specific value.

Specified by:
setValue in interface ManagementNode
Parameters:
node - subnode to set
name - configuration parameter to set
value -
Throws:
DMException - in case of errors.

removeNode

public void removeNode(java.lang.String node)
                throws DMException
Remove subnode from configuration three.

Specified by:
removeNode in interface ManagementNode
Parameters:
node - subnode to reomove
Throws:
DMException - in case of errors.


Copyright © 2003-2007 Funambol.