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:
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
 
Constructor Summary
AssembledDirectoryHandler(AssembledContext context, AssembledDirectoryHandler parent, String name)
           
 
Method Summary
 VirtualFileHandler addChild(VirtualFileHandler handler)
           
 VirtualFileHandler createChildHandler(String name)
          Create a virtual file context
 boolean exists()
          Tests whether the underlying implementation file still exists.
 VirtualFileHandler findChild(String name)
           
 VirtualFileHandler getChild(String path)
          Get a child
 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. whether it can contain other files
 InputStream openStream()
          Access the file contents.
 URI toURI()
          Get the VF URI (file://root/org/jboss/X.java)
 URL toURL()
          Get the VF URL (file://root/org/jboss/X.java)
 
Methods inherited from class org.jboss.virtual.plugins.context.AbstractVirtualFileHandler
checkClosed, checkParentExists, close, decrement, doClose, equals, getChildPathName, getChildVfsUrl, getName, getParent, getPathName, getVFSContext, getVfsUrl, hasBeenModified, hashCode, increment, setPathName, setVfsUrl, 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,
                                 String name)
                          throws IOException
Throws:
IOException
Method Detail

addChild

public VirtualFileHandler addChild(VirtualFileHandler handler)

findChild

public VirtualFileHandler findChild(String name)

getChild

public VirtualFileHandler getChild(String path)
                            throws IOException
Description copied from interface: VirtualFileHandler
Get a child

Specified by:
getChild in interface VirtualFileHandler
Parameters:
path - the path
Returns:
the child or null if not found
Throws:
IOException - for an error accessing the file system

toURI

public URI toURI()
          throws 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:
URISyntaxException - for an error parsing the URI

getLastModified

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

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

getSize

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

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

exists

public boolean exists()
               throws 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:
IOException - - thrown on failure to detect existence.

isLeaf

public boolean isLeaf()
               throws 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:
IOException - for any problem accessing the virtual file system

isHidden

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

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

openStream

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

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

getChildren

public List<VirtualFileHandler> getChildren(boolean ignoreErrors)
                                     throws 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:
IOException - for an error accessing the file system

createChildHandler

public VirtualFileHandler createChildHandler(String name)
                                      throws 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:
IOException - for any error accessing the virtual file system

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 URL toURL()
          throws MalformedURLException,
                 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:
MalformedURLException - for any error
URISyntaxException - for an error parsing the URI


Copyright © 2008 JBoss, A division of Red Hat, Inc. All Rights Reserved.