org.jboss.virtual.plugins.context.jar
Class AbstractJarHandler

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
All Implemented Interfaces:
Serializable, VirtualFileHandler
Direct Known Subclasses:
AbstractStructuredJarHandler, JarEntryContents, JarEntryHandler, NoCopyNestedJarHandler

public abstract class AbstractJarHandler
extends AbstractURLHandler

AbstractJarHandler.

Version:
$Revision: 1.1 $
Author:
Ales Justin, Adrian Brock, Scott.Stark@jboss.org
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.jboss.virtual.plugins.context.AbstractVirtualFileHandler
cachedLastModified, log
 
Constructor Summary
protected AbstractJarHandler(VFSContext context, VirtualFileHandler parent, URL url, JarFile jar, ZipEntry entry, String name)
          Create a new JarHandler.
 
Method Summary
static JarFile fromURL(URL url)
          Convert a URL into a JarFIle
 ZipEntry getEntry()
          Get the entry.
 JarFile getJar()
          Get the jar.
protected  URL getURL(VirtualFileHandler parent, String path, boolean isDirEntry)
          Create the URL for the entry represented by path.
protected  void handleJarFile()
          Handle jar file after read.
 boolean isLeaf()
          Whether it is a simple leaf of the VFS, i.e.
 
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, internalReplaceChild, 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
 
Methods inherited from interface org.jboss.virtual.spi.VirtualFileHandler
getChild, getChildren, isNested, removeChild
 

Constructor Detail

AbstractJarHandler

protected AbstractJarHandler(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

getJar

public JarFile getJar()
Get the jar.

Returns:
the jar.

getEntry

public ZipEntry getEntry()
Get the entry.

Returns:
jar entry

getURL

protected URL getURL(VirtualFileHandler parent,
                     String path,
                     boolean isDirEntry)
              throws MalformedURLException
Create the URL for the entry represented by path.

Parameters:
parent - - the parent handler
path - - the simple path to the entry without any trailing '/'
isDirEntry - - whether this is a directory entry
Returns:
the jar entry URL
Throws:
MalformedURLException - if illegal URL form

isLeaf

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

Returns:
true if a simple file.

fromURL

public static JarFile fromURL(URL url)
                       throws IOException
Convert a URL into a JarFIle

Parameters:
url - the url to convert
Returns:
the jar file
Throws:
IOException - for any IO error

handleJarFile

protected void handleJarFile()
                      throws IOException
Handle jar file after read. Find the real jar file, if nested.

Throws:
IOException - for any error


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