[jboss-cvs] JBossAS SVN: r74577 - projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/zip.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sun Jun 15 12:50:23 EDT 2008


Author: mstruk
Date: 2008-06-15 12:50:22 -0400 (Sun, 15 Jun 2008)
New Revision: 74577

Modified:
   projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/zip/SizeLimitedInputStream.java
   projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/zip/ZipBytesWrapper.java
   projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/zip/ZipEntryContext.java
   projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/zip/ZipEntryContextFactory.java
   projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/zip/ZipEntryInputStream.java
   projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/zip/ZipFileLockReaper.java
   projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/zip/ZipFileWrapper.java
   projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/zip/ZipStreamWrapper.java
   projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/zip/ZipWrapper.java
Log:
javadoc

Modified: projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/zip/SizeLimitedInputStream.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/zip/SizeLimitedInputStream.java	2008-06-15 15:27:00 UTC (rev 74576)
+++ projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/zip/SizeLimitedInputStream.java	2008-06-15 16:50:22 UTC (rev 74577)
@@ -35,18 +35,31 @@
  */
 public class SizeLimitedInputStream extends InputStream
 {
-
+   /** Underlying input stream */
 	private InputStream in;
 
+   /** Number of bytes to read before size limit is reached */
    private long togo;
 
-	public SizeLimitedInputStream(InputStream ins, long size)
+   /**
+    * SizeLimitedInputStream constructor
+    *
+    * @param ins underlying input stream
+    * @param size number of bytes after which EOF will occur
+    */
+   public SizeLimitedInputStream(InputStream ins, long size)
    {
 		this.in = ins;
 		this.togo = size;
 	}
 
-	public int read() throws IOException
+   /**
+    * Read one byte
+    *
+    * @return -1 if stream has reached its size limit, otherwise whatever the underlying input stream returns
+    * @throws IOException for any error
+    */
+   public int read() throws IOException
    {
 		int b = -1;
 		if (togo > 0)
@@ -58,12 +71,28 @@
 		return b;
 	}
 
-	public int read(byte [] buf) throws IOException
+   /**
+    * Read a buffer of bytes
+    *
+    * @param buf read buffer
+    * @return -1 if stream has reached its size limit, otherwise whatever the underlying input stream returns
+    * @throws IOException for any error
+    */
+   public int read(byte [] buf) throws IOException
    {
 		return read(buf, 0, buf.length);
 	}
 
-	public int read(byte [] buf, int offs, int len) throws IOException
+   /**
+    * Read a buffer of bytes
+    *
+    * @param buf read buffer
+    * @param offs offset within buffer to be a start point
+    * @param len number of bytes to read
+    * @return -1 if stream has reached its size limit, otherwise whatever the underlying input stream returns
+    * @throws IOException for any error
+    */
+   public int read(byte [] buf, int offs, int len) throws IOException
    {
 		int rc = -1;
 
@@ -79,7 +108,12 @@
 		return rc;
 	}
 
-	public void close() throws IOException
+   /**
+    * Close the underlying input stream
+    *
+    * @throws IOException for any error
+    */
+   public void close() throws IOException
    {
 		in.close();
 	}

Modified: projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/zip/ZipBytesWrapper.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/zip/ZipBytesWrapper.java	2008-06-15 15:27:00 UTC (rev 74576)
+++ projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/zip/ZipBytesWrapper.java	2008-06-15 16:50:22 UTC (rev 74577)
@@ -34,14 +34,14 @@
  */
 abstract class ZipBytesWrapper extends ZipWrapper
 {
-   /** Raw zip archive loaded in memory */
+   /** Zip archive loaded in memory */
    private byte [] zipBytes;
 
    /** Name */
    private String name;
 
    /**
-    * ZipStreamWrapper is not aware of actual zip source so it can not detect
+    * ZipBytesWrapper is not aware of actual zip source so it can not detect
     * if it's been modified, like ZipFileWrapper does.
     *
     * @param zipStream the current zip input stream
@@ -61,40 +61,78 @@
       this.lastModified = lastModified;
    }
 
+   /**
+    * Returns true if archive exists
+    *
+    * @return always true
+    */
    boolean exists()
    {
       return true;
    }
 
+   /**
+    * Returns lastModified of this archive
+    *
+    * @return constant lastModified
+    */
    long getLastModified()
    {
       return lastModified;
    }
 
+   /**
+    * Returns the name of this archive
+    *
+    * @return name
+    */
    String getName()
    {
       return name;
    }
 
+   /**
+    * Returns the size of this archive
+    *
+    * @return uncompressed size of this archive
+    */
    long getSize()
    {
       return zipBytes.length;
    }
 
+   /**
+    * Returns raw bytes that represent this archive in its compressed form
+    *
+    * @return compressed bytes of this archive - as <tt>InputStream<tt>
+    * @throws FileNotFoundException for any error
+    */
    InputStream getRootAsStream() throws FileNotFoundException
    {
       return new ByteArrayInputStream(zipBytes);
    }
 
-   void acquire() throws IOException
+   /**
+    * Acquire lock. No-op in this implementation
+    */
+   void acquire()
    {
    }
 
+   /**
+    * Close this wrapper - release memory buffer that stores
+    * raw bytes of the archive in its compressed form
+    */
    void close()
    {
       zipBytes = null;
    }
 
+   /**
+    * String description of this archive
+    *
+    * @return string description of this archive
+    */
    public String toString()
    {
       return super.toString() + " - " + name;

Modified: projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/zip/ZipEntryContext.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/zip/ZipEntryContext.java	2008-06-15 15:27:00 UTC (rev 74576)
+++ projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/zip/ZipEntryContext.java	2008-06-15 16:50:22 UTC (rev 74577)
@@ -90,6 +90,7 @@
  */
 public class ZipEntryContext extends AbstractVFSContext
 {
+   /** Logger */
    private static final Logger log = Logger.getLogger(ZipEntryContext.class);
 
    /** Global setting for nested archive processing mode: copy or no-copy (default) */
@@ -193,7 +194,7 @@
    }
 
    /**
-    * Extra initialization that couldn't fit inside constructors
+    * Extra initialization in addition to what's inside constructors
     *
     * @param localRootURL the local url
     * @param peer the peer
@@ -590,11 +591,24 @@
       }
    }
 
+   /**
+    * Returns this context's root
+    *
+    * @return root handler
+    * @throws IOException for any error
+    */
    public VirtualFileHandler getRoot() throws IOException
    {
       return entries.get("").handler;
    }
 
+   /**
+    * Find a child with a given name and a given parent
+    *
+    * @param parent parent handler
+    * @param name  name of the child
+    * @return child handler or null if not found
+    */
    public VirtualFileHandler getChild(ZipEntryHandler parent, String name)
    {
       if (parent == null)
@@ -615,6 +629,14 @@
       return null;
    }
 
+   /**
+    * Returns a list of children for a given parent
+    *
+    * @param parent parent handler
+    * @param ignoreErrors true if errors should be silently ignored
+    * @return list of handlers representing children of the given parent
+    * @throws IOException for any error
+    */
    public List<VirtualFileHandler> getChildren(VirtualFileHandler parent, boolean ignoreErrors) throws IOException
    {
       if (parent == null)
@@ -636,6 +658,12 @@
       return Collections.emptyList();
    }
 
+   /**
+    * Returns lastModified timestamp for a given handler
+    *
+    * @param handler a handler
+    * @return lastModified timestamp
+    */
    public long getLastModified(ZipEntryHandler handler)
    {
       if (handler == null)
@@ -653,6 +681,12 @@
       return ei.entry.getTime();
    }
 
+   /**
+    * Returns the size for a given handler
+    *
+    * @param handler a handler
+    * @return size in bytes
+    */
    public long getSize(ZipEntryHandler handler)
    {
       if (handler == null)
@@ -675,6 +709,12 @@
       return ei.entry.getSize();
    }
 
+   /**
+    * Returns true if entry exists for a given handler
+    *
+    * @param handler a handler
+    * @return true if entry exists
+    */
    public boolean exists(ZipEntryHandler handler)
    {
       if (handler == null)
@@ -692,6 +732,12 @@
       return true;
    }
 
+   /**
+    * Returns true if handler represents a non-directory entry
+    *
+    * @param handler a handler
+    * @return true if not a directory
+    */
    public boolean isLeaf(ZipEntryHandler handler)
    {
       if (handler == null)
@@ -765,6 +811,13 @@
       return false;
    }
 
+   /**
+    * Contents of the file represented by a given handler
+    *
+    * @param handler a handler
+    * @return InputStream with entry's content
+    * @throws IOException for any error
+    */
    public InputStream openStream(ZipEntryHandler handler) throws IOException
    {
       if (handler == null)
@@ -800,6 +853,12 @@
       return zipSource.openStream(ei.entry);
    }
 
+   /**
+    * Add a child to a given parent
+    *
+    * @param parent a parent
+    * @param child a child
+    */
    public void addChild(AbstractVirtualFileHandler parent, AbstractVirtualFileHandler child)
    {
       if (parent == null)
@@ -815,6 +874,9 @@
          throw new RuntimeException("Parent does not exist: " + parent);
    }
 
+   /**
+    * Properly release held resources
+    */
    protected void finalize()
    {
       try
@@ -829,6 +891,13 @@
       }
    }
 
+   /**
+    * Replace a current child of the given parent with another one
+    *
+    * @param parent a parent
+    * @param original current child
+    * @param replacement new child
+    */
    public void replaceChild(ZipEntryHandler parent, AbstractVirtualFileHandler original, VirtualFileHandler replacement)
    {
       EntryInfo parentEntry = entries.get(parent.getLocalPathName());
@@ -866,16 +935,32 @@
     */
    static class EntryInfo
    {
+      /** a handler */
       private AbstractVirtualFileHandler handler;
+
+      /** a <tt>ZipEntry</tt> */
       private ZipEntry entry;
+
+      /** a list of children */
       private List<AbstractVirtualFileHandler> children;
 
+      /**
+       * EntryInfo constructor
+       *
+       * @param handler a handler
+       * @param entry an entry
+       */
       EntryInfo(AbstractVirtualFileHandler handler, ZipEntry entry)
       {
          this.handler = handler;
          this.entry = entry;
       }
 
+      /**
+       * Get children.
+       *
+       * @return returns a list of children for this handler (by copy)
+       */
       public synchronized List<VirtualFileHandler> getChildren()
       {
          if (children == null)
@@ -884,6 +969,12 @@
          return new LinkedList<VirtualFileHandler>(children);
       }
 
+      /**
+       * Replace a child.
+       *
+       * @param original existing child
+       * @param replacement new child
+       */
       public synchronized void replaceChild(AbstractVirtualFileHandler original, AbstractVirtualFileHandler replacement)
       {
          if (children != null)
@@ -903,12 +994,20 @@
          }
       }
 
+      /**
+       * Clear the list of children
+       */
       public synchronized void clearChildren()
       {
          if (children != null)
             children.clear();
       }
 
+      /**
+       * Add a child. If a child with the same name exists already, first remove it.
+       *
+       * @param child a child
+       */
       public synchronized void add(AbstractVirtualFileHandler child)
       {
          if (children == null)
@@ -1045,7 +1144,7 @@
    }
 
    /**
-    * Use VFS's temp directory and make 'vfs-nested' sub-directory inside it for our purposes
+    * Use VFS's temp directory and make 'vfs-nested.tmp' sub-directory inside it for our purposes
     *
     * @return temp dir
     */
@@ -1056,7 +1155,7 @@
    }
 
    /**
-    * Delete first-level files only, don't drill down
+    * Delete the contents of a temporary directory. Delete first-level files only, don't drill down.
     */
    private static void deleteTmpDirContents()
    {
@@ -1078,6 +1177,9 @@
       }
    }
 
+   /**
+    * <tt>PriviligedAction</tt> class for checking a system property
+    */
    private static class CheckForceCopy implements PrivilegedAction<Boolean>
    {
       public Boolean run()

Modified: projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/zip/ZipEntryContextFactory.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/zip/ZipEntryContextFactory.java	2008-06-15 15:27:00 UTC (rev 74576)
+++ projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/zip/ZipEntryContextFactory.java	2008-06-15 16:50:22 UTC (rev 74577)
@@ -49,13 +49,16 @@
       super("zip", "vfszip");  // "jar", "vfsjar",  
    }
 
+   /**
+    * Get a <tt>VFSContext</tt> for a given <tt>URL</tt>
+    */
    public VFSContext getVFS(URI rootURI) throws IOException
    {
       return getVFS(rootURI.toURL());
    }
 
    /**
-    * Find a best matching existing ZipEntryContext, or create a new one if none matches.
+    * Create a new <tt>ZipEntryContext</tt>.
     *
     * @param rootURL the root url
     * @return new zip context
@@ -75,6 +78,9 @@
       }
    }
 
+   /**
+    * Get a reference to <tt>ZipEntryContextFactory</tt>.
+    */
    public static ZipEntryContextFactory getInstance()
    {
       return instance;

Modified: projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/zip/ZipEntryInputStream.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/zip/ZipEntryInputStream.java	2008-06-15 15:27:00 UTC (rev 74576)
+++ projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/zip/ZipEntryInputStream.java	2008-06-15 16:50:22 UTC (rev 74577)
@@ -36,12 +36,23 @@
 
 public class ZipEntryInputStream extends InputStream
 {
+   /** Underlying input stream */
    private InputStream delegate;
 
+   /** Underlying zip source */
    private ZipFileWrapper zipWrapper;
 
+   /** Is stream closed */
    private boolean closed;
 
+   /**
+    * ZipEntryInputStream constructor.
+    *
+    * @param zipWrapper underlying zip source
+    * @param is underlying input stream
+    * @throws IOException for any error
+    * @throws IllegalArgumentException if insput stream is null
+    */
    ZipEntryInputStream(ZipFileWrapper zipWrapper, InputStream is) throws IOException
    {
       if (is == null)
@@ -51,6 +62,9 @@
       delegate = is;
    }
 
+   /**
+    * Close this stream and release zipWrapper
+    */
    private void streamClosed(boolean doClose)
    {
       if (closed == false && doClose)
@@ -60,6 +74,13 @@
       }
    }
 
+   /**
+    * Read one byte.
+    *
+    * @return whatever the underlying input stream returns
+    * @throws IOException for any error
+    * @see java.io.InputStream#read
+    */
    public int read() throws IOException
    {
       int rc = -1;
@@ -74,6 +95,15 @@
       }
    }
 
+   /**
+    * Read a buffer of bytes.
+    *
+    * @param buf read buffer
+    * @return whatever the underlying input stream returns
+    *
+    * @throws IOException for any error
+    * @see java.io.InputStream#read(byte[])
+    */
    public int read(byte buf[]) throws IOException
    {
       int rc = -1;
@@ -88,6 +118,16 @@
       }
    }
 
+   /**
+    * Read a buffer of bytes.
+    *
+    * @param buf read buffer
+    * @param off position within buffer to start reading at
+    * @param len maximum bytes to read
+    * @return whatever the underlying input stream returns
+    * @throws IOException for any error
+    * @see java.io.InputStream#read(byte[],int,int)
+    */
    public int read(byte buf[], int off, int len) throws IOException
    {
       int rc = -1;
@@ -102,6 +142,9 @@
       }
    }
 
+   /**
+    * @see java.io.InputStream#reset
+    */
    public synchronized void reset() throws IOException
    {
       boolean ok = false;
@@ -116,6 +159,9 @@
       }
    }
 
+   /**
+    * @see java.io.InputStream#mark
+    */
    public synchronized void mark(int readlimit)
    {
       boolean ok = false;
@@ -130,6 +176,9 @@
       }
    }
 
+   /**
+    * @see java.io.InputStream#available
+    */
    public int available() throws IOException
    {
       boolean ok = false;
@@ -145,6 +194,9 @@
       }
    }
 
+   /**
+    * @see java.io.InputStream#skip
+    */
    public long skip(long n) throws IOException
    {
       boolean ok = false;
@@ -160,12 +212,20 @@
       }
    }
 
+   /**
+    * Close this stream and release zipWrapper
+    *
+    * @see java.io.InputStream#close
+    */
    public void close() throws IOException
    {
       streamClosed(true);
       super.close();
    }
 
+   /**
+    * Properly release held resources
+    */
    protected void finalize()
    {
       try
@@ -177,9 +237,13 @@
       }
    }
 
+   /**
+    * isClosed.
+    *
+    * @return returns true if closed
+    */
    boolean isClosed()
    {
       return closed;
    }
-
 }

Modified: projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/zip/ZipFileLockReaper.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/zip/ZipFileLockReaper.java	2008-06-15 15:27:00 UTC (rev 74576)
+++ projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/zip/ZipFileLockReaper.java	2008-06-15 16:50:22 UTC (rev 74577)
@@ -37,6 +37,7 @@
  */
 public class ZipFileLockReaper
 {
+   /** Logger */
    private static final Logger log = Logger.getLogger(ZipFileLockReaper.class);
 
    /**

Modified: projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/zip/ZipFileWrapper.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/zip/ZipFileWrapper.java	2008-06-15 15:27:00 UTC (rev 74576)
+++ projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/zip/ZipFileWrapper.java	2008-06-15 16:50:22 UTC (rev 74577)
@@ -46,8 +46,10 @@
  */
 class ZipFileWrapper extends ZipWrapper
 {
+   /** Logger */
    private static final Logger log = Logger.getLogger(ZipFileWrapper.class);
 
+   /** Is forceNoReaper enabled */
    private static boolean forceNoReaper;
 
    static
@@ -58,12 +60,13 @@
          log.info("VFS forced no-reaper-mode is enabled.");
    }
 
+   /** Underlying zip archive file */
    private File file;
 
-   /** zip inflater wrapped around file */
+   /** Zip inflater wrapped around file */
    private ZipFile zipFile;
 
-   /** true for extracted nested jars that we want removed when this wrapper is closed */
+   /** autoClean flag - true for extracted nested jars that we want removed when this wrapper is closed */
    private boolean autoClean;
 
    /** true if noReaper mode is forced on a per-instance basis */
@@ -72,12 +75,26 @@
    // used for debugging stream leaks
    //ConcurrentLinkedQueue<ZipEntryInputStream> streams = new ConcurrentLinkedQueue<ZipEntryInputStream>();
 
+   /**
+    * ZipFileWrapper
+    *
+    * @param archive file to the archive
+    * @param autoClean  should archive be deleted after use
+    * @param noReaperOverride flag to specify if reaper be used or not
+    */
    ZipFileWrapper(File archive, boolean autoClean, boolean noReaperOverride)
    {
       this.noReaperOverride = noReaperOverride;
       init(archive, autoClean);
    }
 
+   /**
+    * ZipFileWrapper
+    *
+    * @param rootPathURI URI to the archive - will be passed to File constructor as-is
+    * @param autoClean  should archive be deleted after use
+    * @param noReaperOverride flag to specify if reaper be used or not
+    */
    ZipFileWrapper(URI rootPathURI, boolean autoClean, boolean noReaperOverride)
    {
       this.noReaperOverride = noReaperOverride;
@@ -89,7 +106,7 @@
    }
 
    /**
-    * Extra initialization that didn't fit in constructors
+    * Extra initialization in addition to what's in constructors
     *
     * @param archive the archive file
     * @param autoClean auto clean flag
@@ -103,26 +120,52 @@
          file.deleteOnExit();
    }
 
+   /**
+    * Check if archive exists
+    *
+    * @return true if file exists on disk
+    */
    boolean exists()
    {
       return file.isFile();
    }
 
+   /**
+    * Get lastModified for the archive
+    *
+    * @return lastModified timestamp of the file on disk
+    */
    long getLastModified()
    {
       return file.lastModified();
    }
 
+   /**
+    * Get the name of the archive
+    *
+    * @return name of the file on disk
+    */
    String getName()
    {
       return file.getName();
    }
 
+   /**
+    * Get the size of the archive
+    *
+    * @return size of the file on disk
+    */
    long getSize()
    {
       return file.length();
    }
 
+   /**
+    * Open a <tt>ZipFile</tt> if none currently exists. If reaper mode is active, apply for monitoring.
+    *
+    * @return a ZipFile
+    * @throws IOException for any error
+    */
    private ZipFile ensureZipFile() throws IOException
    {
       if (zipFile == null)
@@ -135,6 +178,11 @@
       return zipFile;
    }
 
+   /**
+    * Close a <tt>ZipFile</tt> if currently open. If reaper mode is active, unregister from monitoring
+    *
+    * @throws IOException for any error
+    */
    synchronized void closeZipFile() throws IOException
    {
       if (zipFile != null && getReferenceCount() <= 0)
@@ -147,6 +195,13 @@
       }
    }
 
+   /**
+    * Get the contents of the given <tt>ZipEntry</tt> as stream
+    *
+    * @param ent a zip entry
+    * @return an InputStream that locks the file for as long as it's open
+    * @throws IOException for any error
+    */
    synchronized InputStream openStream(ZipEntry ent) throws IOException
    {
       ensureZipFile();
@@ -163,17 +218,31 @@
       return zis;
    }
 
+   /**
+    * Get raw bytes of this archive in its compressed form
+    *
+    * @return an InputStream
+    * @throws FileNotFoundException if archive doesn't exist
+    */
    InputStream getRootAsStream() throws FileNotFoundException
    {
       return new FileInputStream(file);
    }
 
+   /**
+    * Increment usage count by one and ensure <tt>ZipFile</tt> is open.
+    *
+    * @throws IOException
+    */
    synchronized void acquire() throws IOException
    {
       ensureZipFile();
       incrementRef();
    }
 
+   /**
+    * Decrement usage count by one
+    */
    synchronized void release() {
       super.release();
       if (forceNoReaper || noReaperOverride)
@@ -187,11 +256,17 @@
          }
    }
 
+   /**
+    * Enumerate contents of zip archive
+    */
    synchronized Enumeration<? extends ZipEntry> entries() throws IOException
    {
       return ensureZipFile().entries();
    }
 
+   /**
+    * Close the archive, perform autoclean if requested
+    */
    void close()
    {
       try
@@ -207,11 +282,19 @@
          file.delete();
    }
 
+   /**
+    * toString
+    *
+    * @return String description of this archive
+    */
    public String toString()
    {
       return super.toString() + " - " + file.getAbsolutePath();
    }
 
+   /**
+    * PriviligedAction used to read a system property
+    */
    private static class CheckNoReaper implements PrivilegedAction<Boolean>
    {
       public Boolean run()

Modified: projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/zip/ZipStreamWrapper.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/zip/ZipStreamWrapper.java	2008-06-15 15:27:00 UTC (rev 74576)
+++ projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/zip/ZipStreamWrapper.java	2008-06-15 16:50:22 UTC (rev 74577)
@@ -21,10 +21,17 @@
 */
 package org.jboss.virtual.plugins.context.zip;
 
+import org.jboss.logging.Logger;
 import org.jboss.virtual.VFSUtils;
-import org.jboss.logging.Logger;
 
-import java.io.*;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
 import java.util.Enumeration;
 import java.util.Iterator;
 import java.util.LinkedHashMap;
@@ -32,8 +39,6 @@
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipInputStream;
 import java.util.zip.ZipOutputStream;
-import java.security.PrivilegedAction;
-import java.security.AccessController;
 
 /**
  * ZipStreamWrapper - for abstracted access to in-memory zip file

Modified: projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/zip/ZipWrapper.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/zip/ZipWrapper.java	2008-06-15 15:27:00 UTC (rev 74576)
+++ projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/zip/ZipWrapper.java	2008-06-15 16:50:22 UTC (rev 74577)
@@ -70,6 +70,11 @@
       return false;
    }
 
+   /**
+    * get lastUsed timestamp
+    *
+    * @return
+    */
    long getLastUsed()
    {
       return lastUsed;
@@ -85,12 +90,18 @@
       return refCount;
    }
 
+   /**
+    * Increment usage count by one
+    */
    void incrementRef()
    {
       refCount++;
       lastUsed = System.currentTimeMillis();
    }
 
+   /**
+    * Decrement usage count by one
+    */
    synchronized void release()
    {
       refCount--;
@@ -100,21 +111,68 @@
       }
    }
 
+   /**
+    * Acquire lock.
+    *
+    * @throws IOException for any error
+    */
    abstract void acquire() throws IOException;
 
+   /**
+    * Get lastModified of this archive
+    *
+    * @return lastModified timestamp
+    */
    abstract long getLastModified();
 
+   /**
+    * Get the name of this archive
+    *
+    * @return name
+    */
    abstract String getName();
 
+   /**
+    * Check if archive exists
+    *
+    * @return true if archive exists
+    */
    abstract boolean exists();
 
+   /**
+    * Get the size of the archive
+    *
+    * @return size in bytes
+    */
    abstract long getSize();
-   
+
+   /**
+    * Enumerate contents of this archive
+    *
+    * @return enumeration of ZipEntries
+    * @throws IOException for any error
+    */
    abstract Enumeration<? extends ZipEntry> entries() throws IOException;
 
+   /**
+    * Get the contents of a given entry as stream
+    *
+    * @param ent zip entry
+    * @return InputStream with entry's contents
+    * @throws IOException for any error
+    */
    abstract InputStream openStream(ZipEntry ent) throws IOException;
 
+   /**
+    * Get raw bytes of this archive in its compressed form
+    *
+    * @return InputStream containing raw archive
+    * @throws FileNotFoundException if archive doesn't exist
+    */
    abstract InputStream getRootAsStream() throws FileNotFoundException;
 
+   /**
+    * Close this archive
+    */
    abstract void close();
 }




More information about the jboss-cvs-commits mailing list