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

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<Object>
                  extended by org.jboss.virtual.plugins.context.jar.NestedJarHandler
All Implemented Interfaces:
Serializable, StructuredVirtualFileHandler, VirtualFileHandler

public class NestedJarHandler
extends AbstractStructuredJarHandler<Object>

Nested Jar Handler.

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

Field Summary
 
Fields inherited from class org.jboss.virtual.plugins.context.AbstractVirtualFileHandler
cachedLastModified, log
 
Constructor Summary
protected NestedJarHandler(VFSContext context, VirtualFileHandler parent, JarFile parentJar, ZipEntry entry, URL original, File temp, String entryName)
          Create a new NestedJarHandler.
 
Method Summary
 void cleanup()
          Cleanup resources.
static NestedJarHandler create(VFSContext context, VirtualFileHandler parent, JarFile parentJar, ZipEntry entry, URL url, String entryName)
           
 boolean delete(int gracePeriod)
          Delete the file represented by this handler.
 long getLastModified()
          When the file was last modified
 long getSize()
          Get the size
 boolean isNested()
          Are we nested in some archive.
 InputStream openStream()
          Overriden to return the raw tmp jar file stream
 boolean removeChild(String name)
          Remove a child
 
Methods inherited from class org.jboss.virtual.plugins.context.jar.AbstractStructuredJarHandler
buildParents, createChildHandler, createSynthenticParent, createVirtualFileHandler, extraWrapperInfo, getChild, getChildren, initJarFile, initJarFile, internalReplaceChild, isArchive
 
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, getURL, initCacheLastModified, isHidden, openConnection, openConnection, toURI, toURL
 
Methods inherited from class org.jboss.virtual.plugins.context.AbstractVirtualFileHandler
checkClosed, checkParentExists, close, decrement, 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
 

Constructor Detail

NestedJarHandler

protected NestedJarHandler(VFSContext context,
                           VirtualFileHandler parent,
                           JarFile parentJar,
                           ZipEntry entry,
                           URL original,
                           File temp,
                           String entryName)
                    throws IOException
Create a new NestedJarHandler.

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

create

public static NestedJarHandler create(VFSContext context,
                                      VirtualFileHandler parent,
                                      JarFile parentJar,
                                      ZipEntry entry,
                                      URL url,
                                      String entryName)
                               throws IOException
Throws:
IOException

getLastModified

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

Specified by:
getLastModified in interface VirtualFileHandler
Overrides:
getLastModified in class AbstractURLHandler
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
Overrides:
getSize in class AbstractURLHandler
Returns:
the size
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.

Returns:
true if this is archive entry
Throws:
IOException - for any error

openStream

public InputStream openStream()
                       throws IOException
Overriden to return the raw tmp jar file stream

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

removeChild

public boolean removeChild(String name)
                    throws IOException
Description copied from interface: VirtualFileHandler
Remove a child

Parameters:
name - child name
Returns:
true if child was removed, false otherwise
Throws:
IOException - if an error occurs

cleanup

public void cleanup()
Description copied from interface: VirtualFileHandler
Cleanup resources.

Specified by:
cleanup in interface VirtualFileHandler
Overrides:
cleanup in class AbstractVirtualFileHandler

delete

public boolean delete(int gracePeriod)
               throws IOException
Description copied from class: AbstractVirtualFileHandler
Delete the file represented by this handler. File deletion is comprised of two parts:
  1. physical file deletion - performed by this method or its override
  2. removal of any child references from the parent - performed by VirtualFileHandler.removeChild(String) of the parent
This method doesn't do any physical file removal because it has no concept of underlying physical file. An implementation that does physical file removal should override this method and call super.delete() at the end.

Specified by:
delete in interface VirtualFileHandler
Overrides:
delete in class AbstractVirtualFileHandler
Parameters:
gracePeriod - max time to wait for any locks
Returns:
true if file was deleted, false otherwise
Throws:
IOException - if an error occurs


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