org.jboss.virtual.plugins.context.vfs
Class AssembledDirectoryHandler

java.lang.Object
  extended by org.jboss.virtual.plugins.context.AbstractVirtualFileHandler
      extended by org.jboss.virtual.plugins.context.vfs.AssembledDirectoryHandler
All Implemented Interfaces:
java.io.Serializable, StructuredVirtualFileHandler, VirtualFileHandler

public class AssembledDirectoryHandler
extends AbstractVirtualFileHandler
implements StructuredVirtualFileHandler

The assembled directory handler.

Version:
$Revision: 1.1 $
Author:
Bill Burke
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.jboss.virtual.plugins.context.AbstractVirtualFileHandler
cachedLastModified, log, vfsUrl
 
Constructor Summary
AssembledDirectoryHandler(AssembledContext context, AssembledDirectoryHandler parent, java.lang.String name)
           
 
Method Summary
 VirtualFileHandler addChild(VirtualFileHandler handler)
           
 VirtualFileHandler createChildHandler(java.lang.String name)
          Create a virtual file context
 boolean exists()
          Tests whether the underlying implementation file still exists.
 VirtualFileHandler findChild(java.lang.String path)
          Find a child
 VirtualFileHandler getChild(java.lang.String name)
           
 java.util.List<VirtualFileHandler> getChildren(boolean ignoreErrors)
          Get the children
 long getLastModified()
          When the file was last modified
 long getSize()
          Get the size
 VirtualFile getVirtualFile()
          Get the virtual file wrapper
 boolean isHidden()
          Whether it is hidden
 boolean isLeaf()
          Whether it is a simple leaf of the VFS, i.e.
 java.io.InputStream openStream()
          Access the file contents.
 java.net.URI toURI()
          Get the VF URI (file://root/org/jboss/X.java)
 java.net.URL toURL()
          Get the VF URL (file://root/org/jboss/X.java)
 
Methods inherited from class org.jboss.virtual.plugins.context.AbstractVirtualFileHandler
checkClosed, close, decrement, doClose, equals, getName, getParent, getPathName, getVFSContext, hasBeenModified, hashCode, increment, setPathName, simpleFindChild, structuredFindChild, toString, toVfsUrl
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AssembledDirectoryHandler

public AssembledDirectoryHandler(AssembledContext context,
                                 AssembledDirectoryHandler parent,
                                 java.lang.String name)
                          throws java.io.IOException
Throws:
java.io.IOException
Method Detail

addChild

public VirtualFileHandler addChild(VirtualFileHandler handler)

getChild

public VirtualFileHandler getChild(java.lang.String name)

toURI

public java.net.URI toURI()
                   throws java.net.URISyntaxException
Description copied from interface: VirtualFileHandler
Get the VF URI (file://root/org/jboss/X.java)

Specified by:
toURI in interface VirtualFileHandler
Returns:
the full URI to the VF in the VFS.
Throws:
java.net.URISyntaxException - for an error parsing the URI

getLastModified

public long getLastModified()
                     throws java.io.IOException
Description copied from interface: VirtualFileHandler
When the file was last modified

Specified by:
getLastModified in interface VirtualFileHandler
Returns:
the last modified time
Throws:
java.io.IOException - for any problem accessing the virtual file system

getSize

public long getSize()
             throws java.io.IOException
Description copied from interface: VirtualFileHandler
Get the size

Specified by:
getSize in interface VirtualFileHandler
Returns:
the size
Throws:
java.io.IOException - for any problem accessing the virtual file system

exists

public boolean exists()
               throws java.io.IOException
Description copied from interface: VirtualFileHandler
Tests whether the underlying implementation file still exists.

Specified by:
exists in interface VirtualFileHandler
Returns:
true if the file exists, false otherwise.
Throws:
java.io.IOException - - thrown on failure to detect existence.

isLeaf

public boolean isLeaf()
               throws java.io.IOException
Description copied from interface: VirtualFileHandler
Whether it is a simple leaf of the VFS, i.e. whether it can contain other files

Specified by:
isLeaf in interface VirtualFileHandler
Returns:
true if a simple file.
Throws:
java.io.IOException - for any problem accessing the virtual file system

isHidden

public boolean isHidden()
                 throws java.io.IOException
Description copied from interface: VirtualFileHandler
Whether it is hidden

Specified by:
isHidden in interface VirtualFileHandler
Returns:
true if hidden.
Throws:
java.io.IOException - for any problem accessing the virtual file system

openStream

public java.io.InputStream openStream()
                               throws java.io.IOException
Description copied from interface: VirtualFileHandler
Access the file contents.

Specified by:
openStream in interface VirtualFileHandler
Returns:
An InputStream for the file contents.
Throws:
java.io.IOException - for any problem accessing the virtual file system

getChildren

public java.util.List<VirtualFileHandler> getChildren(boolean ignoreErrors)
                                               throws java.io.IOException
Description copied from interface: VirtualFileHandler
Get the children

Specified by:
getChildren in interface VirtualFileHandler
Parameters:
ignoreErrors - whether to ignore errors
Returns:
the children
Throws:
java.io.IOException - for an error accessing the file system

createChildHandler

public VirtualFileHandler createChildHandler(java.lang.String name)
                                      throws java.io.IOException
Description copied from interface: StructuredVirtualFileHandler
Create a virtual file context

Specified by:
createChildHandler in interface StructuredVirtualFileHandler
Parameters:
name - the name
Returns:
the handler
Throws:
java.io.IOException - for any error accessing the virtual file system

findChild

public VirtualFileHandler findChild(java.lang.String path)
                             throws java.io.IOException
Description copied from interface: VirtualFileHandler
Find a child

Specified by:
findChild in interface VirtualFileHandler
Parameters:
path - the path
Returns:
the child
Throws:
java.io.IOException - for an error accessing the file system (or the child doesn't exist)

getVirtualFile

public VirtualFile getVirtualFile()
Description copied from interface: VirtualFileHandler
Get the virtual file wrapper

Specified by:
getVirtualFile in interface VirtualFileHandler
Overrides:
getVirtualFile in class AbstractVirtualFileHandler
Returns:
the wrapper

toURL

public java.net.URL toURL()
                   throws java.net.MalformedURLException,
                          java.net.URISyntaxException
Description copied from interface: VirtualFileHandler
Get the VF URL (file://root/org/jboss/X.java)

Specified by:
toURL in interface VirtualFileHandler
Overrides:
toURL in class AbstractVirtualFileHandler
Returns:
the full URL to the VF in the VFS.
Throws:
java.net.MalformedURLException - for any error
java.net.URISyntaxException - for an error parsing the URI