[jboss-svn-commits] JBoss Common SVN: r3943 - in shrinkwrap/trunk: impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/exporter and 1 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Thu Jan 21 00:03:50 EST 2010


Author: ALRubinger
Date: 2010-01-21 00:03:50 -0500 (Thu, 21 Jan 2010)
New Revision: 3943

Added:
   shrinkwrap/trunk/api/src/main/java/org/jboss/shrinkwrap/api/exporter/ZipExportTask.java
Removed:
   shrinkwrap/trunk/api/src/main/java/org/jboss/shrinkwrap/api/exporter/ZipExportHandle.java
Modified:
   shrinkwrap/trunk/api/src/main/java/org/jboss/shrinkwrap/api/exporter/ZipExporter.java
   shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/exporter/JdkZipExporterDelegate.java
   shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/exporter/ZipExportHandleImpl.java
   shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/exporter/ZipExporterImpl.java
   shrinkwrap/trunk/impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/exporter/ZipExporterTestCase.java
Log:
[SHRINKWRAP-116] Rename ZipExportHandle to ZipExportTask

Deleted: shrinkwrap/trunk/api/src/main/java/org/jboss/shrinkwrap/api/exporter/ZipExportHandle.java
===================================================================
--- shrinkwrap/trunk/api/src/main/java/org/jboss/shrinkwrap/api/exporter/ZipExportHandle.java	2010-01-21 05:00:35 UTC (rev 3942)
+++ shrinkwrap/trunk/api/src/main/java/org/jboss/shrinkwrap/api/exporter/ZipExportHandle.java	2010-01-21 05:03:50 UTC (rev 3943)
@@ -1,56 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2010, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
-  *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.shrinkwrap.api.exporter;
-
-import java.io.InputStream;
-
-/**
- * Handle returned to callers from a request to export via
- * the {@link ZipExporter}.  As the encoding process is an asynchronous
- * operation, here we provide the user access to read the 
- * content as well as check for completeness and integrity.
- *
- * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
- */
-public interface ZipExportHandle
-{
-   /**
-    * Obtains an {@link InputStream} from which the encoded
-    * content may be read.
-    * 
-    * @return
-    */
-   InputStream getContent();
-
-   /**
-    * Blocking operation which will wait until the encoding process's internal
-    * streams have been closed and verified for integrity.  Do not call this method
-    * until all bytes have been read from {@link ZipExportHandle#getContent()}; otherwise 
-    * this may introduce a deadlock.  Any problems with the encoding process will be reported
-    * by throwing {@link ArchiveExportException}.
-    * @return
-    * @throws ArchiveExportException If an error occurred during export
-    * @throws IllegalStateException If invoked before {@link ZipExportHandle#getContent()} has been
-    * fully-read
-    */
-   void checkComplete() throws ArchiveExportException, IllegalStateException;
-}

Copied: shrinkwrap/trunk/api/src/main/java/org/jboss/shrinkwrap/api/exporter/ZipExportTask.java (from rev 3934, shrinkwrap/trunk/api/src/main/java/org/jboss/shrinkwrap/api/exporter/ZipExportHandle.java)
===================================================================
--- shrinkwrap/trunk/api/src/main/java/org/jboss/shrinkwrap/api/exporter/ZipExportTask.java	                        (rev 0)
+++ shrinkwrap/trunk/api/src/main/java/org/jboss/shrinkwrap/api/exporter/ZipExportTask.java	2010-01-21 05:03:50 UTC (rev 3943)
@@ -0,0 +1,56 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+  *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.shrinkwrap.api.exporter;
+
+import java.io.InputStream;
+
+/**
+ * Handle returned to callers from a request to export via
+ * the {@link ZipExporter}.  As the encoding process is an asynchronous
+ * operation, here we provide the user access to read the 
+ * content as well as check for completeness and integrity.
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ */
+public interface ZipExportTask
+{
+   /**
+    * Obtains an {@link InputStream} from which the encoded
+    * content may be read.
+    * 
+    * @return
+    */
+   InputStream getContent();
+
+   /**
+    * Blocking operation which will wait until the encoding process's internal
+    * streams have been closed and verified for integrity.  Do not call this method
+    * until all bytes have been read from {@link ZipExportTask#getContent()}; otherwise 
+    * this may introduce a deadlock.  Any problems with the encoding process will be reported
+    * by throwing {@link ArchiveExportException}.
+    * @return
+    * @throws ArchiveExportException If an error occurred during export
+    * @throws IllegalStateException If invoked before {@link ZipExportTask#getContent()} has been
+    * fully-read
+    */
+   void checkComplete() throws ArchiveExportException, IllegalStateException;
+}

Modified: shrinkwrap/trunk/api/src/main/java/org/jboss/shrinkwrap/api/exporter/ZipExporter.java
===================================================================
--- shrinkwrap/trunk/api/src/main/java/org/jboss/shrinkwrap/api/exporter/ZipExporter.java	2010-01-21 05:00:35 UTC (rev 3942)
+++ shrinkwrap/trunk/api/src/main/java/org/jboss/shrinkwrap/api/exporter/ZipExporter.java	2010-01-21 05:03:50 UTC (rev 3943)
@@ -41,7 +41,7 @@
     * 
     * @return {@link InputStream} for exported Zip
     */
-   ZipExportHandle exportZip();
+   ZipExportTask exportZip();
 
    /**
     * Exports provided archive as a ZIP archive, written to the 

Modified: shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/exporter/JdkZipExporterDelegate.java
===================================================================
--- shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/exporter/JdkZipExporterDelegate.java	2010-01-21 05:00:35 UTC (rev 3942)
+++ shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/exporter/JdkZipExporterDelegate.java	2010-01-21 05:03:50 UTC (rev 3943)
@@ -36,7 +36,7 @@
 import org.jboss.shrinkwrap.api.ArchivePath;
 import org.jboss.shrinkwrap.api.Asset;
 import org.jboss.shrinkwrap.api.exporter.ArchiveExportException;
-import org.jboss.shrinkwrap.api.exporter.ZipExportHandle;
+import org.jboss.shrinkwrap.api.exporter.ZipExportTask;
 import org.jboss.shrinkwrap.impl.base.asset.DirectoryAsset;
 import org.jboss.shrinkwrap.impl.base.io.IOUtil;
 import org.jboss.shrinkwrap.impl.base.io.StreamErrorHandler;
@@ -51,7 +51,7 @@
  * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
  * @version $Revision: $
  */
-public class JdkZipExporterDelegate extends AbstractExporterDelegate<ZipExportHandle>
+public class JdkZipExporterDelegate extends AbstractExporterDelegate<ZipExportTask>
 {
    //-------------------------------------------------------------------------------------||
    // Class Members ----------------------------------------------------------------------||
@@ -83,7 +83,7 @@
    /**
     * Handle to be returned to the caller
     */
-   private ZipExportHandle handle;
+   private ZipExportTask handle;
 
    /**
     * A Set of Paths we've exported so far (so that we don't write
@@ -185,7 +185,7 @@
 
       // Get a handle and return it to the caller
       final Future<Void> job = service.submit(exportTask);
-      final ZipExportHandle handle = new ZipExportHandleImpl(input, job);
+      final ZipExportTask handle = new ZipExportHandleImpl(input, job);
       this.handle = handle;
    }
 
@@ -300,7 +300,7 @@
     * @see org.jboss.shrinkwrap.impl.base.exporter.AbstractExporterDelegate#getResult()
     */
    @Override
-   protected ZipExportHandle getResult()
+   protected ZipExportTask getResult()
    {
       return handle;
    }

Modified: shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/exporter/ZipExportHandleImpl.java
===================================================================
--- shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/exporter/ZipExportHandleImpl.java	2010-01-21 05:00:35 UTC (rev 3942)
+++ shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/exporter/ZipExportHandleImpl.java	2010-01-21 05:03:50 UTC (rev 3943)
@@ -26,14 +26,14 @@
 import java.util.concurrent.Future;
 
 import org.jboss.shrinkwrap.api.exporter.ArchiveExportException;
-import org.jboss.shrinkwrap.api.exporter.ZipExportHandle;
+import org.jboss.shrinkwrap.api.exporter.ZipExportTask;
 
 /**
- * Implementation of a {@link ZipExportHandle}
+ * Implementation of a {@link ZipExportTask}
  *
  * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
  */
-class ZipExportHandleImpl implements ZipExportHandle
+class ZipExportHandleImpl implements ZipExportTask
 {
    //-------------------------------------------------------------------------------------||
    // Instance Members -------------------------------------------------------------------||
@@ -49,7 +49,7 @@
     * this because if the user blocks on {@link Future#get()} than this could
     * deadlock the process (the writer Thread would be waiting for the reader Thread
     * to pull off the buffer).  So just provide a mechanism for the caller to see 
-    * if we're done, and if there was an exception raised via {@link ZipExportHandle#isDone()}
+    * if we're done, and if there was an exception raised via {@link ZipExportTask#isDone()}
     */
    private final Future<Void> job;
 
@@ -77,7 +77,7 @@
    //-------------------------------------------------------------------------------------||
 
    /**
-    * @see org.jboss.shrinkwrap.api.exporter.ZipExportHandle#getContent()
+    * @see org.jboss.shrinkwrap.api.exporter.ZipExportTask#getContent()
     */
    @Override
    public InputStream getContent()
@@ -86,7 +86,7 @@
    }
 
    /**
-    * @see org.jboss.shrinkwrap.api.exporter.ZipExportHandle#checkComplete()
+    * @see org.jboss.shrinkwrap.api.exporter.ZipExportTask#checkComplete()
     */
    @Override
    public void checkComplete() throws ArchiveExportException, IllegalStateException

Modified: shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/exporter/ZipExporterImpl.java
===================================================================
--- shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/exporter/ZipExporterImpl.java	2010-01-21 05:00:35 UTC (rev 3942)
+++ shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/exporter/ZipExporterImpl.java	2010-01-21 05:03:50 UTC (rev 3943)
@@ -27,7 +27,7 @@
 import org.jboss.shrinkwrap.api.Archive;
 import org.jboss.shrinkwrap.api.exporter.ArchiveExportException;
 import org.jboss.shrinkwrap.api.exporter.FileExistsException;
-import org.jboss.shrinkwrap.api.exporter.ZipExportHandle;
+import org.jboss.shrinkwrap.api.exporter.ZipExportTask;
 import org.jboss.shrinkwrap.api.exporter.ZipExporter;
 import org.jboss.shrinkwrap.impl.base.AssignableBase;
 import org.jboss.shrinkwrap.impl.base.Validate;
@@ -90,15 +90,15 @@
     * @see org.jboss.shrinkwrap.api.exporter.ZipExporter#exportZip()
     */
    @Override
-   public ZipExportHandle exportZip()
+   public ZipExportTask exportZip()
    {
       // Create export delegate
-      AbstractExporterDelegate<ZipExportHandle> exportDelegate = new JdkZipExporterDelegate(archive);
+      AbstractExporterDelegate<ZipExportTask> exportDelegate = new JdkZipExporterDelegate(archive);
 
       // Execute export
       exportDelegate.export();
       // Get results
-      ZipExportHandle handle = exportDelegate.getResult();
+      ZipExportTask handle = exportDelegate.getResult();
 
       // Return 
       return handle;
@@ -125,7 +125,7 @@
       }
 
       // Get Streams
-      final ZipExportHandle handle = this.exportZip();
+      final ZipExportTask handle = this.exportZip();
       final InputStream in = handle.getContent();
       final OutputStream out;
       try

Modified: shrinkwrap/trunk/impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/exporter/ZipExporterTestCase.java
===================================================================
--- shrinkwrap/trunk/impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/exporter/ZipExporterTestCase.java	2010-01-21 05:00:35 UTC (rev 3942)
+++ shrinkwrap/trunk/impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/exporter/ZipExporterTestCase.java	2010-01-21 05:03:50 UTC (rev 3943)
@@ -34,7 +34,7 @@
 import org.jboss.shrinkwrap.api.Asset;
 import org.jboss.shrinkwrap.api.exporter.ArchiveExportException;
 import org.jboss.shrinkwrap.api.exporter.FileExistsException;
-import org.jboss.shrinkwrap.api.exporter.ZipExportHandle;
+import org.jboss.shrinkwrap.api.exporter.ZipExportTask;
 import org.jboss.shrinkwrap.api.exporter.ZipExporter;
 import org.jboss.shrinkwrap.api.spec.JavaArchive;
 import org.jboss.shrinkwrap.impl.base.asset.ByteArrayAsset;
@@ -83,14 +83,14 @@
       Archive<?> archive = createArchiveWithAssets();
 
       // Export as Zip InputStream
-      final ZipExportHandle handle = archive.as(ZipExporter.class).exportZip();
-      final InputStream zipStream = handle.getContent();
+      final ZipExportTask task = archive.as(ZipExporter.class).exportZip();
+      final InputStream zipStream = task.getContent();
 
       // Write zip content to temporary file 
       ZipFile expectedZip = getExportedZipFile(NAME_ARCHIVE, zipStream, tempDirectory);
 
       // Ensure all's OK
-      handle.checkComplete();
+      task.checkComplete();
 
       // Validate
       ensureZipFileInExpectedForm(expectedZip);
@@ -124,7 +124,7 @@
       Archive<?> archive = createArchiveWithAssets();
 
       // Export as Zip InputStream
-      final ZipExportHandle handle = archive.as(ZipExporter.class).exportZip();
+      final ZipExportTask handle = archive.as(ZipExporter.class).exportZip();
       // We cannot check complete until we fully read the instream from the handle
       handle.checkComplete();
 
@@ -306,7 +306,7 @@
       }, PATH_ONE);
 
       // Export
-      final ZipExportHandle handle = archive.as(ZipExporter.class).exportZip();
+      final ZipExportTask handle = archive.as(ZipExporter.class).exportZip();
 
       // Read in the full content (to in turn empty the underlying buffer and ensure we complete)
       final InputStream in = handle.getContent();



More information about the jboss-svn-commits mailing list