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, Ales Justin
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.jboss.virtual.plugins.context.AbstractVirtualFileHandler
cachedLastModified, log
 
Constructor Summary
AssembledDirectoryHandler(VFSContext 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
 AssembledDirectory getVirtualFile()
          Get the virtual file wrapper
protected  void internalReplaceChild(VirtualFileHandler original, VirtualFileHandler replacement)
          Replace original child with unpacked replacement.
 boolean isHidden()
          Whether it is hidden
 boolean isLeaf()
          Whether it is a simple leaf of the VFS, i.e.
 boolean isNested()
          Are we nested in some archive.
 InputStream openStream()
          Access the file contents.
 boolean removeChild(String name)
          This method removes a specified child from its list of children map
 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, cleanup, close, decrement, delete, doClose, equals, getChildPathName, getChildVfsUrl, getLocalPathName, getLocalVFSContext, getName, getParent, getPathName, getRealURL, getReferences, getVFSContext, getVfsUrl, hasBeenModified, hashCode, increment, isArchive, isTemporary, replaceChild, setPathName, setVfsUrl, simpleFindChild, structuredFindChild, toInternalVfsUrl, toString, toStringLocal, toVfsUrl
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AssembledDirectoryHandler

public AssembledDirectoryHandler(VFSContext context,
                                 AssembledDirectoryHandler parent,
                                 String name)
                          throws IOException
Throws:
IOException
Method Detail

addChild

public VirtualFileHandler addChild(VirtualFileHandler handler)

removeChild

public boolean removeChild(String name)
This method removes a specified child from its list of children map

Specified by:
removeChild in interface VirtualFileHandler
Parameters:
name - child name
Returns:
true if child was removed, false otherwise

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

isNested

public boolean isNested()
                 throws IOException
Description copied from interface: VirtualFileHandler
Are we nested in some archive.

Specified by:
isNested in interface VirtualFileHandler
Returns:
true if this is archive entry
Throws:
IOException - for any error

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 AssembledDirectory 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

internalReplaceChild

protected void internalReplaceChild(VirtualFileHandler original,
                                    VirtualFileHandler replacement)
Description copied from class: AbstractVirtualFileHandler
Replace original child with unpacked replacement.

Overrides:
internalReplaceChild in class AbstractVirtualFileHandler
Parameters:
original - the original
replacement - the replacement


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