org.sape.carbon.core.config.node.file
Class FileFolder

java.lang.Object
  |
  +--org.sape.carbon.core.config.node.AbstractNode
        |
        +--org.sape.carbon.core.config.node.AbstractFolder
              |
              +--org.sape.carbon.core.config.node.file.FileFolder
All Implemented Interfaces:
Folder, Node

public class FileFolder
extends AbstractFolder

A node that represents a physical directory within a file system. These nodes cache child nodes for quick reference, and thus synchronize removal and retrieval of child nodes. Copyright 2002 Sapient

Since:
carbon 1.0
Version:
$Revision: 1.27 $($Author: dvoet $ / $Date: 2003/07/29 18:52:33 $)
Author:
Mike Redd, February 2001
See Also:
FileConfigurationDocument

Field Summary
private  File directory
          Internal file object
private  FileNodeFilter fileFilter
          The filter used to obtain valid child files that may be represented by FileNodes from the file system.
 
Fields inherited from class org.sape.carbon.core.config.node.AbstractFolder
 
Fields inherited from class org.sape.carbon.core.config.node.AbstractNode
childNodes, nodeListeners
 
Fields inherited from interface org.sape.carbon.core.config.node.Node
DELIMITER
 
Constructor Summary
protected FileFolder(Node parent, String name, NodeFactory subFolderFactory, NodeFactory configurationDocumentFactory, NodeFactory linkNodeFactory, File directory)
          Constructor for FileFolder.
 
Method Summary
protected  boolean backingDataExists()
          Method called from the refresh method to see if the backing data still exists.
protected  void destroyBackingData()
          This method is called by remove to destroy the data backing this node in the data source.
protected  Set getAllChildNames()
          Called by fetchChildren to get the names of all the children from the backing data store.
(package private)  File getInternalFileObject()
          Accessor method for this.directory.
protected  Node loadChild(String nodeName)
          Loads the child specified by nodeName from the backing data store.
private  Node loadChildLinkNode(String nodeName)
          Helper method to create a sub link
private  Node loadConfigurationDocument(String nodeName)
          Helper method to create a configuration document
private  Node loadSubFolder(String nodeName)
          Helper method to create a sub folder
 
Methods inherited from class org.sape.carbon.core.config.node.AbstractFolder
addConfigurationDocument, addLink, addSubFolder, createNewConfigurationDocument, createNewFolder, getConfigurationDocumentFactory, getLinkNodeFactory, getSubFolderFactory, issueChildAddedEvent
 
Methods inherited from class org.sape.carbon.core.config.node.AbstractNode
addNodeListener, addNodeListener, addNodeListener, containsChild, fetchChild, fetchChildren, getAbsoluteName, getAddOrLoadChildLock, getAllowsChildren, getName, getParent, getReadOrAlterNodeLock, isRemoved, issueChildLoadedEvent, issueNodeRemovedEvent, refresh, remove, removeRemovedChildren, setRemoved, toString
 
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, containsChild, fetchChild, fetchChildren, getAbsoluteName, getAllowsChildren, getName, getParent, isRemoved, refresh, remove
 

Field Detail

fileFilter

private FileNodeFilter fileFilter
The filter used to obtain valid child files that may be represented by FileNodes from the file system.


directory

private File directory
Internal file object

Constructor Detail

FileFolder

protected FileFolder(Node parent,
                     String name,
                     NodeFactory subFolderFactory,
                     NodeFactory configurationDocumentFactory,
                     NodeFactory linkNodeFactory,
                     File directory)
Constructor for FileFolder.

Parameters:
parent - parent node that contains this folder
name - name of this folder
subFolderFactory - factory to create sub-folders with
configurationDocumentFactory - factory to create configuration documents with
linkNodeFactory - factory to create link nodes with
directory - directory being represented by this folder
Method Detail

getAllChildNames

protected Set getAllChildNames()
Description copied from class: AbstractNode
Called by fetchChildren to get the names of all the children from the backing data store. If a name appears in the returned Set, calling fetchChild with the name can not result in a NodeNotFoundException being thrown.

Specified by:
getAllChildNames in class AbstractNode
Returns:
Set of Strings, the names of all the children
See Also:
AbstractNode.getAllChildNames()

loadChild

protected Node loadChild(String nodeName)
                  throws NodeNotFoundException
Description copied from class: AbstractNode
Loads the child specified by nodeName from the backing data store. Called by fetchChild when the child has not yet been cached.

Specified by:
loadChild in class AbstractNode
Parameters:
nodeName - the name of the node to load
Returns:
Node the loaded node
Throws:
NodeNotFoundException - if the backing data for the specifed node could not be found in the data store.
See Also:
AbstractNode.loadChild(java.lang.String)

destroyBackingData

protected void destroyBackingData()
                           throws NodeRemovalException
Description copied from class: AbstractNode
This method is called by remove to destroy the data backing this node in the data source. Implementations of this method should remove all traces of the Node's existence

Specified by:
destroyBackingData in class AbstractNode
Throws:
NodeRemovalException - indicates an error removing the node
See Also:
AbstractNode.destroyBackingData()

getInternalFileObject

File getInternalFileObject()
Accessor method for this.directory. Package private, for use only by FileFolderFactory.

Returns:
File internal File object representing the directory on the file system.

loadSubFolder

private Node loadSubFolder(String nodeName)
                    throws NodeCreationException
Helper method to create a sub folder

Parameters:
nodeName - name of node containing the sub folder
Returns:
Node node element representing the sub-folder
Throws:
NodeCreationException - indicates an error loading the sub folder

loadConfigurationDocument

private Node loadConfigurationDocument(String nodeName)
                                throws NodeCreationException
Helper method to create a configuration document

Parameters:
nodeName - name of node to load the document for
Returns:
Node the instance of the loaded node
Throws:
NodeCreationException - indicates an error loading the node

loadChildLinkNode

private Node loadChildLinkNode(String nodeName)
                        throws NodeCreationException
Helper method to create a sub link

Parameters:
nodeName - name of sub link to create
Returns:
Node the node for the sublink
Throws:
NodeCreationException - indicates an error loading the child

backingDataExists

protected boolean backingDataExists()
Description copied from class: AbstractNode
Method called from the refresh method to see if the backing data still exists. If it exists, the isRemoved flag is set to false, if it does not, the isRemoved flag is set to true.

Specified by:
backingDataExists in class AbstractNode
Returns:
boolean true if the backing date exists, false otherwise
See Also:
AbstractNode.backingDataExists()


Copyright 1999-2003 Sapient Corporation. All Rights Reserved.