Data Request Broker
2-3-release

fr.gael.drb.impl.file
Class File

java.lang.Object
  extended by fr.gael.drb.DrbDefaultNodesChangeProducer
      extended by fr.gael.drb.DrbAbstractNode
          extended by fr.gael.drb.impl.DrbNodeImpl
              extended by fr.gael.drb.impl.spi.DrbNodeSpi
                  extended by fr.gael.drb.impl.file.File
All Implemented Interfaces:
DrbMutableNode, DrbNode, DrbNodesChangeListener, DrbNodesChangeProducer, EventListener

public final class File
extends fr.gael.drb.impl.spi.DrbNodeSpi

File or Directory of a local file system. This implementation breaks down the local file system into file and directories. It is useful to browse the local file system as a file manager. The file nodes have no specific attribute.

Thread safe strategy: This class is thread safe. The strategy to prevent access collisions between two or more treads, all the writting accesses to the ressources (i.e. attributes of this class) that may be changed by a thread are synchronised. Only the accesses occurring after the constructor are affected by this rule.


Field Summary
 
Fields inherited from class fr.gael.drb.impl.spi.DrbNodeSpi
baseNode
 
Fields inherited from interface fr.gael.drb.DrbItem
ATTRIBUTE_ITEM, NODE_ITEM, UNDEFINED_ITEM, VALUE_ITEM
 
Constructor Summary
protected File(File file)
          Builds a File instance.
  File(File file, File[] children, File[] parent_children)
          Deprecated. This constructor shall not be used.
protected File(FileNode file_node)
          Builds a File instance.
 
Method Summary
 DrbNode createNewFile(String file_name)
          Deprecated. As of DRB 2.0, added createNode
 DrbNode createNode(String name)
          Create a node with the specified name.
protected  fr.gael.drb.impl.spi.DrbNodeSpi DrbNodeSpi(DrbNode base_node, DrbNode parent)
          Builds a getInstance from a base node and a parent TODO : this operation shall raise an exception in case of null parameter.
 
Methods inherited from class fr.gael.drb.impl.spi.DrbNodeSpi
addNodesChangeListener, allowsMultiOccurrence, appendChild, close, equals, getAttribute, getAttributes, getChildAt, getChildren, getChildrenCount, getContent, getFirstChild, getImpl, getIndex, getLastChild, getName, getNamedChild, getNamespaceBindings, getNamespaceURI, getNextSibling, getParent, getPath, getPreviousSibling, getSubImplChildren, getSubImplFactory, getValue, getValueType, getXPathName, hasChild, hasImpl, insertChild, removeChild, removeNodesChangeListener, rename, replaceChild, setAttributes, setNamespaceURI, setSchema, setValue
 
Methods inherited from class fr.gael.drb.impl.DrbNodeImpl
createAttribute, flush, getProvider
 
Methods inherited from class fr.gael.drb.DrbAbstractNode
appendReference, getItemType, getOccurrence, getRoot, getXPathName, setNamespaceBindings, toString
 
Methods inherited from class fr.gael.drb.DrbDefaultNodesChangeProducer
getListenerList, nodesChanged, nodesInserted, nodesRemoved, setListenerList, structureChanged
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

File

public File(File file,
            File[] children,
            File[] parent_children)
Deprecated. This constructor shall not be used.

Builds a File instance. This contructors sets the provided Java File and caches its children. This implementation does not check if the provided parameter is a null reference. In such case, the implementation may become instable without warning. If already known, the children of the current node or its parent children list (i.e. its siblings and itself) can be passed. This is an optimization avoiding re-creation of children lists. For instance, the parent children list of a child is the chidren list of the current node. In addition the children list of a parent is the parent children list of the current node. Note: all the children collections created by this operation are sorted. For optimization, if the children and/or the parent children are already known, they can be passed in parameter. This avoid reconstruction of the children lists. For the parnet children list does not change from a node to any of its sibling.

Parameters:
file - The Java File to be wrapped.
children - The list of children if already known or null.
parent_children - The children of the parent if already known or null.

File

protected File(File file)
Builds a File instance. This contructors sets the provided Java File and caches its children. This implementation does not check if the provided parameter is a null reference. In such case, the implementation may become instable without warning. Note: all the children collections created by this operation are sorted.

Parameters:
file - The Java File to be wrapped.

File

protected File(FileNode file_node)
Builds a File instance. This contructors sets the provided Java File and caches its children. This implementation does not check if the provided parameter is a null reference. In such case, the implementation may become instable without warning.

Parameters:
file_node - The File node to be wrapped.
Method Detail

DrbNodeSpi

protected fr.gael.drb.impl.spi.DrbNodeSpi DrbNodeSpi(DrbNode base_node,
                                                     DrbNode parent)
Builds a getInstance from a base node and a parent TODO : this operation shall raise an exception in case of null parameter.

Parameters:
base_node - The node to be wrapped. This parameter shall never be null.
Returns:
DrbNodeSpi

createNode

public DrbNode createNode(String name)
                   throws NullPointerException,
                          UnsupportedOperationException
Create a node with the specified name.

Overrides:
createNode in class DrbNodeImpl
Parameters:
name - The expected name of the node.
Returns:
A reference to the new file node.
Throws:
NullPointerException - This exception is raised when the name provided in parameter is null.
UnsupportedOperationException - This exception is raised when the implementation is not able to create a node.

createNewFile

public DrbNode createNewFile(String file_name)
                      throws NullPointerException,
                             UnsupportedOperationException,
                             IOException,
                             SecurityException
Deprecated. As of DRB 2.0, added createNode

Creates a new file as children of the current directory. A new file is created with the passed file name. This operation is possible only if the current node wraps a directory and if it has the correcte write permissions. The provided name shall not already be used as name of an existing file in the current directory.

Events: This operation fires a node change event. The node affected by the change is the added node and the source is the current node. The called operation is the nodesInserted() of the listeners.

Parameters:
file_name - The expected name of the file.
Returns:
A reference to the new file node.
Throws:
NullPointerException - This exception is raised when the name provided in parameter is null.
UnsupportedOperationException - This exception is raised when the current node is node a directory.
IOException - This exception is raised when the new file cannot be created in the current directory.
SecurityException - This exception is raised when a security manager exists and its SecurityManager.checkWrite (java.io.FileDescriptor) method denies write access to the file be created in the current directory.
See Also:
createNode(java.lang.String)

Data Request Broker - DRB API®
2-3-release

Copyright© 2001-2009 GAEL Consultant. All rights reserved. Use is subject to license terms .