org.sape.carbon.core.config.node.link
Class AbstractLinkNode

java.lang.Object
  |
  +--org.sape.carbon.core.config.node.link.AbstractLinkNode
All Implemented Interfaces:
LinkNode, Node
Direct Known Subclasses:
ConfigurationDocumentLinkImpl, FolderLinkImpl

public abstract class AbstractLinkNode
extends Object
implements LinkNode

Base class for LinkNodes. Implements methods in the Node and LinkNode interfaces. This class is an aggregation of 2 Nodes:

Copyright 2002 Sapient

Since:
carbon 1.0
Version:
$Revision: 1.7 $($Author: dvoet $ / $Date: 2003/10/17 14:40:55 $)
Author:
Douglas Voet, March 2002

Field Summary
protected  ConfigurationDocument linkConfigurationDocument
          The ConfigurationDocument containing the link's configuration.
protected  Node targetNode
          The target Node of this link.
 
Fields inherited from interface org.sape.carbon.core.config.node.Node
DELIMITER
 
Constructor Summary
AbstractLinkNode(ConfigurationDocument linkConfigurationDocument, Node targetNode)
          Constructor
 
Method Summary
 boolean containsChild(String childName)
          Checks if this Folder contains the child specified by childName
 Node fetchChild(String childName)
          Returns a child Node of the current Node as defined by childName.
 Node[] fetchChildren()
          Returns an array of all children nodes, including standard ConfigurationDocuments and Folder.
 String getAbsoluteName()
          Returns the absolute name of the node within the node heirarchy.
 boolean getAllowsChildren()
          Allows determination of whether or not this node supports children
 String getName()
          Returns the name of this node.
 Node getParent()
          Gets the parent folder of the node.
 boolean isRemoved()
          Used to tell whether or not the backing data of a node has been removed.
 LinkNodeConfiguration readLinkConfiguration()
          Reads the LinkNodeConfiguration object that configures this link
 void refresh()
          Refreshes the Node's underlying cache of data (assuming is has one)
 int remove()
          Permanently deletes the node and all of its child nodes from the backing store returning the total number of nodes deleted.
 String toString()
          Returns the name of the node
 void writeLinkConfiguration(LinkNodeConfiguration config)
          Writes a new LinkNodeConfiguration to the backing data store.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.sape.carbon.core.config.node.Node
addNodeListener, addNodeListener
 

Field Detail

linkConfigurationDocument

protected ConfigurationDocument linkConfigurationDocument
The ConfigurationDocument containing the link's configuration.


targetNode

protected Node targetNode
The target Node of this link.

Constructor Detail

AbstractLinkNode

public AbstractLinkNode(ConfigurationDocument linkConfigurationDocument,
                        Node targetNode)
Constructor

Parameters:
linkConfigurationDocument - the configuration of the link
targetNode - the target of the link
Throws:
NullPointerException - if linkConfigurationDocument or targetNode is null
Method Detail

readLinkConfiguration

public LinkNodeConfiguration readLinkConfiguration()
                                            throws NodeIOException,
                                                   ConfigurationFormatException
Description copied from interface: LinkNode
Reads the LinkNodeConfiguration object that configures this link

Specified by:
readLinkConfiguration in interface LinkNode
Returns:
LinkNodeConfiguration
Throws:
ConfigurationFormatException - if the configuration has an invalid format
NodeIOException - if there is an exception reading from the backing data store
See Also:
LinkNode.readLinkConfiguration()

writeLinkConfiguration

public void writeLinkConfiguration(LinkNodeConfiguration config)
                            throws NodeIOException,
                                   ConfigurationFormatException
Description copied from interface: LinkNode
Writes a new LinkNodeConfiguration to the backing data store. Note that if changing a configuration, changes will not take effect until the ConfigurationService is reloaded. In most cases, that is when the system is restarted.

Specified by:
writeLinkConfiguration in interface LinkNode
Parameters:
config - the new LinkNodeConfiguration
Throws:
NodeIOException - if there is an exception writing to the backing data store
ConfigurationFormatException - if there is a problem formatting the data
See Also:
LinkNode.readLinkConfiguration()

getName

public String getName()
Description copied from interface: Node
Returns the name of this node. The name should not include the node's relation to the node heirarchy. The name can not contain a '/'. The name of the root node is an empty String("").

Specified by:
getName in interface Node
Returns:
name of the node
See Also:
Node.getName()

getAbsoluteName

public String getAbsoluteName()
Description copied from interface: Node
Returns the absolute name of the node within the node heirarchy. This value always begins with a '/' with each node's name in the heirarchy seperated by a '/' unless this is the root node in which case it returns an empty String("").

Specified by:
getAbsoluteName in interface Node
Returns:
Absolute name of the node.
See Also:
Node.getAbsoluteName()

getAllowsChildren

public boolean getAllowsChildren()
Description copied from interface: Node
Allows determination of whether or not this node supports children

Specified by:
getAllowsChildren in interface Node
Returns:
true if the node can support children, false otherwise
See Also:
Node.getAllowsChildren()

remove

public int remove()
           throws NodeRemovalException
Description copied from interface: Node
Permanently deletes the node and all of its child nodes from the backing store returning the total number of nodes deleted.

Specified by:
remove in interface Node
Returns:
The total number of nodes deleted. This number should always be at least '1' when the operation completed successfully.
Throws:
NodeRemovalException - when the node or one of its children can not be deleted. When this exception is thrown, some nodes may have been deleted while other may have not.
See Also:
Node.remove()

getParent

public Node getParent()
Description copied from interface: Node
Gets the parent folder of the node.

Specified by:
getParent in interface Node
Returns:
Folder the parent folder, null if this node is the root
See Also:
Node.getParent()

toString

public String toString()
Returns the name of the node

Overrides:
toString in class Object
Returns:
the name of the node

isRemoved

public boolean isRemoved()
Description copied from interface: Node
Used to tell whether or not the backing data of a node has been removed.

Specified by:
isRemoved in interface Node
Returns:
true if the backing data of a node has been removed
See Also:
Node.isRemoved()

refresh

public void refresh()
Description copied from interface: Node
Refreshes the Node's underlying cache of data (assuming is has one)

Specified by:
refresh in interface Node
See Also:
Node.refresh()

containsChild

public boolean containsChild(String childName)
Description copied from interface: Node
Checks if this Folder contains the child specified by childName

Specified by:
containsChild in interface Node
Parameters:
childName - the name of the child Node
Returns:
boolean true if the child exists, false otherwise.
See Also:
Node.containsChild(String)

fetchChild

public Node fetchChild(String childName)
                throws NodeNotFoundException
Description copied from interface: Node
Returns a child Node of the current Node as defined by childName.

Specified by:
fetchChild in interface Node
Parameters:
childName - The name of the child node to be returned.
Returns:
A child Node of the current node.
Throws:
NodeNotFoundException - when childName does not exist in the backing data store
See Also:
Node.fetchChild(String)

fetchChildren

public Node[] fetchChildren()
Description copied from interface: Node
Returns an array of all children nodes, including standard ConfigurationDocuments and Folder. If this particular node does not have any children, an array of length zero is be returned.

Specified by:
fetchChildren in interface Node
Returns:
Array of child Nodes. Never null.
See Also:
Node.fetchChildren()


Copyright 1999-2003 Sapient Corporation. All Rights Reserved.