org.jboss.virtual.plugins.context.jar
Class AbstractStructuredJarHandler<T>

java.lang.Object
  extended by org.jboss.virtual.plugins.context.AbstractVirtualFileHandler
      extended by org.jboss.virtual.plugins.context.AbstractURLHandler
          extended by org.jboss.virtual.plugins.context.jar.AbstractJarHandler
              extended by org.jboss.virtual.plugins.context.jar.AbstractStructuredJarHandler<T>
Type Parameters:
T - exact extra wrapper type
All Implemented Interfaces:
Serializable, StructuredVirtualFileHandler, VirtualFileHandler
Direct Known Subclasses:
JarHandler, NestedJarFromStream, NestedJarHandler

public abstract class AbstractStructuredJarHandler<T>
extends AbstractJarHandler
implements StructuredVirtualFileHandler

AbstractStructuredJarHandler.

Author:
Ales Justin
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.jboss.virtual.plugins.context.AbstractVirtualFileHandler
cachedLastModified, log
 
Constructor Summary
protected AbstractStructuredJarHandler(VFSContext context, VirtualFileHandler parent, URL url, JarFile jar, ZipEntry entry, String name)
          Create a new JarHandler.
 
Method Summary
protected  VirtualFileHandler buildParents(String parentName, Map<String,VirtualFileHandler> parentMap, org.jboss.virtual.plugins.context.jar.ZipEntryWrapper<T> wrapper)
          Create any missing parents.
 VirtualFileHandler createChildHandler(String name)
          Create a virtual file context
protected  VirtualFileHandler createSynthenticParent(VirtualFileHandler parent, String path, org.jboss.virtual.plugins.context.jar.ZipEntryWrapper<T> wrapper)
           
protected  VirtualFileHandler createVirtualFileHandler(VirtualFileHandler parent, org.jboss.virtual.plugins.context.jar.ZipEntryWrapper<T> wrapper, String entryName)
          Create a new virtual file handler
protected  void extraWrapperInfo(org.jboss.virtual.plugins.context.jar.ZipEntryWrapper<T> wrapper)
          Handle additional information about wrapper.
 VirtualFileHandler getChild(String path)
          Get a child
 List<VirtualFileHandler> getChildren(boolean ignoreErrors)
          Get the children
protected  void initJarFile()
          Initialize the jar file
protected  void initJarFile(Enumeration<org.jboss.virtual.plugins.context.jar.ZipEntryWrapper<T>> enumeration)
          Initialise the jar file.
protected  void internalReplaceChild(VirtualFileHandler original, VirtualFileHandler replacement)
          Replace original child with unpacked replacement.
 boolean isArchive()
          Does this represent an archive.
 
Methods inherited from class org.jboss.virtual.plugins.context.jar.AbstractJarHandler
fromURL, getEntry, getJar, getURL, handleJarFile, isLeaf
 
Methods inherited from class org.jboss.virtual.plugins.context.AbstractURLHandler
exists, getLastModified, getSize, getURL, initCacheLastModified, isHidden, openConnection, openConnection, openStream, toURI, toURL
 
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, getVirtualFile, hasBeenModified, hashCode, increment, 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
 
Methods inherited from interface org.jboss.virtual.spi.VirtualFileHandler
isNested, removeChild
 

Constructor Detail

AbstractStructuredJarHandler

protected AbstractStructuredJarHandler(VFSContext context,
                                       VirtualFileHandler parent,
                                       URL url,
                                       JarFile jar,
                                       ZipEntry entry,
                                       String name)
                                throws IOException
Create a new JarHandler.

Parameters:
context - the context
parent - the parent
url - the url
jar - the jar
entry - the entry
name - the name
Throws:
IOException - for an error accessing the file system
IllegalArgumentException - for a null context, url or vfsPath
Method Detail

initJarFile

protected void initJarFile()
                    throws IOException
Initialize the jar file

Throws:
IOException - for any error reading the jar file
IllegalArgumentException - for a null jarFile

initJarFile

protected void initJarFile(Enumeration<org.jboss.virtual.plugins.context.jar.ZipEntryWrapper<T>> enumeration)
                    throws IOException
Initialise the jar file.

Parameters:
enumeration - jar entry enumeration
Throws:
IOException - for any error

extraWrapperInfo

protected void extraWrapperInfo(org.jboss.virtual.plugins.context.jar.ZipEntryWrapper<T> wrapper)
                         throws IOException
Handle additional information about wrapper.

Parameters:
wrapper - the zip entry wrapper
Throws:
IOException - for any error

buildParents

protected VirtualFileHandler buildParents(String parentName,
                                          Map<String,VirtualFileHandler> parentMap,
                                          org.jboss.virtual.plugins.context.jar.ZipEntryWrapper<T> wrapper)
                                   throws IOException
Create any missing parents.

Parameters:
parentName - full vfs path name of parent
parentMap - initJarFile parentMap
wrapper - ZipEntryWrapper missing a parent
Returns:
the VirtualFileHandler for the parent
Throws:
IOException - for any IO error

createSynthenticParent

protected VirtualFileHandler createSynthenticParent(VirtualFileHandler parent,
                                                    String path,
                                                    org.jboss.virtual.plugins.context.jar.ZipEntryWrapper<T> wrapper)
                                             throws IOException
Throws:
IOException

isArchive

public boolean isArchive()
                  throws IOException
Description copied from interface: VirtualFileHandler
Does this represent an archive. e.g. zip, tar, ...

Specified by:
isArchive in interface VirtualFileHandler
Overrides:
isArchive in class AbstractVirtualFileHandler
Returns:
true if archive, false otherwise
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

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

createVirtualFileHandler

protected VirtualFileHandler createVirtualFileHandler(VirtualFileHandler parent,
                                                      org.jboss.virtual.plugins.context.jar.ZipEntryWrapper<T> wrapper,
                                                      String entryName)
                                               throws IOException
Create a new virtual file handler

Parameters:
parent - the parent
wrapper - the entry wrapper
entryName - - the entry name without any trailing '/'
Returns:
the handler
Throws:
IOException - for any error accessing the file system
IllegalArgumentException - for a null parent or entry

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 © 2009 JBoss, A division of Red Hat, Inc. All Rights Reserved.