|
Data Request Broker 2-3-release |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectfr.gael.drb.DrbDefaultNodesChangeProducer
fr.gael.drb.DrbAbstractNode
fr.gael.drb.impl.DrbNodeImpl
fr.gael.drb.impl.file.FileNode
public final class FileNode
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 interface fr.gael.drb.DrbItem |
|---|
ATTRIBUTE_ITEM, NODE_ITEM, UNDEFINED_ITEM, VALUE_ITEM |
| Method Summary | |
|---|---|
boolean |
allowsMultiOccurrence()
Check if this node may have multiple occurrence |
DrbNode |
appendChild(DrbNode node)
Appends a child to the current node. |
void |
close(boolean deep)
Closes this node and releases any system resources associated with the implementation. |
protected FileNode |
createNewFile(String file_name)
Creates a new file as children of the current directory. |
DrbNode |
createNode(String name)
Create a node with the specified name. |
boolean |
equals(Object obj)
Indicates whether this node is "equal to" to another node. |
DrbAttributeList |
getAttributes()
The attributes of the node. |
DrbNode |
getChildAt(int index)
Reference to a specific child. |
DrbNodeList |
getChildren()
Returns the children list of the current directory. |
int |
getChildrenCount()
Number of files or directory hold by the current node (directory). |
Object |
getImpl(Class api)
Returns a specific implementation of the node. |
int |
getIndex()
Returns the index of the file in the parent children list. |
String |
getName()
Returns the name of the wrapped file. |
DrbNode |
getNamedChild(String name,
int occurence)
Returns an occurence of child matching a specific name. |
String |
getNamespaceURI()
The file namespace. |
DrbNode |
getParent()
Returns the parent file. |
String |
getPath()
Returns the absolute path of the file. |
DrbProvider |
getProvider()
Returns the provider of this file. |
DrbNode |
getRoot()
Returns the root node of the current node. |
Value |
getValue()
The value of the node. |
int |
getValueType()
The value type of the file. |
boolean |
hasChild()
Checks if any child exists. |
boolean |
hasImpl(Class api)
Tests if a specific implementation is supported. |
DrbNode |
insertChild(DrbNode node,
int index)
Inserts a child to the current node children list. |
void |
removeChild(int index)
Removes a file from the children list. |
void |
rename(String name)
Changes the name of the node. |
DrbNode |
replaceChild(int index,
DrbNode node)
Replaces a child of the current node. |
void |
setNamespaceURI(String namespace_uri)
The namespace of a file cannot be changed. |
Value |
setValue(Value value)
Sets the value pf a file. |
String |
toString()
Overrides the default string representation. |
| Methods inherited from class fr.gael.drb.impl.DrbNodeImpl |
|---|
createAttribute, flush |
| Methods inherited from class fr.gael.drb.DrbAbstractNode |
|---|
appendReference, getAttribute, getContent, getFirstChild, getItemType, getLastChild, getNamespaceBindings, getNextSibling, getOccurrence, getPreviousSibling, getXPathName, getXPathName, setAttributes, setNamespaceBindings |
| Methods inherited from class fr.gael.drb.DrbDefaultNodesChangeProducer |
|---|
addNodesChangeListener, getListenerList, nodesChanged, nodesInserted, nodesRemoved, removeNodesChangeListener, setListenerList, structureChanged |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Method Detail |
|---|
public boolean equals(Object obj)
equals in class DrbAbstractNodeobj - another value.
public boolean allowsMultiOccurrence()
allowsMultiOccurrence in class DrbAbstractNodepublic void close(boolean deep)
close in class DrbNodeImpldeep - if this flag is disabled, the implementation shall not release
the ressources shared with the descendants. WARNING: This
parameter is not fully supported.public DrbProvider getProvider()
getProvider in class DrbNodeImplpublic final String getName()
Synchronisation note: no synchronisation performed.
getName in class DrbAbstractNodepublic final int getIndex()
Synchronisation note: The accesses to the cache of parent children are synchronized.
getIndex in class DrbAbstractNodepublic final DrbNode getRoot()
Synchronisation note: no synchronisation performed.
getRoot in class DrbAbstractNodepublic final String getPath()
Synchronisation note: the entire operation is synchronized.
getPath in class DrbAbstractNodepublic final String getNamespaceURI()
getNamespaceURI in class DrbAbstractNodepublic final int getValueType()
getValueType in class DrbAbstractNodepublic final Value getValue()
getValue in class DrbAbstractNodepublic final DrbAttributeList getAttributes()
The following table specifies the attributes that are available for a file. No atribute is provided optionally. The type of the attribute are expressed using the type identifer of the fr.gael.drb.value.Value class.
| Name | Description | Value Type |
| size | the length of the file in bytes. If the file is a directory, the size is equal to 0. | UNSIGNED_LONG_ID |
| modified | the date the file was last modified. | DATE_ID |
| readable | true whether the application can read the file. false otherwise. | BOOLEAN_ID |
| writable | true whether the application can write the file. false otherwise. | BOOLEAN_ID |
| hidden | true whether the file is hidden. false otherwise. | BOOLEAN_ID |
Synchronisation note: the accesses to the file are synchronized.
getAttributes in class DrbAbstractNodepublic final DrbNode getParent()
getParent in class DrbAbstractNodepublic final DrbNodeList getChildren()
getChildren in class DrbAbstractNodepublic final boolean hasChild()
hasChild in class DrbAbstractNodepublic DrbNode getChildAt(int index)
getChildAt in class DrbAbstractNodeindex - The position of the node to retreive starting from 0 and not
greater or equal to the number of children.
public DrbNode getNamedChild(String name,
int occurence)
getNamedChild in class DrbAbstractNodename - The name to match.occurence - The occurence number of the desired child.
public final int getChildrenCount()
getChildrenCount in class DrbAbstractNodepublic final boolean hasImpl(Class api)
hasImpl in class DrbNodeImplapi - The requested implementation.
FileInputStream,
FileOutputStream,
RandomAccessFile,
Filepublic final Object getImpl(Class api)
getImpl in class DrbNodeImplapi - The requested implmentation.
FileInputStream,
FileOutputStream,
RandomAccessFile,
Filepublic final String toString()
toString in class DrbAbstractNode
public DrbNode appendChild(DrbNode node)
throws UnsupportedOperationException
Please refer to the addChild operation to known which events are fired and in which cases exceptions are thrown.
appendChild in interface DrbNodeappendChild in class DrbAbstractNodenode - A reference to the node to be appended.
UnsupportedOperationException - This exception is raised when the
current node is not a directory or if it does not allows to
remove the file for security reasons (e.g. file permissions).
public DrbNode insertChild(DrbNode node,
int index)
throws UnsupportedOperationException
Please refer to the addChild operation to known which events are fired and in which cases exceptions are thrown.
insertChild in interface DrbNodeinsertChild in class DrbAbstractNodenode - A reference to the node to be inserted.index - Has no effect in this implementation.
UnsupportedOperationException - This exception is raised when the
current node is not a directory or if it does not allows to
remove the file for security reasons (e.g. file permissions).
public void removeChild(int index)
throws IndexOutOfBoundsException,
UnsupportedOperationException
Events: This operation fires a node change even. The node affected by the change is the removed node and the source is the current node. The called operation is the nodesRemoved() of the listeners.
Warning: The reference to the removed child in the fired event enable to re-create the same file, but its contents is definitely lost.
removeChild in interface DrbNoderemoveChild in class DrbAbstractNodeindex - Index of the child to be removed.
IndexOutOfBoundsException - This exception is raised when the passed
index is less than zero or greater or equal to the current
number of children.
UnsupportedOperationException - This exception is raised when the
current node is not a directory or if it does not allows to
remove the file for security reasons (e.g. file permissions).
public void rename(String name)
throws NullPointerException,
UnsupportedOperationException
java.io.File class for
more information about right persmissions.
Events: his operation fires a node change event. The node affected by the change is the current standing also as the source of the event. The called opetation is the nodesChanged() of the listeners.
rename in class DrbAbstractNodename - Reference to the new name.
UnsupportedOperationException - This exception is raised when the
wrapped file cannot be renamed.
NullPointerException - This exception is raised when the passed name
is a null reference. This exception may be overriden by an
UnsupportedOperationException.
public DrbNode replaceChild(int index,
DrbNode node)
throws NullPointerException,
IndexOutOfBoundsException,
UnsupportedOperationException
Please refer to the addChild() and removeChild() operations to known which events are fired and in which cases exceptions are thrown.
Warning: Event if a minimal checking is performed before removing the child (i.e. shall be a regular file because other addings are not supported), the corresponding file may be lost if the addChild() aborts.
Events: This operation fires a node change event. The node affected by the change is the new node and the source is the current node. The called operation is the structureChanged() of the listeners.
replaceChild in interface DrbNodereplaceChild in class DrbAbstractNodenode - A reference to the node to be appended.index - the index of the node
NullPointerException - This exception is raised when the reference
to the new node is null.
IndexOutOfBoundsException - This exception is raised when the passed
index does not correspond to any effective child.
UnsupportedOperationException - This exception is raised if one of
the calls to removeChild() and addChild() operations has raised
it.
public void setNamespaceURI(String namespace_uri)
throws NullPointerException,
UnsupportedOperationException
setNamespaceURI in interface DrbNodesetNamespaceURI in class DrbAbstractNodenamespace_uri - the uri name
UnsupportedOperationException - Always raised.
NullPointerException - This exception is raised when the name is
null
public Value setValue(Value value)
throws NullPointerException,
ClassCastException,
UnsupportedOperationException
setValue in interface DrbNodesetValue in class DrbAbstractNodevalue - A reference to the value to write.
NullPointerException - This exception is raised when the value
parameter is null.
ClassCastException - This exception is never raised.
UnsupportedOperationException - This exception is raised when the
file is not a regular file or if an error occurs because of
security reasons.
public DrbNode createNode(String name)
throws NullPointerException,
UnsupportedOperationException
createNode in class DrbNodeImplname - The expected name of the node.
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.
protected FileNode createNewFile(String file_name)
throws NullPointerException,
UnsupportedOperationException,
IOException,
SecurityException
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.
file_name - The expected name of the file.
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.
|
Data Request Broker - DRB API® 2-3-release |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||