org.inria.ns.reflex.modules.io.xmldb
Class XMLDBFileObject

java.lang.Object
  extended by org.apache.commons.vfs.provider.AbstractFileObject
      extended by org.inria.ns.reflex.modules.io.xmldb.XMLDBFileObject
All Implemented Interfaces:
FileObject

public class XMLDBFileObject
extends AbstractFileObject
implements FileObject

XMLDBFileObject represent a remote resource on the XML Native Database (XND).

XMLDBFileObject provides some enhancements to XFiles :

Why using dynamic attributes ?

"Dynamic" means that the values are computed when they are accessed. Using a dynamic map is expected for retrieving values that require a physical access to the underlying XML database ; sometimes, XPath operations just browse the attribute names without necessary getting their values. It would be a performance bottleneck if such attributes would be put systematically in a static map without knowing if their content is really needed by the application.

An XML:DB provider can also use the static map for simple values.

Author:
Philippe Poulard
See Also:
ActiveTagsAdapter

Constructor Summary
XMLDBFileObject(GenericFileName name, XMLDBFileSystem fs)
          Construct the object that represent a file on the XND
XMLDBFileObject(XMLDBFileObject file)
          Construct the object that represent a file on the XND
 
Method Summary
 FileObject[] getChildren()
          Returns the children of the file.
 Map getDynamicAttributes()
          Return the dynamic map of the XML:DB provider's attribute.
 InputStream getInputStream()
          Returns an input stream to use to read the content of the file.
 HashMap getStaticAttributes()
          Return the static map of attributes, including static attributes set by the XML:DB provider.
 FileObject resolveFile(String path)
          Finds a file, relative to this file.
 FileObject resolveFile(String name, NameScope scope)
          Returns a child by name.
 
Methods inherited from class org.apache.commons.vfs.provider.AbstractFileObject
canRenameTo, close, copyFrom, createFile, createFolder, delete, delete, exists, findFiles, findFiles, getChild, getContent, getFileOperations, getFileSystem, getName, getOutputStream, getOutputStream, getParent, getRandomAccessContent, getType, getURL, holdObject, isAttached, isContentOpen, isHidden, isReadable, isWriteable, moveTo, refresh, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.commons.vfs.FileObject
canRenameTo, close, copyFrom, createFile, createFolder, delete, delete, exists, findFiles, findFiles, getChild, getContent, getFileOperations, getFileSystem, getName, getParent, getType, getURL, isAttached, isContentOpen, isHidden, isReadable, isWriteable, moveTo, refresh
 

Constructor Detail

XMLDBFileObject

public XMLDBFileObject(GenericFileName name,
                       XMLDBFileSystem fs)
Construct the object that represent a file on the XND

Parameters:
name - The name of this file.
fs - The file system that deliver this file.

XMLDBFileObject

public XMLDBFileObject(XMLDBFileObject file)
Construct the object that represent a file on the XND

Parameters:
file - The new file is based on the given file. Its static attributes are copied in this file.
Method Detail

getInputStream

public InputStream getInputStream()
                           throws FileSystemException
Returns an input stream to use to read the content of the file.

Overrides:
getInputStream in class AbstractFileObject
Throws:
FileSystemException

resolveFile

public FileObject resolveFile(String name,
                              NameScope scope)
                       throws FileSystemException
Returns a child by name.

Specified by:
resolveFile in interface FileObject
Overrides:
resolveFile in class AbstractFileObject
Throws:
FileSystemException

getChildren

public FileObject[] getChildren()
                         throws FileSystemException
Returns the children of the file.

Specified by:
getChildren in interface FileObject
Overrides:
getChildren in class AbstractFileObject
Throws:
FileSystemException

resolveFile

public FileObject resolveFile(String path)
                       throws FileSystemException
Finds a file, relative to this file.

Specified by:
resolveFile in interface FileObject
Overrides:
resolveFile in class AbstractFileObject
Parameters:
path - The path of the file to locate. Can either be a relative path, which is resolved relative to this file, or an absolute path, which is resolved relative to the file system that contains this file.
Throws:
FileSystemException

getDynamicAttributes

public Map getDynamicAttributes()
Return the dynamic map of the XML:DB provider's attribute.

Returns:
A non-null read-only map of attributes.

getStaticAttributes

public HashMap getStaticAttributes()
Return the static map of attributes, including static attributes set by the XML:DB provider.

Returns:
A non-null read/write map of attributes.