[jboss-svn-commits] JBoss Common SVN: r3668 - in shrinkwrap/trunk: api/src/main/java/org/jboss/shrinkwrap/api/export and 9 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Wed Nov 11 09:58:49 EST 2009


Author: aslak
Date: 2009-11-11 09:58:48 -0500 (Wed, 11 Nov 2009)
New Revision: 3668

Added:
   shrinkwrap/trunk/api/src/main/java/org/jboss/shrinkwrap/api/exporter/
   shrinkwrap/trunk/api/src/main/java/org/jboss/shrinkwrap/api/exporter/ExplodedExporter.java
   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/
   shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/exporter/ExplodedExporterDelegate.java
   shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/exporter/ExplodedExporterImpl.java
   shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/exporter/ZipArchiveInputStreamFactory.java
   shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/exporter/ZipExporterImpl.java
   shrinkwrap/trunk/impl-base/src/main/resources/META-INF/services/org.jboss.shrinkwrap.api.exporter.ExplodedExporter
   shrinkwrap/trunk/impl-base/src/main/resources/META-INF/services/org.jboss.shrinkwrap.api.exporter.ZipExporter
   shrinkwrap/trunk/impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/exporter/
   shrinkwrap/trunk/impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/exporter/ExplodedExporterTestCase.java
   shrinkwrap/trunk/impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/exporter/ExportTestBase.java
   shrinkwrap/trunk/impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/exporter/ZipExporterTestCase.java
Removed:
   shrinkwrap/trunk/api/src/main/java/org/jboss/shrinkwrap/api/export/ArchiveExportException.java
   shrinkwrap/trunk/api/src/main/java/org/jboss/shrinkwrap/api/export/ExplodedExporter.java
   shrinkwrap/trunk/api/src/main/java/org/jboss/shrinkwrap/api/export/ZipExporter.java
   shrinkwrap/trunk/api/src/main/java/org/jboss/shrinkwrap/api/exporter/ExplodedExporter.java
   shrinkwrap/trunk/api/src/main/java/org/jboss/shrinkwrap/api/exporter/FactoryUtil.java
   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/export/AbstractExporterDelegate.java
   shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/export/ExplodedExporterDelegate.java
   shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/export/ExplodedExporterImpl.java
   shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/export/ZipArchiveInputStreamFactory.java
   shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/export/ZipExportDelegate.java
   shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/export/ZipExporterImpl.java
   shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/export/ZipExporterUtil.java
   shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/exporter/ExplodedExporterDelegate.java
   shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/exporter/ExplodedExporterImpl.java
   shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/exporter/ZipArchiveInputStreamFactory.java
   shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/exporter/ZipExporterImpl.java
   shrinkwrap/trunk/impl-base/src/main/resources/META-INF/services/org.jboss.shrinkwrap.api.export.ExplodedExporter
   shrinkwrap/trunk/impl-base/src/main/resources/META-INF/services/org.jboss.shrinkwrap.api.export.ZipExporter
   shrinkwrap/trunk/impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/export/ExplodedExporterTestCase.java
   shrinkwrap/trunk/impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/export/ExportTestBase.java
   shrinkwrap/trunk/impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/export/ZipExporterTestCase.java
   shrinkwrap/trunk/impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/exporter/ExplodedExporterTestCase.java
   shrinkwrap/trunk/impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/exporter/ExportTestBase.java
   shrinkwrap/trunk/impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/exporter/ZipExporterTestCase.java
Modified:
   shrinkwrap/trunk/api/src/main/java/org/jboss/shrinkwrap/api/exporter/ArchiveExportException.java
   shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/ArchiveInputStreamFactory.java
   shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/exporter/AbstractExporterDelegate.java
   shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/exporter/ZipExportDelegate.java
   shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/exporter/ZipExporterUtil.java
   shrinkwrap/trunk/impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/importer/ZipImporterImplTestCase.java
Log:
SHRINKWRAP-72 Moved to exporter package to align with importer

Deleted: shrinkwrap/trunk/api/src/main/java/org/jboss/shrinkwrap/api/export/ArchiveExportException.java
===================================================================
--- shrinkwrap/trunk/api/src/main/java/org/jboss/shrinkwrap/api/export/ArchiveExportException.java	2009-11-11 14:47:18 UTC (rev 3667)
+++ shrinkwrap/trunk/api/src/main/java/org/jboss/shrinkwrap/api/export/ArchiveExportException.java	2009-11-11 14:58:48 UTC (rev 3668)
@@ -1,52 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.shrinkwrap.api.export;
-
-/**
- * ArchiveExportException
- * 
- * Exception thrown when an error occurs exporting an Archive.
- * 
- * @author <a href="mailto:baileyje at gmail.com">John Bailey</a>
- * @version $Revision: $
- */
-public class ArchiveExportException extends RuntimeException
-{
-
-   private static final long serialVersionUID = 1L;
-
-   public ArchiveExportException()
-   {
-      super();
-   }
-
-   public ArchiveExportException(String message, Throwable cause)
-   {
-      super(message, cause);
-   }
-
-   public ArchiveExportException(String message)
-   {
-      super(message);
-   }
-
-   public ArchiveExportException(Throwable cause)
-   {
-      super(cause);
-   }
-
-}

Deleted: shrinkwrap/trunk/api/src/main/java/org/jboss/shrinkwrap/api/export/ExplodedExporter.java
===================================================================
--- shrinkwrap/trunk/api/src/main/java/org/jboss/shrinkwrap/api/export/ExplodedExporter.java	2009-11-11 14:47:18 UTC (rev 3667)
+++ shrinkwrap/trunk/api/src/main/java/org/jboss/shrinkwrap/api/export/ExplodedExporter.java	2009-11-11 14:58:48 UTC (rev 3668)
@@ -1,49 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.shrinkwrap.api.export;
-
-import java.io.File;
-
-import org.jboss.shrinkwrap.api.Specializer;
-
-/**
- * ExplodedExporter
- * 
- * Exporter used to export an Archive as an exploded directory structure. 
- * 
- * @author <a href="mailto:baileyje at gmail.com">John Bailey</a>
- * @author <a href="mailto:aslak at conduct.no">Aslak Knutsen</a>
- * @version $Revision: $
- */
-public interface ExplodedExporter extends Specializer
-{
-
-   //-------------------------------------------------------------------------------------||
-   // Contracts --------------------------------------------------------------------------||
-   //-------------------------------------------------------------------------------------||
-
-   /**
-    * Exports provided archive as an exploded directory structure.
-    * 
-    * @param archive
-    * @param parentDirectory
-    * @return File for exploded archive contents
-    * @throws IllegalArgumentException if the archive or parent directory not valid
-    * @throws ArchiveExportException if the export process fails
-    */
-   File exportExploded(File parentDirectory);
-}

Deleted: shrinkwrap/trunk/api/src/main/java/org/jboss/shrinkwrap/api/export/ZipExporter.java
===================================================================
--- shrinkwrap/trunk/api/src/main/java/org/jboss/shrinkwrap/api/export/ZipExporter.java	2009-11-11 14:47:18 UTC (rev 3667)
+++ shrinkwrap/trunk/api/src/main/java/org/jboss/shrinkwrap/api/export/ZipExporter.java	2009-11-11 14:58:48 UTC (rev 3668)
@@ -1,47 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.shrinkwrap.api.export;
-
-import java.io.InputStream;
-
-import org.jboss.shrinkwrap.api.Specializer;
-
-/**
- * ZipExporter
- * 
- * Exporter used to export an Archive as a Zip format. 
- * 
- * @author <a href="mailto:baileyje at gmail.com">John Bailey</a>
- * @author <a href="mailto:aslak at conduct.no">Aslak Knutsen</a>
- * @version $Revision: $
- */
-public interface ZipExporter extends Specializer
-{
-   //-------------------------------------------------------------------------------------||
-   // Contracts --------------------------------------------------------------------------||
-   //-------------------------------------------------------------------------------------||
-
-   /**
-    * Exports provided archive as a Zip archive.
-    * 
-    * @param archive
-    * @return InputStram for exported Zip
-    * @throws IllegalArgumentException if the archive is not valid
-    * @throws ArchiveExportException if the export process fails
-    */
-   InputStream exportZip();
-}

Copied: shrinkwrap/trunk/api/src/main/java/org/jboss/shrinkwrap/api/exporter (from rev 3600, shrinkwrap/trunk/api/src/main/java/org/jboss/shrinkwrap/api/export)

Modified: shrinkwrap/trunk/api/src/main/java/org/jboss/shrinkwrap/api/exporter/ArchiveExportException.java
===================================================================
--- shrinkwrap/trunk/api/src/main/java/org/jboss/shrinkwrap/api/export/ArchiveExportException.java	2009-10-14 15:22:40 UTC (rev 3600)
+++ shrinkwrap/trunk/api/src/main/java/org/jboss/shrinkwrap/api/exporter/ArchiveExportException.java	2009-11-11 14:58:48 UTC (rev 3668)
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.jboss.shrinkwrap.api.export;
+package org.jboss.shrinkwrap.api.exporter;
 
 /**
  * ArchiveExportException

Deleted: shrinkwrap/trunk/api/src/main/java/org/jboss/shrinkwrap/api/exporter/ExplodedExporter.java
===================================================================
--- shrinkwrap/trunk/api/src/main/java/org/jboss/shrinkwrap/api/export/ExplodedExporter.java	2009-10-14 15:22:40 UTC (rev 3600)
+++ shrinkwrap/trunk/api/src/main/java/org/jboss/shrinkwrap/api/exporter/ExplodedExporter.java	2009-11-11 14:58:48 UTC (rev 3668)
@@ -1,103 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.shrinkwrap.api.export;
-
-import java.io.File;
-
-import org.jboss.shrinkwrap.api.Archive;
-
-/**
- * ExplodedExporter
- * 
- * Exporter used to export an Archive as an exploded directory structure. 
- * 
- * @author <a href="mailto:baileyje at gmail.com">John Bailey</a>
- * @version $Revision: $
- */
-public abstract class ExplodedExporter
-{
-
-   //-------------------------------------------------------------------------------------||
-   // Class Members ----------------------------------------------------------------------||
-   //-------------------------------------------------------------------------------------||
-
-   /**
-    * Implementation type as a FQN to avoid direct compile-time dependency
-    */
-   private static final String IMPL_TYPE = "org.jboss.shrinkwrap.impl.base.export.ExplodedExporterImpl";
-
-   /**
-    * Instance of ExplodedExporter implementation
-    */
-   private static ExplodedExporter instance;
-
-   //-------------------------------------------------------------------------------------||
-   // Class Methods ----------------------------------------------------------------------||
-   //-------------------------------------------------------------------------------------||
-
-   /**
-    * Exports provided archive as an exploded directory structure.
-    * 
-    * @param archive
-    * @param parentDirectory
-    * @return File for exploded archive contents
-    * @throws IllegalArgumentException if the archive or parent directory not valid
-    * @throws ArchiveExportException if the export process fails
-    */
-   public static File exportExploded(Archive<?> archive, File parentDirectory)
-   {
-      return getInstance().doExportExploded(archive, parentDirectory);
-   }
-
-   /**
-    * Get an instance of the ExplodedExporter implementation
-    *  
-    * @return
-    */
-   private synchronized static ExplodedExporter getInstance()
-   {
-      if (instance == null)
-      {
-         instance = createInstance();
-      }
-      return instance;
-   }
-
-   /** 
-    * Create an instance of the ExplodedEporter implementation 
-    * 
-    * @return
-    */
-   private static ExplodedExporter createInstance()
-   {
-      return FactoryUtil.createInstance(IMPL_TYPE, ExplodedExporter.class);
-   }
-
-   //-------------------------------------------------------------------------------------||
-   // Contracts --------------------------------------------------------------------------||
-   //-------------------------------------------------------------------------------------||
-
-   /**
-    * Template export method for concrete implementations  
-    * 
-    * @param archive
-    * @param parentDirectory
-    * @return File for exploded archive contents
-    */
-   protected abstract File doExportExploded(Archive<?> archive, File parentDirectory);
-
-}

Copied: shrinkwrap/trunk/api/src/main/java/org/jboss/shrinkwrap/api/exporter/ExplodedExporter.java (from rev 3667, shrinkwrap/trunk/api/src/main/java/org/jboss/shrinkwrap/api/export/ExplodedExporter.java)
===================================================================
--- shrinkwrap/trunk/api/src/main/java/org/jboss/shrinkwrap/api/exporter/ExplodedExporter.java	                        (rev 0)
+++ shrinkwrap/trunk/api/src/main/java/org/jboss/shrinkwrap/api/exporter/ExplodedExporter.java	2009-11-11 14:58:48 UTC (rev 3668)
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.shrinkwrap.api.exporter;
+
+import java.io.File;
+
+import org.jboss.shrinkwrap.api.Specializer;
+
+/**
+ * ExplodedExporter
+ * 
+ * Exporter used to export an Archive as an exploded directory structure. 
+ * 
+ * @author <a href="mailto:baileyje at gmail.com">John Bailey</a>
+ * @author <a href="mailto:aslak at conduct.no">Aslak Knutsen</a>
+ * @version $Revision: $
+ */
+public interface ExplodedExporter extends Specializer
+{
+
+   //-------------------------------------------------------------------------------------||
+   // Contracts --------------------------------------------------------------------------||
+   //-------------------------------------------------------------------------------------||
+
+   /**
+    * Exports provided archive as an exploded directory structure.
+    * 
+    * @param archive
+    * @param parentDirectory
+    * @return File for exploded archive contents
+    * @throws IllegalArgumentException if the archive or parent directory not valid
+    * @throws ArchiveExportException if the export process fails
+    */
+   File exportExploded(File parentDirectory);
+}

Deleted: shrinkwrap/trunk/api/src/main/java/org/jboss/shrinkwrap/api/exporter/FactoryUtil.java
===================================================================
--- shrinkwrap/trunk/api/src/main/java/org/jboss/shrinkwrap/api/export/FactoryUtil.java	2009-10-14 15:22:40 UTC (rev 3600)
+++ shrinkwrap/trunk/api/src/main/java/org/jboss/shrinkwrap/api/exporter/FactoryUtil.java	2009-11-11 14:58:48 UTC (rev 3668)
@@ -1,106 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.shrinkwrap.api.export;
-
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.util.logging.Logger;
-
-/**
- * FactoryUtil
- * 
- * Package-private factory utilities 
- *
- * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
- * @version $Revision: $
- */
-class FactoryUtil
-{
-
-   //-------------------------------------------------------------------------------------||
-   // Class Members ----------------------------------------------------------------------||
-   //-------------------------------------------------------------------------------------||
-
-   /**
-    * Logger
-    */
-   private static final Logger log = Logger.getLogger(FactoryUtil.class.getName());
-
-   //-------------------------------------------------------------------------------------||
-   // Constructor ------------------------------------------------------------------------||
-   //-------------------------------------------------------------------------------------||
-
-   /**
-    * Prohibit instantiation
-    */
-   private FactoryUtil()
-   {
-      throw new UnsupportedOperationException("No instances should be created; stateless utility class");
-   }
-
-   //-------------------------------------------------------------------------------------||
-   // Functional Methods -----------------------------------------------------------------||
-   //-------------------------------------------------------------------------------------||
-
-   /**
-    * Create an instance of the Class with the specified FQN, of the expected
-    * type
-    * 
-    * @throws IllegalArgumentException If the specified type is not assignable to the instance
-    *       of the class created from the specified class name, or if either argument is not
-    *       supplied
-    */
-   static <T> T createInstance(final String className, final Class<T> type) throws IllegalArgumentException
-   {
-      // Precondition checks
-      if (className == null || className.length() == 0)
-      {
-         throw new IllegalArgumentException("className must be specified");
-      }
-      if (type == null)
-      {
-         throw new IllegalArgumentException("type must be specified");
-      }
-
-      return AccessController.doPrivileged(new PrivilegedAction<T>()
-      {
-         public T run()
-         {
-            try
-            {
-               final ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
-               final Class<?> clazz = Class.forName(className, false, classLoader);
-               final Object obj = clazz.newInstance();
-               try
-               {
-                  return type.cast(obj);
-               }
-               catch (final ClassCastException cee)
-               {
-                  throw new IllegalArgumentException("Specified type " + type.getName() + " is not assignable to "
-                        + obj);
-               }
-            }
-            catch (Exception e)
-            {
-               throw new IllegalArgumentException("Unable to create implemenation: " + className, e);
-            }
-         }
-      });
-   }
-
-}

Deleted: shrinkwrap/trunk/api/src/main/java/org/jboss/shrinkwrap/api/exporter/ZipExporter.java
===================================================================
--- shrinkwrap/trunk/api/src/main/java/org/jboss/shrinkwrap/api/export/ZipExporter.java	2009-10-14 15:22:40 UTC (rev 3600)
+++ shrinkwrap/trunk/api/src/main/java/org/jboss/shrinkwrap/api/exporter/ZipExporter.java	2009-11-11 14:58:48 UTC (rev 3668)
@@ -1,100 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.shrinkwrap.api.export;
-
-import java.io.InputStream;
-
-import org.jboss.shrinkwrap.api.Archive;
-
-/**
- * ZipExporter
- * 
- * Exporter used to export an Archive as a Zip format. 
- * 
- * @author <a href="mailto:baileyje at gmail.com">John Bailey</a>
- * @version $Revision: $
- */
-public abstract class ZipExporter
-{
-
-   //-------------------------------------------------------------------------------------||
-   // Class Members ----------------------------------------------------------------------||
-   //-------------------------------------------------------------------------------------||
-
-   /**
-    * Implementation type as a FQN to avoid direct compile-time dependency
-    */
-   private static final String IMPL_TYPE = "org.jboss.shrinkwrap.impl.base.export.ZipExporterImpl";
-
-   /**
-    * Instance of ZipExporter implementation
-    */
-   private static ZipExporter instance;
-
-   //-------------------------------------------------------------------------------------||
-   // Class Methods ----------------------------------------------------------------------||
-   //-------------------------------------------------------------------------------------||
-
-   /**
-    * Exports provided archive as a Zip archive.
-    * 
-    * @param archive
-    * @return InputStram for exported Zip
-    * @throws IllegalArgumentException if the archive is not valid
-    * @throws ArchiveExportException if the export process fails
-    */
-   public static InputStream exportZip(Archive<?> archive)
-   {
-      return getInstance().doExportZip(archive);
-   }
-
-   /**
-    * Get an instance of the ZipExporter implementation 
-    * @return
-    */
-   private synchronized static ZipExporter getInstance()
-   {
-      if (instance == null)
-      {
-         instance = createInstance();
-      }
-      return instance;
-   }
-
-   /**
-    * Create an instance of the ZipExporter implementation
-    * 
-    * @return
-    */
-   private static ZipExporter createInstance()
-   {
-      return FactoryUtil.createInstance(IMPL_TYPE, ZipExporter.class);
-   }
-
-   //-------------------------------------------------------------------------------------||
-   // Contracts --------------------------------------------------------------------------||
-   //-------------------------------------------------------------------------------------||
-
-   /**
-    * Template export method for concrete implementations  
-    * 
-    * @param archive
-    * @return InputStream for exported Zip
-    */
-   protected abstract InputStream doExportZip(Archive<?> archive);
-
-}

Copied: shrinkwrap/trunk/api/src/main/java/org/jboss/shrinkwrap/api/exporter/ZipExporter.java (from rev 3667, shrinkwrap/trunk/api/src/main/java/org/jboss/shrinkwrap/api/export/ZipExporter.java)
===================================================================
--- shrinkwrap/trunk/api/src/main/java/org/jboss/shrinkwrap/api/exporter/ZipExporter.java	                        (rev 0)
+++ shrinkwrap/trunk/api/src/main/java/org/jboss/shrinkwrap/api/exporter/ZipExporter.java	2009-11-11 14:58:48 UTC (rev 3668)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.shrinkwrap.api.exporter;
+
+import java.io.InputStream;
+
+import org.jboss.shrinkwrap.api.Specializer;
+
+/**
+ * ZipExporter
+ * 
+ * Exporter used to export an Archive as a Zip format. 
+ * 
+ * @author <a href="mailto:baileyje at gmail.com">John Bailey</a>
+ * @author <a href="mailto:aslak at conduct.no">Aslak Knutsen</a>
+ * @version $Revision: $
+ */
+public interface ZipExporter extends Specializer
+{
+   //-------------------------------------------------------------------------------------||
+   // Contracts --------------------------------------------------------------------------||
+   //-------------------------------------------------------------------------------------||
+
+   /**
+    * Exports provided archive as a Zip archive.
+    * 
+    * @param archive
+    * @return InputStram for exported Zip
+    * @throws IllegalArgumentException if the archive is not valid
+    * @throws ArchiveExportException if the export process fails
+    */
+   InputStream exportZip();
+}

Modified: shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/ArchiveInputStreamFactory.java
===================================================================
--- shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/ArchiveInputStreamFactory.java	2009-11-11 14:47:18 UTC (rev 3667)
+++ shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/ArchiveInputStreamFactory.java	2009-11-11 14:58:48 UTC (rev 3668)
@@ -19,7 +19,7 @@
 import java.io.InputStream;
 
 import org.jboss.shrinkwrap.api.Archive;
-import org.jboss.shrinkwrap.impl.base.export.ZipArchiveInputStreamFactory;
+import org.jboss.shrinkwrap.impl.base.exporter.ZipArchiveInputStreamFactory;
 
 /**
  * ArchiveInputStreamFactory

Deleted: shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/export/AbstractExporterDelegate.java
===================================================================
--- shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/export/AbstractExporterDelegate.java	2009-11-11 14:47:18 UTC (rev 3667)
+++ shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/export/AbstractExporterDelegate.java	2009-11-11 14:58:48 UTC (rev 3668)
@@ -1,130 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.shrinkwrap.impl.base.export;
-
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import org.jboss.shrinkwrap.api.Archive;
-import org.jboss.shrinkwrap.api.Asset;
-import org.jboss.shrinkwrap.api.Path;
-
-/**
- * AbstractExporterDelegate
- * 
- * Abstract delegate used for archive export. 
- * Provides a template for exporters for handling archive contents. 
- * 
- * @author <a href="mailto:baileyje at gmail.com">John Bailey</a>
- * @version $Revision: $
- */
-public abstract class AbstractExporterDelegate<T>
-{
-   //-------------------------------------------------------------------------------------||
-   // Class Members ----------------------------------------------------------------------||
-   //-------------------------------------------------------------------------------------||
-
-   /**
-    * Logger
-    */
-   private static final Logger log = Logger.getLogger(AbstractExporterDelegate.class.getName());
-
-   //-------------------------------------------------------------------------------------||
-   // Instance Members -------------------------------------------------------------------||
-   //-------------------------------------------------------------------------------------||
-
-   /** 
-    * The archive being exported
-    */
-   private final Archive<?> archive;
-
-   //-------------------------------------------------------------------------------------||
-   // Constructor ------------------------------------------------------------------------||
-   //-------------------------------------------------------------------------------------||
-
-   /**
-    * Creates a new abstract exporter delegate for the provided {@link Archive} 
-    */
-   protected AbstractExporterDelegate(Archive<?> archive)
-   {
-      super();
-      this.archive = archive;
-   }
-
-   /**
-    * Primary method providing a template for exporting the contents of an archive
-    */
-   protected void export()
-   {
-      // Get archive
-      Archive<?> archive = getArchive();
-      if (log.isLoggable(Level.FINE))
-      {
-         log.fine("Exporting archive - " + archive.getName());
-      }
-
-      // Obtain all contents
-      final Map<Path, Asset> content = archive.getContent();
-
-      // For every Path in the Archive
-      for (final Entry<Path, Asset> contentEntry : content.entrySet())
-      {
-         // Get Asset information
-         final Path path = contentEntry.getKey();
-         final Asset asset = contentEntry.getValue();
-
-         // Process the asset 
-         processAsset(path, asset);
-      }
-   }
-
-   //-------------------------------------------------------------------------------------||
-   // Contracts --------------------------------------------------------------------------||
-   //-------------------------------------------------------------------------------------||
-
-   /**
-    * Template method for processing a single asset.
-    * 
-    * @param path
-    * @param asset
-    */
-   protected abstract void processAsset(Path path, Asset asset);
-
-   /**
-    * Return the results of the export.  Should process any tasks required to finalize the export.  
-    * 
-    * @return
-    */
-   protected abstract T getResult();
-
-   //-------------------------------------------------------------------------------------||
-   // Internal Helper Methods ------------------------------------------------------------||
-   //-------------------------------------------------------------------------------------||
-
-   /**
-    * Return the archive being exported
-    * 
-    * @return
-    */
-   protected Archive<?> getArchive()
-   {
-      return archive;
-   }
-
-}

Deleted: shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/export/ExplodedExporterDelegate.java
===================================================================
--- shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/export/ExplodedExporterDelegate.java	2009-11-11 14:47:18 UTC (rev 3667)
+++ shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/export/ExplodedExporterDelegate.java	2009-11-11 14:58:48 UTC (rev 3668)
@@ -1,176 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.shrinkwrap.impl.base.export;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.InputStream;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import org.jboss.shrinkwrap.api.Archive;
-import org.jboss.shrinkwrap.api.Asset;
-import org.jboss.shrinkwrap.api.Path;
-import org.jboss.shrinkwrap.api.export.ArchiveExportException;
-import org.jboss.shrinkwrap.api.export.ExplodedExporter;
-import org.jboss.shrinkwrap.impl.base.asset.ArchiveAsset;
-import org.jboss.shrinkwrap.impl.base.io.IOUtil;
-
-/**
- * ExplodedExporterDelegate
- * 
- * Delegate used to export an archive into an exploded directory structure.   
- * 
- * @author <a href="mailto:baileyje at gmail.com">John Bailey</a>
- * @author <a href="mailto:aslak at conduct.no">Aslak Knutsen</a>
- * @version $Revision: $
- */
-public class ExplodedExporterDelegate extends AbstractExporterDelegate<File>
-{
-   //-------------------------------------------------------------------------------------||
-   // Class Members ----------------------------------------------------------------------||
-   //-------------------------------------------------------------------------------------||
-
-   /**
-    * Logger
-    */
-   private static final Logger log = Logger.getLogger(ExplodedExporterDelegate.class.getName());
-
-   //-------------------------------------------------------------------------------------||
-   // Instance Members -------------------------------------------------------------------||
-   //-------------------------------------------------------------------------------------||
-
-   /**
-    * Output directory to write the exploded content to.
-    */
-   private final File outputDirectory;
-
-   //-------------------------------------------------------------------------------------||
-   // Constructor ------------------------------------------------------------------------||
-   //-------------------------------------------------------------------------------------||
-
-   /**
-    * Creates a new exploded exporter delegate for the provided {@link Archive} 
-    */
-   public ExplodedExporterDelegate(Archive<?> archive, File baseDirectory)
-   {
-      super(archive);
-      this.outputDirectory = initializeOutputDirectory(baseDirectory);
-   }
-
-   //-------------------------------------------------------------------------------------||
-   // Required Implementations -----------------------------------------------------------||
-   //-------------------------------------------------------------------------------------||
-
-   /**
-    * {@inheritDoc}
-    * @see org.jboss.shrinkwrap.impl.base.export.AbstractExporterDelegate#processAsset(Path, Asset)
-    */
-   @Override
-   protected void processAsset(Path path, Asset asset)
-   {
-      // Get path to file
-      final String assetFilePath = path.get();
-
-      // Create a file for the asset
-      final File assetFile = new File(outputDirectory, assetFilePath);
-
-      // Get the assets parent parent directory and make sure it exists
-      final File assetParent = assetFile.getParentFile();
-      if (!assetParent.exists())
-      {
-         if (!assetParent.mkdirs())
-         {
-            throw new ArchiveExportException("Failed to write asset.  Unable to create parent directory.");
-         }
-      }
-
-      // Handle Archive assets separately 
-      if (asset instanceof ArchiveAsset)
-      {
-         ArchiveAsset nesteArchiveAsset = ArchiveAsset.class.cast(asset);
-         processArchiveAsset(assetParent, nesteArchiveAsset);
-         return;
-      }
-
-      try
-      {
-         if (log.isLoggable(Level.FINE))
-         {
-            log.fine("Writing asset " + path.get() + " to " + assetFile.getAbsolutePath());
-         }
-         // Get the asset streams
-         final InputStream assetInputStream = asset.openStream();
-         final FileOutputStream assetFileOutputStream = new FileOutputStream(assetFile);
-
-         // Write contents
-         IOUtil.copyWithClose(assetInputStream, assetFileOutputStream);
-      }
-      catch (Throwable t)
-      {
-         throw new ArchiveExportException("Failed to write asset " + path + " to " + assetFile);
-      }
-   }
-
-   /**
-    * {@inheritDoc}
-    * @see org.jboss.shrinkwrap.impl.base.export.AbstractExporterDelegate#getResult()
-    */
-   @Override
-   protected File getResult()
-   {
-      return outputDirectory;
-   }
-
-   //-------------------------------------------------------------------------------------||
-   // Internal Helper Methods ------------------------------------------------------------||
-   //-------------------------------------------------------------------------------------||
-
-   /**
-    * Processes a nested archive by delegating to the ExplodedArchiveExporter
-    * @param parentDirectory
-    * @param nestedArchiveAsset
-    */
-   private void processArchiveAsset(File parentDirectory, ArchiveAsset nestedArchiveAsset)
-   {
-      // Get the nested archive
-      Archive<?> nestedArchive = nestedArchiveAsset.getArchive();
-      nestedArchive.as(ExplodedExporter.class).exportExploded(parentDirectory);
-   }
-
-   /**
-    * Initializes the output directory
-    * 
-    * @param baseDirectory
-    * @return
-    */
-   private File initializeOutputDirectory(File baseDirectory)
-   {
-      // Get archive
-      Archive<?> archive = getArchive();
-
-      // Create output directory
-      final File outputDirectory = new File(baseDirectory, archive.getName());
-      if (!outputDirectory.mkdir())
-      {
-         throw new ArchiveExportException("Unable to create archive output directory - " + outputDirectory);
-      }
-
-      return outputDirectory;
-   }
-
-}

Deleted: shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/export/ExplodedExporterImpl.java
===================================================================
--- shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/export/ExplodedExporterImpl.java	2009-11-11 14:47:18 UTC (rev 3667)
+++ shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/export/ExplodedExporterImpl.java	2009-11-11 14:58:48 UTC (rev 3668)
@@ -1,118 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.shrinkwrap.impl.base.export;
-
-import java.io.File;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import org.jboss.shrinkwrap.api.Archive;
-import org.jboss.shrinkwrap.api.export.ExplodedExporter;
-import org.jboss.shrinkwrap.impl.base.SpecializedBase;
-import org.jboss.shrinkwrap.impl.base.Validate;
-
-/**
- * ExplodedExporterImpl
- * 
- * Implementation of ExplodedExporter used to export an Archive as an exploded directory structure. 
- * 
- * @author <a href="mailto:baileyje at gmail.com">John Bailey</a>
- * @author <a href="mailto:aslak at conduct.no">Aslak Knutsen</a>
- * @version $Revision: $
- */
-public class ExplodedExporterImpl extends SpecializedBase implements ExplodedExporter
-{
-
-   //-------------------------------------------------------------------------------------||
-   // Class Members ----------------------------------------------------------------------||
-   //-------------------------------------------------------------------------------------||
-
-   /**
-    * Logger
-    */
-   private static final Logger log = Logger.getLogger(ExplodedExporterImpl.class.getName());
-
-   /**
-    * Archive to import into. 
-    */
-   private Archive<?> archive; 
-   
-   //-------------------------------------------------------------------------------------||
-   // Constructor ------------------------------------------------------------------------||
-   //-------------------------------------------------------------------------------------||
-
-   public ExplodedExporterImpl(Archive<?> archive) 
-   {
-      Validate.notNull(archive, "Archive must be specified");
-      this.archive = archive;
-   }
-
-   //-------------------------------------------------------------------------------------||
-   // Required Implementations -----------------------------------------------------------||
-   //-------------------------------------------------------------------------------------||
-
-   /* (non-Javadoc)
-    * @see org.jboss.shrinkwrap.impl.base.SpecializedBase#getArchive()
-    */
-   @Override
-   protected Archive<?> getArchive()
-   {
-      return archive;
-   }
-   
-   //-------------------------------------------------------------------------------------||
-   // Required Implementations - ExplodedExporter ----------------------------------------||
-   //-------------------------------------------------------------------------------------||
-
-   /* (non-Javadoc)
-    * @see org.jboss.shrinkwrap.api.export.ExplodedExporter#exportExploded(java.io.File)
-    */
-   @Override
-   public File exportExploded(File baseDirectory)
-   {
-      Validate.notNull(archive, "No archive provided");
-      Validate.notNull(baseDirectory, "No baseDirectory provided");
-
-      // Directory must exist
-      if (!baseDirectory.exists())
-      {
-         throw new IllegalArgumentException("Parent directory does not exist");
-      }
-      // Must be a directory
-      if (!baseDirectory.isDirectory())
-      {
-         throw new IllegalArgumentException("Provided parent directory is not a valid directory");
-      }
-
-      // Get the export delegate
-      ExplodedExporterDelegate exporterDelegate = new ExplodedExporterDelegate(archive, baseDirectory);
-
-      // Run the export
-      exporterDelegate.export();
-      
-      // Get Result
-      File explodedDirectory = exporterDelegate.getResult();
-
-      if (log.isLoggable(Level.FINE))
-      {
-         log.fine("Created Exploded Archive: " + explodedDirectory.getAbsolutePath());
-      }
-      // Return the exploded dir
-      return explodedDirectory;
-   }
-
-}

Deleted: shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/export/ZipArchiveInputStreamFactory.java
===================================================================
--- shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/export/ZipArchiveInputStreamFactory.java	2009-11-11 14:47:18 UTC (rev 3667)
+++ shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/export/ZipArchiveInputStreamFactory.java	2009-11-11 14:58:48 UTC (rev 3668)
@@ -1,53 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.shrinkwrap.impl.base.export;
-
-import java.io.InputStream;
-
-import org.jboss.shrinkwrap.api.Archive;
-import org.jboss.shrinkwrap.api.export.ZipExporter;
-import org.jboss.shrinkwrap.impl.base.ArchiveInputStreamFactory;
-
-/**
- * ZipArchiveInputStreamFactory
- * 
- * Factory used create an InputStream from an Archive by exporting the archive as a  Zip.
- *
- * @author <a href="mailto:baileyje at gmail.com">John Bailey</a>
- * @author <a href="mailto:aslak at conduct.no">Aslak Knutsen</a>
- * @version $Revision: $
- */
-public class ZipArchiveInputStreamFactory extends ArchiveInputStreamFactory
-{
-   //-------------------------------------------------------------------------------------||
-   // Required Implementations - ArchiveInputStreamFactory  ------------------------------||
-   //-------------------------------------------------------------------------------------||
-   
-   /**
-    * {@inheritDoc}
-    * @see org.jboss.shrinkwrap.impl.base.ArchiveInputStreamFactory#doGetInputStream(Archive)
-    */
-   @Override
-   protected InputStream doGetInputStream(Archive<?> archive)
-   {
-      // Get InputStream from the ZipExporter
-      final InputStream inputStream = archive.as(ZipExporter.class).exportZip();
-      // Return input stream
-      return inputStream;
-   }
-
-}

Deleted: shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/export/ZipExportDelegate.java
===================================================================
--- shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/export/ZipExportDelegate.java	2009-11-11 14:47:18 UTC (rev 3667)
+++ shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/export/ZipExportDelegate.java	2009-11-11 14:58:48 UTC (rev 3668)
@@ -1,171 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.shrinkwrap.impl.base.export;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.InputStream;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipOutputStream;
-
-import org.jboss.shrinkwrap.api.Archive;
-import org.jboss.shrinkwrap.api.Asset;
-import org.jboss.shrinkwrap.api.Path;
-import org.jboss.shrinkwrap.api.export.ArchiveExportException;
-import org.jboss.shrinkwrap.impl.base.io.IOUtil;
-import org.jboss.shrinkwrap.impl.base.io.StreamErrorHandler;
-import org.jboss.shrinkwrap.impl.base.io.StreamTask;
-
-public class ZipExportDelegate extends AbstractExporterDelegate<InputStream>
-{
-   //-------------------------------------------------------------------------------------||
-   // Class Members ----------------------------------------------------------------------||
-   //-------------------------------------------------------------------------------------||
-
-   /**
-    * Logger
-    */
-   private static final Logger log = Logger.getLogger(ZipExportDelegate.class.getName());
-
-   //-------------------------------------------------------------------------------------||
-   // Instance Members -------------------------------------------------------------------||
-   //-------------------------------------------------------------------------------------||
-
-   /**
-    * OutputStream to hold the output contents
-    */
-   private final ByteArrayOutputStream output = new ByteArrayOutputStream();
-
-   /**
-    * ZipOutputStream used to write the zip entries
-    */
-   private ZipOutputStream zipOutputStream;
-
-   //-------------------------------------------------------------------------------------||
-   // Constructor ------------------------------------------------------------------------||
-   //-------------------------------------------------------------------------------------||
-
-   /**
-    * Creates a new exporter delegate for exporting archives as Zip
-    */
-   public ZipExportDelegate(Archive<?> archive)
-   {
-      super(archive);
-   }
-
-   //-------------------------------------------------------------------------------------||
-   // Required Implementations -----------------------------------------------------------||
-   //-------------------------------------------------------------------------------------||
-
-   /**
-    * {@inheritDoc}
-    * @see org.jboss.shrinkwrap.impl.base.export.AbstractExporterDelegate#export()
-    */
-   @Override
-   protected void export()
-   {
-      zipOutputStream = new ZipOutputStream(output);
-
-      // Enclose every IO Operation so we can close up cleanly
-      IOUtil.closeOnComplete(zipOutputStream, new StreamTask<ZipOutputStream>()
-      {
-
-         @Override
-         public void execute(ZipOutputStream stream) throws Exception
-         {
-            ZipExportDelegate.super.export();
-         }
-
-      }, new StreamErrorHandler()
-      {
-
-         @Override
-         public void handle(Throwable t)
-         {
-            throw new ArchiveExportException("Failed to export Zip: " + getArchive().getName(), t);
-         }
-
-      });
-   }
-
-   /**
-    * {@inheritDoc}
-    * @see org.jboss.shrinkwrap.impl.base.export.AbstractExporterDelegate#processAsset(Path, Asset)
-    */
-   @Override
-   protected void processAsset(final Path path, final Asset asset)
-   {
-      final String pathName = ZipExporterUtil.toZipEntryPath(path);
-
-      final ZipEntry entry = new ZipEntry(pathName);
-
-      // Get Asset InputStream
-      final InputStream assetStream = asset.openStream();
-
-      IOUtil.closeOnComplete(assetStream, new StreamTask<InputStream>()
-      {
-
-         @Override
-         public void execute(InputStream stream) throws Exception
-         {
-            // Write the Asset under the same Path name in the Zip
-            // Make a Zip Entry
-            zipOutputStream.putNextEntry(entry);
-
-            // Read the contents of the asset and write to the JAR
-            IOUtil.copy(stream, zipOutputStream);
-
-            // Close up the instream and the entry
-            zipOutputStream.closeEntry();
-         }
-
-      }, new StreamErrorHandler()
-      {
-
-         @Override
-         public void handle(Throwable t)
-         {
-            throw new ArchiveExportException("Failed to write asset to Zip: " + pathName, t);
-         }
-
-      });
-   }
-
-   /**
-    * {@inheritDoc}
-    * @see org.jboss.shrinkwrap.impl.base.export.AbstractExporterDelegate#getResult()
-    */
-   @Override
-   protected InputStream getResult()
-   {
-      // Flush the output to a byte array
-      final byte[] zipContent = output.toByteArray();
-      if (log.isLoggable(Level.FINE))
-      {
-         log.fine("Created Zip of size: " + zipContent.length + " bytes");
-      }
-
-      // Make an instream
-      final InputStream inputStream = new ByteArrayInputStream(zipContent);
-
-      // Return
-      return inputStream;
-   }
-
-}

Deleted: shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/export/ZipExporterImpl.java
===================================================================
--- shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/export/ZipExporterImpl.java	2009-11-11 14:47:18 UTC (rev 3667)
+++ shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/export/ZipExporterImpl.java	2009-11-11 14:58:48 UTC (rev 3668)
@@ -1,99 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.shrinkwrap.impl.base.export;
-
-import java.io.InputStream;
-import java.util.logging.Logger;
-
-import org.jboss.shrinkwrap.api.Archive;
-import org.jboss.shrinkwrap.api.export.ZipExporter;
-import org.jboss.shrinkwrap.impl.base.SpecializedBase;
-import org.jboss.shrinkwrap.impl.base.Validate;
-
-/**
- * ZipExporterImpl
- * 
- * Implementation of ZipExporter used to export an Archive as a Zip format. 
- * 
- * @author <a href="mailto:baileyje at gmail.com">John Bailey</a>
- * @author <a href="mailto:aslak at conduct.no">Aslak Knutsen</a>
- * @version $Revision: $
- */
-public class ZipExporterImpl extends SpecializedBase implements ZipExporter
-{
-
-   //-------------------------------------------------------------------------------------||
-   // Class Members ----------------------------------------------------------------------||
-   //-------------------------------------------------------------------------------------||
-
-   /**
-    * Logger
-    */
-   private static final Logger log = Logger.getLogger(ZipExporterImpl.class.getName());
-
-   /**
-    * Archive to import into. 
-    */
-   private Archive<?> archive; 
-   
-   //-------------------------------------------------------------------------------------||
-   // Constructor ------------------------------------------------------------------------||
-   //-------------------------------------------------------------------------------------||
-
-   public ZipExporterImpl(Archive<?> archive) 
-   {
-      Validate.notNull(archive, "Archive must be specified");
-      this.archive = archive;
-   }
-
-   //-------------------------------------------------------------------------------------||
-   // Required Implementations -----------------------------------------------------------||
-   //-------------------------------------------------------------------------------------||
-
-   /* (non-Javadoc)
-    * @see org.jboss.shrinkwrap.impl.base.SpecializedBase#getArchive()
-    */
-   @Override
-   protected Archive<?> getArchive()
-   {
-      return archive;
-   }
-
-   //-------------------------------------------------------------------------------------||
-   // Required Implementations - ZipExporter ---------------------------------------------||
-   //-------------------------------------------------------------------------------------||
-
-   /**
-    * {@inheritDoc}
-    * @see org.jboss.shrinkwrap.api.export.ZipExporter#doExportZip(org.jboss.shrinkwrap.api.Archive)
-    */
-   @Override
-   public InputStream exportZip()
-   {
-      // Create export delegate
-      ZipExportDelegate exportDelegate = new ZipExportDelegate(archive);
-
-      // Execute export
-      exportDelegate.export();
-      // Get results
-      InputStream inputStream = exportDelegate.getResult(); 
-
-      // Return input stream
-      return inputStream;
-   }
-
-}

Deleted: shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/export/ZipExporterUtil.java
===================================================================
--- shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/export/ZipExporterUtil.java	2009-11-11 14:47:18 UTC (rev 3667)
+++ shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/export/ZipExporterUtil.java	2009-11-11 14:58:48 UTC (rev 3668)
@@ -1,72 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.shrinkwrap.impl.base.export;
-
-import org.jboss.shrinkwrap.api.Path;
-
-/**
- * ZipExporterUtil
- * 
- * Utility used to assist exporting to Zip format. 
- * 
- * @author <a href="mailto:baileyje at gmail.com">John Bailey</a>
- * @version $Revision: $
- */
-public class ZipExporterUtil
-{
-   //-------------------------------------------------------------------------------------||
-   // Class Members ----------------------------------------------------------------------||
-   //-------------------------------------------------------------------------------------||
-
-   /**
-    * Slash character
-    */
-   static final String SLASH = "/";
-
-   //-------------------------------------------------------------------------------------||
-   // Constructor ------------------------------------------------------------------------||
-   //-------------------------------------------------------------------------------------||
-
-   /**
-    * No instantiation
-    */
-   private ZipExporterUtil()
-   {
-      throw new UnsupportedOperationException("Constructor should never be invoked; this is a static util class");
-   }
-
-   //-------------------------------------------------------------------------------------||
-   // Utilities --------------------------------------------------------------------------||
-   //-------------------------------------------------------------------------------------||
-
-   /**
-    * Converts a Path to a ZipEntry path name
-    * 
-    *  @param path to convert
-    *  @return String representing a ZipEntry path
-    */
-   public static String toZipEntryPath(Path path)
-   {
-
-      String context = path.get();
-      if (context.startsWith(SLASH))
-      {
-         context = context.substring(1);
-      }
-      return context;
-   }
-}

Copied: shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/exporter (from rev 3600, shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/export)

Modified: shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/exporter/AbstractExporterDelegate.java
===================================================================
--- shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/export/AbstractExporterDelegate.java	2009-10-14 15:22:40 UTC (rev 3600)
+++ shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/exporter/AbstractExporterDelegate.java	2009-11-11 14:58:48 UTC (rev 3668)
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.jboss.shrinkwrap.impl.base.export;
+package org.jboss.shrinkwrap.impl.base.exporter;
 
 import java.util.Map;
 import java.util.Map.Entry;

Deleted: shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/exporter/ExplodedExporterDelegate.java
===================================================================
--- shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/export/ExplodedExporterDelegate.java	2009-10-14 15:22:40 UTC (rev 3600)
+++ shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/exporter/ExplodedExporterDelegate.java	2009-11-11 14:58:48 UTC (rev 3668)
@@ -1,177 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.shrinkwrap.impl.base.export;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.InputStream;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import org.jboss.shrinkwrap.api.Archive;
-import org.jboss.shrinkwrap.api.Asset;
-import org.jboss.shrinkwrap.api.Path;
-import org.jboss.shrinkwrap.api.export.ArchiveExportException;
-import org.jboss.shrinkwrap.api.export.ExplodedExporter;
-import org.jboss.shrinkwrap.impl.base.asset.ArchiveAsset;
-import org.jboss.shrinkwrap.impl.base.io.IOUtil;
-
-/**
- * ExplodedExporterDelegate
- * 
- * Delegate used to export an archive into an exploded directory structure.   
- * 
- * @author <a href="mailto:baileyje at gmail.com">John Bailey</a>
- * @version $Revision: $
- */
-public class ExplodedExporterDelegate extends AbstractExporterDelegate<File>
-{
-   //-------------------------------------------------------------------------------------||
-   // Class Members ----------------------------------------------------------------------||
-   //-------------------------------------------------------------------------------------||
-
-   /**
-    * Logger
-    */
-   private static final Logger log = Logger.getLogger(ExplodedExporterDelegate.class.getName());
-
-   //-------------------------------------------------------------------------------------||
-   // Instance Members -------------------------------------------------------------------||
-   //-------------------------------------------------------------------------------------||
-
-   /**
-    * Output directory to write the exploded content to.
-    */
-   private final File outputDirectory;
-
-   //-------------------------------------------------------------------------------------||
-   // Constructor ------------------------------------------------------------------------||
-   //-------------------------------------------------------------------------------------||
-
-   /**
-    * Creates a new exploded exporter delegate for the provided {@link Archive} 
-    */
-   public ExplodedExporterDelegate(Archive<?> archive, File baseDirectory)
-   {
-      super(archive);
-      this.outputDirectory = initializeOutputDirectory(baseDirectory);
-   }
-
-   //-------------------------------------------------------------------------------------||
-   // Required Implementations -----------------------------------------------------------||
-   //-------------------------------------------------------------------------------------||
-
-   /**
-    * {@inheritDoc}
-    * @see org.jboss.shrinkwrap.impl.base.export.AbstractExporterDelegate#processAsset(Path, Asset)
-    */
-   @Override
-   protected void processAsset(Path path, Asset asset)
-   {
-      // Get path to file
-      final String assetFilePath = path.get();
-
-      // Create a file for the asset
-      final File assetFile = new File(outputDirectory, assetFilePath);
-
-      // Get the assets parent parent directory and make sure it exists
-      final File assetParent = assetFile.getParentFile();
-      if (!assetParent.exists())
-      {
-         if (!assetParent.mkdirs())
-         {
-            throw new ArchiveExportException("Failed to write asset.  Unable to create parent directory.");
-         }
-      }
-
-      // Handle Archive assets separately 
-      if (asset instanceof ArchiveAsset)
-      {
-         ArchiveAsset nesteArchiveAsset = ArchiveAsset.class.cast(asset);
-         processArchiveAsset(assetParent, nesteArchiveAsset);
-         return;
-      }
-
-      try
-      {
-         if (log.isLoggable(Level.FINE))
-         {
-            log.fine("Writing asset " + path.get() + " to " + assetFile.getAbsolutePath());
-         }
-         // Get the asset streams
-         final InputStream assetInputStream = asset.openStream();
-         final FileOutputStream assetFileOutputStream = new FileOutputStream(assetFile);
-
-         // Write contents
-         IOUtil.copyWithClose(assetInputStream, assetFileOutputStream);
-      }
-      catch (Throwable t)
-      {
-         throw new ArchiveExportException("Failed to write asset " + path + " to " + assetFile);
-      }
-   }
-
-   /**
-    * {@inheritDoc}
-    * @see org.jboss.shrinkwrap.impl.base.export.AbstractExporterDelegate#getResult()
-    */
-   @Override
-   protected File getResult()
-   {
-      return outputDirectory;
-   }
-
-   //-------------------------------------------------------------------------------------||
-   // Internal Helper Methods ------------------------------------------------------------||
-   //-------------------------------------------------------------------------------------||
-
-   /**
-    * Processes a nested archive by delegating to the ExplodedArchiveExporter
-    * @param parentDirectory
-    * @param nestedArchiveAsset
-    */
-   private void processArchiveAsset(File parentDirectory, ArchiveAsset nestedArchiveAsset)
-   {
-      // Get the nested archive
-      Archive<?> nestedArchive = nestedArchiveAsset.getArchive();
-
-      ExplodedExporter.exportExploded(nestedArchive, parentDirectory);
-   }
-
-   /**
-    * Initializes the output directory
-    * 
-    * @param baseDirectory
-    * @return
-    */
-   private File initializeOutputDirectory(File baseDirectory)
-   {
-
-      // Get archive
-      Archive<?> archive = getArchive();
-
-      // Create output directory
-      final File outputDirectory = new File(baseDirectory, archive.getName());
-      if (!outputDirectory.mkdir())
-      {
-         throw new ArchiveExportException("Unable to create archive output directory - " + outputDirectory);
-      }
-
-      return outputDirectory;
-   }
-
-}

Copied: shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/exporter/ExplodedExporterDelegate.java (from rev 3667, shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/export/ExplodedExporterDelegate.java)
===================================================================
--- shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/exporter/ExplodedExporterDelegate.java	                        (rev 0)
+++ shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/exporter/ExplodedExporterDelegate.java	2009-11-11 14:58:48 UTC (rev 3668)
@@ -0,0 +1,176 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.shrinkwrap.impl.base.exporter;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.Asset;
+import org.jboss.shrinkwrap.api.Path;
+import org.jboss.shrinkwrap.api.exporter.ArchiveExportException;
+import org.jboss.shrinkwrap.api.exporter.ExplodedExporter;
+import org.jboss.shrinkwrap.impl.base.asset.ArchiveAsset;
+import org.jboss.shrinkwrap.impl.base.io.IOUtil;
+
+/**
+ * ExplodedExporterDelegate
+ * 
+ * Delegate used to export an archive into an exploded directory structure.   
+ * 
+ * @author <a href="mailto:baileyje at gmail.com">John Bailey</a>
+ * @author <a href="mailto:aslak at conduct.no">Aslak Knutsen</a>
+ * @version $Revision: $
+ */
+public class ExplodedExporterDelegate extends AbstractExporterDelegate<File>
+{
+   //-------------------------------------------------------------------------------------||
+   // Class Members ----------------------------------------------------------------------||
+   //-------------------------------------------------------------------------------------||
+
+   /**
+    * Logger
+    */
+   private static final Logger log = Logger.getLogger(ExplodedExporterDelegate.class.getName());
+
+   //-------------------------------------------------------------------------------------||
+   // Instance Members -------------------------------------------------------------------||
+   //-------------------------------------------------------------------------------------||
+
+   /**
+    * Output directory to write the exploded content to.
+    */
+   private final File outputDirectory;
+
+   //-------------------------------------------------------------------------------------||
+   // Constructor ------------------------------------------------------------------------||
+   //-------------------------------------------------------------------------------------||
+
+   /**
+    * Creates a new exploded exporter delegate for the provided {@link Archive} 
+    */
+   public ExplodedExporterDelegate(Archive<?> archive, File baseDirectory)
+   {
+      super(archive);
+      this.outputDirectory = initializeOutputDirectory(baseDirectory);
+   }
+
+   //-------------------------------------------------------------------------------------||
+   // Required Implementations -----------------------------------------------------------||
+   //-------------------------------------------------------------------------------------||
+
+   /**
+    * {@inheritDoc}
+    * @see org.jboss.shrinkwrap.impl.base.exporter.AbstractExporterDelegate#processAsset(Path, Asset)
+    */
+   @Override
+   protected void processAsset(Path path, Asset asset)
+   {
+      // Get path to file
+      final String assetFilePath = path.get();
+
+      // Create a file for the asset
+      final File assetFile = new File(outputDirectory, assetFilePath);
+
+      // Get the assets parent parent directory and make sure it exists
+      final File assetParent = assetFile.getParentFile();
+      if (!assetParent.exists())
+      {
+         if (!assetParent.mkdirs())
+         {
+            throw new ArchiveExportException("Failed to write asset.  Unable to create parent directory.");
+         }
+      }
+
+      // Handle Archive assets separately 
+      if (asset instanceof ArchiveAsset)
+      {
+         ArchiveAsset nesteArchiveAsset = ArchiveAsset.class.cast(asset);
+         processArchiveAsset(assetParent, nesteArchiveAsset);
+         return;
+      }
+
+      try
+      {
+         if (log.isLoggable(Level.FINE))
+         {
+            log.fine("Writing asset " + path.get() + " to " + assetFile.getAbsolutePath());
+         }
+         // Get the asset streams
+         final InputStream assetInputStream = asset.openStream();
+         final FileOutputStream assetFileOutputStream = new FileOutputStream(assetFile);
+
+         // Write contents
+         IOUtil.copyWithClose(assetInputStream, assetFileOutputStream);
+      }
+      catch (Throwable t)
+      {
+         throw new ArchiveExportException("Failed to write asset " + path + " to " + assetFile);
+      }
+   }
+
+   /**
+    * {@inheritDoc}
+    * @see org.jboss.shrinkwrap.impl.base.exporter.AbstractExporterDelegate#getResult()
+    */
+   @Override
+   protected File getResult()
+   {
+      return outputDirectory;
+   }
+
+   //-------------------------------------------------------------------------------------||
+   // Internal Helper Methods ------------------------------------------------------------||
+   //-------------------------------------------------------------------------------------||
+
+   /**
+    * Processes a nested archive by delegating to the ExplodedArchiveExporter
+    * @param parentDirectory
+    * @param nestedArchiveAsset
+    */
+   private void processArchiveAsset(File parentDirectory, ArchiveAsset nestedArchiveAsset)
+   {
+      // Get the nested archive
+      Archive<?> nestedArchive = nestedArchiveAsset.getArchive();
+      nestedArchive.as(ExplodedExporter.class).exportExploded(parentDirectory);
+   }
+
+   /**
+    * Initializes the output directory
+    * 
+    * @param baseDirectory
+    * @return
+    */
+   private File initializeOutputDirectory(File baseDirectory)
+   {
+      // Get archive
+      Archive<?> archive = getArchive();
+
+      // Create output directory
+      final File outputDirectory = new File(baseDirectory, archive.getName());
+      if (!outputDirectory.mkdir())
+      {
+         throw new ArchiveExportException("Unable to create archive output directory - " + outputDirectory);
+      }
+
+      return outputDirectory;
+   }
+
+}

Deleted: shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/exporter/ExplodedExporterImpl.java
===================================================================
--- shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/export/ExplodedExporterImpl.java	2009-10-14 15:22:40 UTC (rev 3600)
+++ shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/exporter/ExplodedExporterImpl.java	2009-11-11 14:58:48 UTC (rev 3668)
@@ -1,90 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.shrinkwrap.impl.base.export;
-
-import java.io.File;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import org.jboss.shrinkwrap.api.Archive;
-import org.jboss.shrinkwrap.api.export.ExplodedExporter;
-import org.jboss.shrinkwrap.impl.base.Validate;
-
-/**
- * ExplodedExporterImpl
- * 
- * Implementation of ExplodedExporter used to export an Archive as an exploded directory structure. 
- * 
- * @author <a href="mailto:baileyje at gmail.com">John Bailey</a>
- * @version $Revision: $
- */
-public class ExplodedExporterImpl extends ExplodedExporter
-{
-
-   //-------------------------------------------------------------------------------------||
-   // Class Members ----------------------------------------------------------------------||
-   //-------------------------------------------------------------------------------------||
-
-   /**
-    * Logger
-    */
-   private static final Logger log = Logger.getLogger(ExplodedExporterImpl.class.getName());
-
-   //-------------------------------------------------------------------------------------||
-   // Required Implementations - ExplodedExporter ----------------------------------------||
-   //-------------------------------------------------------------------------------------||
-
-   
-   /**
-    * {@inheritDoc} 
-    * @see ExplodedExporter#doExportExploded(Archive, File)
-    */
-   @Override
-   protected File doExportExploded(Archive<?> archive, File baseDirectory)
-   {
-      Validate.notNull(archive, "No archive provided");
-      Validate.notNull(baseDirectory, "No baseDirectory provided");
-
-      // Directory must exist
-      if (!baseDirectory.exists())
-      {
-         throw new IllegalArgumentException("Parent directory does not exist");
-      }
-      // Must be a directory
-      if (!baseDirectory.isDirectory())
-      {
-         throw new IllegalArgumentException("Provided parent directory is not a valid directory");
-      }
-
-      // Get the export delegate
-      ExplodedExporterDelegate exporterDelegate = new ExplodedExporterDelegate(archive, baseDirectory);
-
-      // Run the export
-      exporterDelegate.export();
-      
-      // Get Result
-      File explodedDirectory = exporterDelegate.getResult();
-
-      if (log.isLoggable(Level.FINE))
-      {
-         log.fine("Created Exploded Archive: " + explodedDirectory.getAbsolutePath());
-      }
-      // Return the exploded dir
-      return explodedDirectory;
-   }
-
-}

Copied: shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/exporter/ExplodedExporterImpl.java (from rev 3667, shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/export/ExplodedExporterImpl.java)
===================================================================
--- shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/exporter/ExplodedExporterImpl.java	                        (rev 0)
+++ shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/exporter/ExplodedExporterImpl.java	2009-11-11 14:58:48 UTC (rev 3668)
@@ -0,0 +1,118 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.shrinkwrap.impl.base.exporter;
+
+import java.io.File;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.exporter.ExplodedExporter;
+import org.jboss.shrinkwrap.impl.base.SpecializedBase;
+import org.jboss.shrinkwrap.impl.base.Validate;
+
+/**
+ * ExplodedExporterImpl
+ * 
+ * Implementation of ExplodedExporter used to export an Archive as an exploded directory structure. 
+ * 
+ * @author <a href="mailto:baileyje at gmail.com">John Bailey</a>
+ * @author <a href="mailto:aslak at conduct.no">Aslak Knutsen</a>
+ * @version $Revision: $
+ */
+public class ExplodedExporterImpl extends SpecializedBase implements ExplodedExporter
+{
+
+   //-------------------------------------------------------------------------------------||
+   // Class Members ----------------------------------------------------------------------||
+   //-------------------------------------------------------------------------------------||
+
+   /**
+    * Logger
+    */
+   private static final Logger log = Logger.getLogger(ExplodedExporterImpl.class.getName());
+
+   /**
+    * Archive to import into. 
+    */
+   private Archive<?> archive; 
+   
+   //-------------------------------------------------------------------------------------||
+   // Constructor ------------------------------------------------------------------------||
+   //-------------------------------------------------------------------------------------||
+
+   public ExplodedExporterImpl(Archive<?> archive) 
+   {
+      Validate.notNull(archive, "Archive must be specified");
+      this.archive = archive;
+   }
+
+   //-------------------------------------------------------------------------------------||
+   // Required Implementations -----------------------------------------------------------||
+   //-------------------------------------------------------------------------------------||
+
+   /* (non-Javadoc)
+    * @see org.jboss.shrinkwrap.impl.base.SpecializedBase#getArchive()
+    */
+   @Override
+   protected Archive<?> getArchive()
+   {
+      return archive;
+   }
+   
+   //-------------------------------------------------------------------------------------||
+   // Required Implementations - ExplodedExporter ----------------------------------------||
+   //-------------------------------------------------------------------------------------||
+
+   /* (non-Javadoc)
+    * @see org.jboss.shrinkwrap.api.exporter.ExplodedExporter#exportExploded(java.io.File)
+    */
+   @Override
+   public File exportExploded(File baseDirectory)
+   {
+      Validate.notNull(archive, "No archive provided");
+      Validate.notNull(baseDirectory, "No baseDirectory provided");
+
+      // Directory must exist
+      if (!baseDirectory.exists())
+      {
+         throw new IllegalArgumentException("Parent directory does not exist");
+      }
+      // Must be a directory
+      if (!baseDirectory.isDirectory())
+      {
+         throw new IllegalArgumentException("Provided parent directory is not a valid directory");
+      }
+
+      // Get the export delegate
+      ExplodedExporterDelegate exporterDelegate = new ExplodedExporterDelegate(archive, baseDirectory);
+
+      // Run the export
+      exporterDelegate.export();
+      
+      // Get Result
+      File explodedDirectory = exporterDelegate.getResult();
+
+      if (log.isLoggable(Level.FINE))
+      {
+         log.fine("Created Exploded Archive: " + explodedDirectory.getAbsolutePath());
+      }
+      // Return the exploded dir
+      return explodedDirectory;
+   }
+
+}

Deleted: shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/exporter/ZipArchiveInputStreamFactory.java
===================================================================
--- shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/export/ZipArchiveInputStreamFactory.java	2009-10-14 15:22:40 UTC (rev 3600)
+++ shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/exporter/ZipArchiveInputStreamFactory.java	2009-11-11 14:58:48 UTC (rev 3668)
@@ -1,52 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.shrinkwrap.impl.base.export;
-
-import java.io.InputStream;
-
-import org.jboss.shrinkwrap.api.Archive;
-import org.jboss.shrinkwrap.api.export.ZipExporter;
-import org.jboss.shrinkwrap.impl.base.ArchiveInputStreamFactory;
-
-/**
- * ZipArchiveInputStreamFactory
- * 
- * Factory used create an InputStream from an Archive by exporting the archive as a  Zip.
- *
- * @author <a href="mailto:baileyje at gmail.com">John Bailey</a>
- * @version $Revision: $
- */
-public class ZipArchiveInputStreamFactory extends ArchiveInputStreamFactory
-{
-   //-------------------------------------------------------------------------------------||
-   // Required Implementations - ArchiveInputStreamFactory  ------------------------------||
-   //-------------------------------------------------------------------------------------||
-   
-   /**
-    * {@inheritDoc}
-    * @see org.jboss.shrinkwrap.impl.base.ArchiveInputStreamFactory#doGetInputStream(Archive)
-    */
-   @Override
-   protected InputStream doGetInputStream(Archive<?> archive)
-   {
-      // Get InputStream from the ZipExporter
-      final InputStream inputStream = ZipExporter.exportZip(archive);
-      // Return input stream
-      return inputStream;
-   }
-
-}

Copied: shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/exporter/ZipArchiveInputStreamFactory.java (from rev 3667, shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/export/ZipArchiveInputStreamFactory.java)
===================================================================
--- shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/exporter/ZipArchiveInputStreamFactory.java	                        (rev 0)
+++ shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/exporter/ZipArchiveInputStreamFactory.java	2009-11-11 14:58:48 UTC (rev 3668)
@@ -0,0 +1,53 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.shrinkwrap.impl.base.exporter;
+
+import java.io.InputStream;
+
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.exporter.ZipExporter;
+import org.jboss.shrinkwrap.impl.base.ArchiveInputStreamFactory;
+
+/**
+ * ZipArchiveInputStreamFactory
+ * 
+ * Factory used create an InputStream from an Archive by exporting the archive as a  Zip.
+ *
+ * @author <a href="mailto:baileyje at gmail.com">John Bailey</a>
+ * @author <a href="mailto:aslak at conduct.no">Aslak Knutsen</a>
+ * @version $Revision: $
+ */
+public class ZipArchiveInputStreamFactory extends ArchiveInputStreamFactory
+{
+   //-------------------------------------------------------------------------------------||
+   // Required Implementations - ArchiveInputStreamFactory  ------------------------------||
+   //-------------------------------------------------------------------------------------||
+   
+   /**
+    * {@inheritDoc}
+    * @see org.jboss.shrinkwrap.impl.base.ArchiveInputStreamFactory#doGetInputStream(Archive)
+    */
+   @Override
+   protected InputStream doGetInputStream(Archive<?> archive)
+   {
+      // Get InputStream from the ZipExporter
+      final InputStream inputStream = archive.as(ZipExporter.class).exportZip();
+      // Return input stream
+      return inputStream;
+   }
+
+}

Modified: shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/exporter/ZipExportDelegate.java
===================================================================
--- shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/export/ZipExportDelegate.java	2009-10-14 15:22:40 UTC (rev 3600)
+++ shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/exporter/ZipExportDelegate.java	2009-11-11 14:58:48 UTC (rev 3668)
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.jboss.shrinkwrap.impl.base.export;
+package org.jboss.shrinkwrap.impl.base.exporter;
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
@@ -27,7 +27,7 @@
 import org.jboss.shrinkwrap.api.Archive;
 import org.jboss.shrinkwrap.api.Asset;
 import org.jboss.shrinkwrap.api.Path;
-import org.jboss.shrinkwrap.api.export.ArchiveExportException;
+import org.jboss.shrinkwrap.api.exporter.ArchiveExportException;
 import org.jboss.shrinkwrap.impl.base.io.IOUtil;
 import org.jboss.shrinkwrap.impl.base.io.StreamErrorHandler;
 import org.jboss.shrinkwrap.impl.base.io.StreamTask;
@@ -75,7 +75,7 @@
 
    /**
     * {@inheritDoc}
-    * @see org.jboss.shrinkwrap.impl.base.export.AbstractExporterDelegate#export()
+    * @see org.jboss.shrinkwrap.impl.base.exporter.AbstractExporterDelegate#export()
     */
    @Override
    protected void export()
@@ -106,7 +106,7 @@
 
    /**
     * {@inheritDoc}
-    * @see org.jboss.shrinkwrap.impl.base.export.AbstractExporterDelegate#processAsset(Path, Asset)
+    * @see org.jboss.shrinkwrap.impl.base.exporter.AbstractExporterDelegate#processAsset(Path, Asset)
     */
    @Override
    protected void processAsset(final Path path, final Asset asset)
@@ -147,9 +147,8 @@
       });
    }
 
-   /**
-    * {@inheritDoc}
-    * @see org.jboss.shrinkwrap.impl.base.export.AbstractExporterDelegate#getResult()
+   /* (non-Javadoc)
+    * @see org.jboss.shrinkwrap.impl.base.exporter.AbstractExporterDelegate#getResult()
     */
    @Override
    protected InputStream getResult()

Deleted: 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/export/ZipExporterImpl.java	2009-10-14 15:22:40 UTC (rev 3600)
+++ shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/exporter/ZipExporterImpl.java	2009-11-11 14:58:48 UTC (rev 3668)
@@ -1,71 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.shrinkwrap.impl.base.export;
-
-import java.io.InputStream;
-import java.util.logging.Logger;
-
-import org.jboss.shrinkwrap.api.Archive;
-import org.jboss.shrinkwrap.api.export.ZipExporter;
-import org.jboss.shrinkwrap.impl.base.Validate;
-
-/**
- * ZipExporterImpl
- * 
- * Implementation of ZipExporter used to export an Archive as a Zip format. 
- * 
- * @author <a href="mailto:baileyje at gmail.com">John Bailey</a>
- * @version $Revision: $
- */
-public class ZipExporterImpl extends ZipExporter
-{
-
-   //-------------------------------------------------------------------------------------||
-   // Class Members ----------------------------------------------------------------------||
-   //-------------------------------------------------------------------------------------||
-
-   /**
-    * Logger
-    */
-   private static final Logger log = Logger.getLogger(ZipExporterImpl.class.getName());
-
-   //-------------------------------------------------------------------------------------||
-   // Required Implementations - ZipExporter ---------------------------------------------||
-   //-------------------------------------------------------------------------------------||
-
-   /**
-    * {@inheritDoc}
-    * @see org.jboss.shrinkwrap.api.export.ZipExporter#doExportZip(org.jboss.shrinkwrap.api.Archive)
-    */
-   @Override
-   protected InputStream doExportZip(Archive<?> archive)
-   {
-      Validate.notNull(archive, "No archive provided");
-
-      // Create export delegate
-      ZipExportDelegate exportDelegate = new ZipExportDelegate(archive);
-
-      // Execute export
-      exportDelegate.export();
-      // Get results
-      InputStream inputStream = exportDelegate.getResult(); 
-
-      // Return input stream
-      return inputStream;
-   }
-
-}

Copied: shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/exporter/ZipExporterImpl.java (from rev 3667, shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/export/ZipExporterImpl.java)
===================================================================
--- shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/exporter/ZipExporterImpl.java	                        (rev 0)
+++ shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/exporter/ZipExporterImpl.java	2009-11-11 14:58:48 UTC (rev 3668)
@@ -0,0 +1,98 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.shrinkwrap.impl.base.exporter;
+
+import java.io.InputStream;
+import java.util.logging.Logger;
+
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.exporter.ZipExporter;
+import org.jboss.shrinkwrap.impl.base.SpecializedBase;
+import org.jboss.shrinkwrap.impl.base.Validate;
+
+/**
+ * ZipExporterImpl
+ * 
+ * Implementation of ZipExporter used to export an Archive as a Zip format. 
+ * 
+ * @author <a href="mailto:baileyje at gmail.com">John Bailey</a>
+ * @author <a href="mailto:aslak at conduct.no">Aslak Knutsen</a>
+ * @version $Revision: $
+ */
+public class ZipExporterImpl extends SpecializedBase implements ZipExporter
+{
+
+   //-------------------------------------------------------------------------------------||
+   // Class Members ----------------------------------------------------------------------||
+   //-------------------------------------------------------------------------------------||
+
+   /**
+    * Logger
+    */
+   private static final Logger log = Logger.getLogger(ZipExporterImpl.class.getName());
+
+   /**
+    * Archive to import into. 
+    */
+   private Archive<?> archive; 
+   
+   //-------------------------------------------------------------------------------------||
+   // Constructor ------------------------------------------------------------------------||
+   //-------------------------------------------------------------------------------------||
+
+   public ZipExporterImpl(Archive<?> archive) 
+   {
+      Validate.notNull(archive, "Archive must be specified");
+      this.archive = archive;
+   }
+
+   //-------------------------------------------------------------------------------------||
+   // Required Implementations -----------------------------------------------------------||
+   //-------------------------------------------------------------------------------------||
+
+   /* (non-Javadoc)
+    * @see org.jboss.shrinkwrap.impl.base.SpecializedBase#getArchive()
+    */
+   @Override
+   protected Archive<?> getArchive()
+   {
+      return archive;
+   }
+
+   //-------------------------------------------------------------------------------------||
+   // Required Implementations - ZipExporter ---------------------------------------------||
+   //-------------------------------------------------------------------------------------||
+
+   /* (non-Javadoc)
+    * @see org.jboss.shrinkwrap.api.exporter.ZipExporter#exportZip()
+    */
+   @Override
+   public InputStream exportZip()
+   {
+      // Create export delegate
+      ZipExportDelegate exportDelegate = new ZipExportDelegate(archive);
+
+      // Execute export
+      exportDelegate.export();
+      // Get results
+      InputStream inputStream = exportDelegate.getResult(); 
+
+      // Return input stream
+      return inputStream;
+   }
+
+}

Modified: shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/exporter/ZipExporterUtil.java
===================================================================
--- shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/export/ZipExporterUtil.java	2009-10-14 15:22:40 UTC (rev 3600)
+++ shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/exporter/ZipExporterUtil.java	2009-11-11 14:58:48 UTC (rev 3668)
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.jboss.shrinkwrap.impl.base.export;
+package org.jboss.shrinkwrap.impl.base.exporter;
 
 import org.jboss.shrinkwrap.api.Path;
 

Deleted: shrinkwrap/trunk/impl-base/src/main/resources/META-INF/services/org.jboss.shrinkwrap.api.export.ExplodedExporter
===================================================================
--- shrinkwrap/trunk/impl-base/src/main/resources/META-INF/services/org.jboss.shrinkwrap.api.export.ExplodedExporter	2009-11-11 14:47:18 UTC (rev 3667)
+++ shrinkwrap/trunk/impl-base/src/main/resources/META-INF/services/org.jboss.shrinkwrap.api.export.ExplodedExporter	2009-11-11 14:58:48 UTC (rev 3668)
@@ -1 +0,0 @@
-org.jboss.shrinkwrap.impl.base.export.ExplodedExporterImpl
\ No newline at end of file

Deleted: shrinkwrap/trunk/impl-base/src/main/resources/META-INF/services/org.jboss.shrinkwrap.api.export.ZipExporter
===================================================================
--- shrinkwrap/trunk/impl-base/src/main/resources/META-INF/services/org.jboss.shrinkwrap.api.export.ZipExporter	2009-11-11 14:47:18 UTC (rev 3667)
+++ shrinkwrap/trunk/impl-base/src/main/resources/META-INF/services/org.jboss.shrinkwrap.api.export.ZipExporter	2009-11-11 14:58:48 UTC (rev 3668)
@@ -1 +0,0 @@
-org.jboss.shrinkwrap.impl.base.export.ZipExporterImpl
\ No newline at end of file

Copied: shrinkwrap/trunk/impl-base/src/main/resources/META-INF/services/org.jboss.shrinkwrap.api.exporter.ExplodedExporter (from rev 3667, shrinkwrap/trunk/impl-base/src/main/resources/META-INF/services/org.jboss.shrinkwrap.api.export.ExplodedExporter)
===================================================================
--- shrinkwrap/trunk/impl-base/src/main/resources/META-INF/services/org.jboss.shrinkwrap.api.exporter.ExplodedExporter	                        (rev 0)
+++ shrinkwrap/trunk/impl-base/src/main/resources/META-INF/services/org.jboss.shrinkwrap.api.exporter.ExplodedExporter	2009-11-11 14:58:48 UTC (rev 3668)
@@ -0,0 +1 @@
+org.jboss.shrinkwrap.impl.base.exporter.ExplodedExporterImpl
\ No newline at end of file

Copied: shrinkwrap/trunk/impl-base/src/main/resources/META-INF/services/org.jboss.shrinkwrap.api.exporter.ZipExporter (from rev 3667, shrinkwrap/trunk/impl-base/src/main/resources/META-INF/services/org.jboss.shrinkwrap.api.export.ZipExporter)
===================================================================
--- shrinkwrap/trunk/impl-base/src/main/resources/META-INF/services/org.jboss.shrinkwrap.api.exporter.ZipExporter	                        (rev 0)
+++ shrinkwrap/trunk/impl-base/src/main/resources/META-INF/services/org.jboss.shrinkwrap.api.exporter.ZipExporter	2009-11-11 14:58:48 UTC (rev 3668)
@@ -0,0 +1 @@
+org.jboss.shrinkwrap.impl.base.exporter.ZipExporterImpl
\ No newline at end of file

Deleted: shrinkwrap/trunk/impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/export/ExplodedExporterTestCase.java
===================================================================
--- shrinkwrap/trunk/impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/export/ExplodedExporterTestCase.java	2009-11-11 14:47:18 UTC (rev 3667)
+++ shrinkwrap/trunk/impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/export/ExplodedExporterTestCase.java	2009-11-11 14:58:48 UTC (rev 3668)
@@ -1,245 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source  
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.shrinkwrap.impl.base.export;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.logging.Logger;
-
-import org.jboss.shrinkwrap.api.Archive;
-import org.jboss.shrinkwrap.api.Asset;
-import org.jboss.shrinkwrap.api.Path;
-import org.jboss.shrinkwrap.api.export.ArchiveExportException;
-import org.jboss.shrinkwrap.api.export.ExplodedExporter;
-import org.jboss.shrinkwrap.impl.base.MemoryMapArchiveImpl;
-import org.jboss.shrinkwrap.impl.base.io.IOUtil;
-import org.jboss.shrinkwrap.impl.base.path.BasicPath;
-import org.junit.Assert;
-import org.junit.Test;
-
-/**
- * ExplodedExporterTestCase
- * 
- * TestCase to ensure that the {@link ExplodedExporter} correctly exports archive.
- *
- * @author <a href="mailto:baileyje at gmail.com">John Bailey</a>
- * @author <a href="mailto:aslak at conduct.no">Aslak Knutsen</a>
- * @version $Revision: $
- */
-public class ExplodedExporterTestCase extends ExportTestBase
-{
-
-   //-------------------------------------------------------------------------------------||
-   // Class Members ----------------------------------------------------------------------||
-   //-------------------------------------------------------------------------------------||
-
-   /**
-    * Logger
-    */
-   private static final Logger log = Logger.getLogger(ExplodedExporterTestCase.class.getName());
-
-   //-------------------------------------------------------------------------------------||
-   // Tests ------------------------------------------------------------------------------||
-   //-------------------------------------------------------------------------------------||
-
-   /**
-    * Ensure an archive can be exported to an exploded directory.
-    * 
-    * @throws Exception
-    */
-   @Test
-   public void testExportExploded() throws Exception
-   {
-      log.info("testExportExploded");
-
-      // Get a temp directory
-      File tempDirectory = createTempDirectory("testExportExploded");
-
-      // Get an archive instance
-      Archive<?> archive = createArchiveWithAssets();
-
-      // Export as Exploded directory
-      File explodedDirectory = archive.as(ExplodedExporter.class).exportExploded(tempDirectory);
-
-      // Validate the exploded directory was created 
-      Assert.assertNotNull(explodedDirectory);
-
-      // Assert the directory has the correct name
-      File expectedDirectory = new File(tempDirectory, archive.getName());
-      Assert.assertEquals(expectedDirectory, explodedDirectory);
-
-      // Validate entries were written out
-      assertAssetInExploded(explodedDirectory, PATH_ONE, ASSET_ONE);
-      assertAssetInExploded(explodedDirectory, PATH_TWO, ASSET_TWO);
-   }
-
-   /**
-    * Ensure an archive exported to an exploded directory properly explodes nested archives.
-    * 
-    * @throws Exception
-    */
-   @Test
-   public void testExportNestedExploded() throws Exception
-   {
-      log.info("testExportNestedExploded");
-
-      // Get a temp directory
-      File tempDirectory = createTempDirectory("testExportNestedExploded");
-
-      // Get an archive instance
-      Archive<?> archive = createArchiveWithNestedArchives();
-
-      // Export as Exploded directory
-      File explodedDirectory = archive.as(ExplodedExporter.class).exportExploded(tempDirectory);
-
-      // Validate the exploded directory was created 
-      Assert.assertNotNull(explodedDirectory);
-
-      // Assert the directory has the correct name
-      File expectedDirectory = new File(tempDirectory, archive.getName());
-      Assert.assertEquals(expectedDirectory, explodedDirectory);
-
-      // Validate nested archive entries were written out
-      Path nestedArchivePath = new BasicPath(NAME_NESTED_ARCHIVE);
-
-      assertAssetInExploded(explodedDirectory, new BasicPath(nestedArchivePath, PATH_ONE), ASSET_ONE);
-      assertAssetInExploded(explodedDirectory, new BasicPath(nestedArchivePath, PATH_TWO), ASSET_TWO);
-
-      Path nestedArchivePathTwo = new BasicPath(NESTED_PATH, NAME_NESTED_ARCHIVE_2);
-
-      assertAssetInExploded(explodedDirectory, new BasicPath(nestedArchivePathTwo, PATH_ONE), ASSET_ONE);
-      assertAssetInExploded(explodedDirectory, new BasicPath(nestedArchivePathTwo, PATH_TWO), ASSET_TWO);
-   }
-
-   /**
-    * Ensure an baseDirectory is required to export.
-    * 
-    * @throws Exception
-    */
-   @Test(expected = IllegalArgumentException.class)
-   public void testExportExplodedRequiresBaseDirectroy() throws Exception
-   {
-      log.info("testExportExplodedRequiresBaseDirectroy");
-
-      new MemoryMapArchiveImpl().as(ExplodedExporter.class).exportExploded(null);
-   }
-
-   /**
-    * Ensure an baseDirectory must exist is required to export.
-    * 
-    * @throws Exception
-    */
-   @Test(expected = IllegalArgumentException.class)
-   public void testExportExplodedRequiresExistingDirectory() throws Exception
-   {
-      log.info("testExportExplodedRequiresExisitingDirectroy");
-
-      final File directory = this.getNonexistantDirectory();
-      new MemoryMapArchiveImpl().as(ExplodedExporter.class).exportExploded(directory);
-   }
-
-   /**
-    * Ensure ExpolodedExporter requires a directory
-    */
-   @Test(expected = IllegalArgumentException.class)
-   public void testExportExplodedRequiresValidDirectory() throws Exception
-   {
-      log.info("testExportExplodedRequiresValidDirectory");
-      final File nonDirectory = new File(this.getTarget(), "tempFile.txt");
-      nonDirectory.createNewFile();
-      new MemoryMapArchiveImpl().as(ExplodedExporter.class).exportExploded(nonDirectory);
-   }
-
-   /**
-    * Ensure an ArchiveExportException is thrown when output directory can not be created
-    */
-   @Test(expected = ArchiveExportException.class)
-   public void testExportExplodedOutpuDirCreationFails() throws Exception
-   {
-      log.info("testExportExplodedOutpuDirCreationFails");
-      final File directory = createTempDirectory("testExportExplodedOutpuDirCreationFails");
-      // Will cause the creation of Archive directory to fail
-      final File existingFile = new File(directory, NAME_ARCHIVE);
-      existingFile.createNewFile();
-      new MemoryMapArchiveImpl(NAME_ARCHIVE).as(ExplodedExporter.class).exportExploded(directory);
-   }
-
-   /**
-    * Ensure ArchiveException is thrown if Asset can not be written
-    */
-   @Test(expected = ArchiveExportException.class)
-   public void testExportExplodedThrowsExceptionOnAssetWrite() throws Exception
-   {
-      log.info("testExportExplodedThrowsExceptionOnAssetWrite");
-      Archive<?> archive = createArchiveWithAssets();
-      archive.add(new Asset()
-      {
-
-         @Override
-         public InputStream openStream()
-         {
-            throw new RuntimeException("Mock Esception getting Stream");
-         }
-
-      }, new BasicPath("badAsset"));
-      final File directory = createTempDirectory("testExportExplodedThrowsExceptionOnAssetWrite");
-
-      archive.as(ExplodedExporter.class).exportExploded(directory);
-   }
-
-   //-------------------------------------------------------------------------------------||
-   // Internal Helper Methods ------------------------------------------------------------||
-   //-------------------------------------------------------------------------------------||
-
-   /**
-    * Obtains a reference to a directory that does not exist
-    */
-   private File getNonexistantDirectory()
-   {
-      final File directory = new File(this.getTarget(), "someNonExistentDirectory");
-      if (directory.exists())
-      {
-         IOUtil.deleteDirectory(directory);
-      }
-      Assert.assertTrue("Precondition Failure: Directory should not exist: " + directory, !directory.exists());
-      return directory;
-   }
-
-   /**
-    * Assert an asset is actually in the exploded directory
-    * 
-    * @throws FileNotFoundException 
-    * @throws IOException 
-    * @throws IllegalArgumentException 
-    */
-   private void assertAssetInExploded(File explodedDirectory, Path path, Asset asset) throws FileNotFoundException
-   {
-      File assetFile = new File(explodedDirectory, path.get());
-      Assert.assertNotNull(assetFile);
-      Assert.assertTrue(assetFile.exists());
-      byte[] expectedContents = IOUtil.asByteArray(asset.openStream());
-
-      InputStream inputStream = new FileInputStream(assetFile);
-
-      byte[] actualContents = IOUtil.asByteArray(inputStream);
-      Assert.assertArrayEquals(expectedContents, actualContents);
-   }
-
-}

Deleted: shrinkwrap/trunk/impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/export/ExportTestBase.java
===================================================================
--- shrinkwrap/trunk/impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/export/ExportTestBase.java	2009-11-11 14:47:18 UTC (rev 3667)
+++ shrinkwrap/trunk/impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/export/ExportTestBase.java	2009-11-11 14:58:48 UTC (rev 3668)
@@ -1,196 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.shrinkwrap.impl.base.export;
-
-import java.io.File;
-import java.net.URISyntaxException;
-import java.util.logging.Logger;
-
-import org.jboss.shrinkwrap.api.Archive;
-import org.jboss.shrinkwrap.api.Asset;
-import org.jboss.shrinkwrap.api.Path;
-import org.jboss.shrinkwrap.impl.base.MemoryMapArchiveImpl;
-import org.jboss.shrinkwrap.impl.base.asset.ClassLoaderAsset;
-import org.jboss.shrinkwrap.impl.base.io.IOUtil;
-import org.jboss.shrinkwrap.impl.base.path.BasicPath;
-import org.jboss.shrinkwrap.spi.MemoryMapArchive;
-import org.junit.Assert;
-
-/**
- * ExportTestBase
- * 
- * Base support for the exporter test cases 
- *
- * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
- * @author <a href="mailto:baileyje at gmail.com">John Bailey</a>
- * @version $Revision: $
- */
-public abstract class ExportTestBase
-{
-
-   //-------------------------------------------------------------------------------------||
-   // Class Members ----------------------------------------------------------------------||
-   //-------------------------------------------------------------------------------------||
-
-   /**
-    * Logger
-    */
-   private static final Logger log = Logger.getLogger(ExportTestBase.class.getName());
-
-   /**
-    * Name of an Archive
-    */
-   protected static final String NAME_ARCHIVE = "testArchive.jar";
-
-   /**
-    * Name of a properties file upon the test CP
-    */
-   protected static final String NAME_TEST_PROPERTIES = "org/jboss/shrinkwrap/impl/base/asset/Test.properties";
-
-   /**
-    * Name of another properties file upon the test CP
-    */
-   protected static final String NAME_TEST_PROPERTIES_2 = "org/jboss/shrinkwrap/impl/base/asset/Test2.properties";
-
-   /**
-    * Path of for nested content
-    */
-   protected static final Path NESTED_PATH = new BasicPath("nested");
-
-   /**
-    * Name of a nested archive
-    */
-   protected static final String NAME_NESTED_ARCHIVE = "nestedArchive.jar";
-
-   /**
-    * Name of another nested archive
-    */
-   protected static final String NAME_NESTED_ARCHIVE_2 = "nestedArchive2.jar";
-
-   /** 
-    * Asset used for testing
-    */
-   protected static final Asset ASSET_ONE = new ClassLoaderAsset(NAME_TEST_PROPERTIES);
-
-   /** 
-    * Path used for testing
-    */
-   protected static final Path PATH_ONE = new BasicPath("Test.properties");
-
-   /** 
-    * Another asset used for testing
-    */
-   protected static final Asset ASSET_TWO = new ClassLoaderAsset(NAME_TEST_PROPERTIES_2);
-
-   /** 
-   * Another path used for testing
-   */
-   protected static final Path PATH_TWO = new BasicPath(NESTED_PATH, "Test2.properties");
-
-   //-------------------------------------------------------------------------------------||
-   // Functional Methods -----------------------------------------------------------------||
-   //-------------------------------------------------------------------------------------||
-
-   /** 
-    * Returns a temp directory for a test.  Needs the test
-    */
-   protected File createTempDirectory(String testName) throws Exception
-   {
-      // Qualify the temp directory by test case
-      File tempDirectoryParent = new File(this.getTarget(), this.getClass().getSimpleName());
-      // Qualify the temp directory by test name
-      File tempDirectory = new File(tempDirectoryParent, testName);
-      log.info("Temp Directory: " + tempDirectory.getCanonicalPath());
-      if (tempDirectory.exists())
-      {
-         IOUtil.deleteDirectory(tempDirectory);
-      }
-      Assert.assertTrue("Temp directory should be clear before start", !tempDirectory.exists());
-      tempDirectory.mkdirs();
-      return tempDirectory;
-   }
-
-   /**
-    * Returns the target directory 
-    */
-   protected File getTarget()
-   {
-      try
-      {
-         return new File(new File(this.getClass().getProtectionDomain().getCodeSource().getLocation().toURI()), "../");
-      }
-      catch (final URISyntaxException urise)
-      {
-         throw new RuntimeException("Could not obtain the target URI", urise);
-      }
-   }
-
-   /**
-    * Create an archive instance and add some assets
-    */
-   protected Archive<?> createArchiveWithAssets()
-   {
-      // Create an archive
-      Archive<?> archive = new MemoryMapArchiveImpl(NAME_ARCHIVE);
-      // Add some content
-      addContent(archive);
-      // Return archive
-      return archive;
-   }
-
-   /**
-    * Create an archive instance and add some assets and some nested archives
-    */
-   protected Archive<?> createArchiveWithNestedArchives()
-   {
-      // Create an archive
-      Archive<?> archive = createArchiveWithAssets();
-
-      // Create a nested archive
-      MemoryMapArchive nestedArchive = new MemoryMapArchiveImpl(NAME_NESTED_ARCHIVE);
-
-      // Add some content
-      addContent(nestedArchive);
-
-      // Add nested archive
-      archive.add(nestedArchive, new BasicPath());
-
-      // Add an archive nested in a directory
-      MemoryMapArchive nestedArchiveTwo = new MemoryMapArchiveImpl(NAME_NESTED_ARCHIVE_2);
-
-      // Add some content
-      addContent(nestedArchiveTwo);
-
-      // Add the archive under a nested path
-      archive.add(nestedArchiveTwo, NESTED_PATH);
-
-      // Return archive
-      return archive;
-   }
-
-   /**
-    * Add basic contents to the archive
-    * 
-    * @param archive
-    */
-   protected void addContent(Archive<?> archive)
-   {
-      archive.add(ASSET_ONE, PATH_ONE);
-      archive.add(ASSET_TWO, PATH_TWO);
-   }
-
-}

Deleted: shrinkwrap/trunk/impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/export/ZipExporterTestCase.java
===================================================================
--- shrinkwrap/trunk/impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/export/ZipExporterTestCase.java	2009-11-11 14:47:18 UTC (rev 3667)
+++ shrinkwrap/trunk/impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/export/ZipExporterTestCase.java	2009-11-11 14:58:48 UTC (rev 3668)
@@ -1,222 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source  
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.shrinkwrap.impl.base.export;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.logging.Logger;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipFile;
-
-import org.jboss.shrinkwrap.api.Archive;
-import org.jboss.shrinkwrap.api.Asset;
-import org.jboss.shrinkwrap.api.Path;
-import org.jboss.shrinkwrap.api.export.ArchiveExportException;
-import org.jboss.shrinkwrap.api.export.ZipExporter;
-import org.jboss.shrinkwrap.impl.base.io.IOUtil;
-import org.jboss.shrinkwrap.impl.base.path.BasicPath;
-import org.junit.Assert;
-import org.junit.Test;
-
-/**
- * ZipExporterTestCase
- * 
- * TestCase to ensure that the {@link ZipExporter} correctly exports archives to Zip format.
- *
- * @author <a href="mailto:baileyje at gmail.com">John Bailey</a>
- * @author <a href="mailto:aslak at conduct.no">Aslak Knutsen</a>
- * @version $Revision: $
- */
-public class ZipExporterTestCase extends ExportTestBase
-{
-   //-------------------------------------------------------------------------------------||
-   // Class Members ----------------------------------------------------------------------||
-   //-------------------------------------------------------------------------------------||
-
-   /**
-    * Logger
-    */
-   private static final Logger log = Logger.getLogger(ZipExporterTestCase.class.getName());
-
-   //-------------------------------------------------------------------------------------||
-   // Tests ------------------------------------------------------------------------------||
-   //-------------------------------------------------------------------------------------||
-
-   /**
-    * Test to make sue an archive can be exported to Zip and all contents are correctly located in the Zip.
-    * @throws Exception
-    */
-   @Test
-   public void testExportZip() throws Exception
-   {
-      log.info("testExportZip");
-
-      // Get a temp directory for the test
-      File tempDirectory = createTempDirectory("testExportZip");
-
-      // Get an archive instance
-      Archive<?> archive = createArchiveWithAssets();
-
-      // Export as Zip InputStream
-      InputStream zipStream = archive.as(ZipExporter.class).exportZip();
-
-      // Write zip content to temporary file 
-      ZipFile expectedZip = getExportedZipFile(NAME_ARCHIVE, zipStream, tempDirectory);
-
-      // Validate entries were written out
-      assertAssetInZip(expectedZip, PATH_ONE, ASSET_ONE);
-      assertAssetInZip(expectedZip, PATH_TWO, ASSET_TWO);
-
-   }
-
-   /**
-    * Test to make sue an archive can be exported to Zip and nested archives are also in exported as nested Zip.
-    * @throws Exception
-    */
-   @Test
-   public void testExportNestedZip() throws Exception
-   {
-      log.info("testExportNestedZip");
-
-      // Get a temp directory for the test
-      File tempDirectory = createTempDirectory("testExportNestedZip");
-
-      // Get an archive instance
-      Archive<?> archive = createArchiveWithNestedArchives();
-
-      // Export as Zip InputStream
-      InputStream zipStream = archive.as(ZipExporter.class).exportZip();
-
-      // Write out and retrieve Zip 
-      ZipFile expectedZip = getExportedZipFile(NAME_ARCHIVE, zipStream, tempDirectory);
-
-      // Validate entries were written out
-      assertAssetInZip(expectedZip, PATH_ONE, ASSET_ONE);
-      assertAssetInZip(expectedZip, PATH_TWO, ASSET_TWO);
-
-      // Validate nested archive entries were written out
-      Path nestedArchivePath = new BasicPath(NAME_NESTED_ARCHIVE);
-
-      // Get Zip entry path
-      String nestedArchiveZipEntryPath = ZipExporterUtil.toZipEntryPath(nestedArchivePath);
-
-      // Get nested archive entry from exported zip
-      ZipEntry nestedArchiveEntry = expectedZip.getEntry(nestedArchiveZipEntryPath);
-
-      // Get inputstream for entry 
-      InputStream nesterArchiveStream = expectedZip.getInputStream(nestedArchiveEntry);
-
-      // Write out and retrieve nested Zip
-      ZipFile nestedZip = getExportedZipFile(NAME_NESTED_ARCHIVE, nesterArchiveStream, tempDirectory);
-
-      assertAssetInZip(nestedZip, PATH_ONE, ASSET_ONE);
-      assertAssetInZip(nestedZip, PATH_TWO, ASSET_TWO);
-
-      // Validate nested archive entries were written out
-      Path nestedArchiveTwoPath = new BasicPath(NESTED_PATH, NAME_NESTED_ARCHIVE_2);
-
-      // Get Zip entry path
-      String nestedArchiveTwoZipEntryPath = ZipExporterUtil.toZipEntryPath(nestedArchiveTwoPath);
-
-      // Get second nested archive entry from exported zip
-      ZipEntry nestedArchiveTwoEntry = expectedZip.getEntry(nestedArchiveTwoZipEntryPath);
-
-      // Get inputstream for entry 
-      InputStream nesterArchiveTwoStream = expectedZip.getInputStream(nestedArchiveTwoEntry);
-
-      // Write out and retrieve second nested Zip
-      ZipFile nestedZipTwo = getExportedZipFile(NAME_NESTED_ARCHIVE_2, nesterArchiveTwoStream, tempDirectory);
-
-      assertAssetInZip(nestedZipTwo, PATH_ONE, ASSET_ONE);
-      assertAssetInZip(nestedZipTwo, PATH_TWO, ASSET_TWO);
-
-   }
-
-   @Test(expected = ArchiveExportException.class)
-   public void testExportThrowsArchiveExcepitonOnAssetWriteFailure()
-   {
-      log.info("testExportThrowsArchiveExcepitonOnAssetWriteFailure");
-      Archive<?> archive = createArchiveWithAssets();
-
-      archive.add(new Asset()
-      {
-
-         @Override
-         public InputStream openStream()
-         {
-            throw new RuntimeException("Mock Exception from an Asset write");
-         }
-
-      }, PATH_ONE);
-
-      archive.as(ZipExporter.class).exportZip();
-   }
-
-   //-------------------------------------------------------------------------------------||
-   // Internal Helper Methods ------------------------------------------------------------||
-   //-------------------------------------------------------------------------------------||
-
-   private ZipFile getExportedZipFile(String archiveName, InputStream zipStream, File tempDirectory) throws Exception
-   {
-
-      // Validate the InputStream was created 
-      Assert.assertNotNull(zipStream);
-
-      // Create a temp file
-      File outFile = new File(tempDirectory, archiveName);
-
-      // Write Zip contents to file
-      writeOutFile(outFile, zipStream);
-
-      // Use standard ZipFile library to read in written Zip file
-      ZipFile expectedZip = new ZipFile(outFile);
-
-      return expectedZip;
-   }
-
-   /**
-    * Assert an asset is actually in the Zip file
-    * @throws IOException 
-    * @throws IllegalArgumentException 
-    */
-   private void assertAssetInZip(ZipFile expectedZip, Path path, Asset asset) throws IllegalArgumentException,
-         IOException
-   {
-      String entryPath = ZipExporterUtil.toZipEntryPath(path);
-      ZipEntry entry = expectedZip.getEntry(entryPath);
-      Assert.assertNotNull(entry);
-      byte[] expectedContents = IOUtil.asByteArray(asset.openStream());
-      byte[] actualContents = IOUtil.asByteArray(expectedZip.getInputStream(entry));
-      Assert.assertArrayEquals(expectedContents, actualContents);
-   }
-
-   /**
-    * Write a InputStream out to file.
-    * @param outFile
-    * @param zipInputStream
-    * @throws Exception
-    */
-   private void writeOutFile(File outFile, InputStream inputStream) throws Exception
-   {
-      OutputStream fileOutputStream = new FileOutputStream(outFile);
-      IOUtil.copyWithClose(inputStream, fileOutputStream);
-   }
-
-}

Copied: shrinkwrap/trunk/impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/exporter (from rev 3600, shrinkwrap/trunk/impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/export)

Deleted: shrinkwrap/trunk/impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/exporter/ExplodedExporterTestCase.java
===================================================================
--- shrinkwrap/trunk/impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/export/ExplodedExporterTestCase.java	2009-10-14 15:22:40 UTC (rev 3600)
+++ shrinkwrap/trunk/impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/exporter/ExplodedExporterTestCase.java	2009-11-11 14:58:48 UTC (rev 3668)
@@ -1,320 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source  
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.shrinkwrap.impl.base.export;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.logging.Logger;
-
-import org.jboss.shrinkwrap.api.Archive;
-import org.jboss.shrinkwrap.api.Asset;
-import org.jboss.shrinkwrap.api.Path;
-import org.jboss.shrinkwrap.api.export.ArchiveExportException;
-import org.jboss.shrinkwrap.api.export.ExplodedExporter;
-import org.jboss.shrinkwrap.impl.base.MemoryMapArchiveImpl;
-import org.jboss.shrinkwrap.impl.base.asset.ClassLoaderAsset;
-import org.jboss.shrinkwrap.impl.base.io.IOUtil;
-import org.jboss.shrinkwrap.impl.base.path.BasicPath;
-import org.junit.Assert;
-import org.junit.Test;
-
-/**
- * ExplodedExporterTestCase
- * 
- * TestCase to ensure that the {@link ExplodedExporter} correctly exports archive.
- *
- * @author <a href="mailto:baileyje at gmail.com">John Bailey</a>
- * @version $Revision: $
- */
-public class ExplodedExporterTestCase extends ExportTestBase
-{
-
-   //-------------------------------------------------------------------------------------||
-   // Class Members ----------------------------------------------------------------------||
-   //-------------------------------------------------------------------------------------||
-
-   /**
-    * Logger
-    */
-   private static final Logger log = Logger.getLogger(ExplodedExporterTestCase.class.getName());
-
-   //-------------------------------------------------------------------------------------||
-   // Tests ------------------------------------------------------------------------------||
-   //-------------------------------------------------------------------------------------||
-
-   /**
-    * Ensure an archive can be exported to an exploded directory.
-    * 
-    * @throws Exception
-    */
-   @Test
-   public void testExportExploded() throws Exception
-   {
-      log.info("testExportExploded");
-
-      // Get a temp directory
-      File tempDirectory = createTempDirectory("testExportExploded");
-
-      // Get an archive instance
-      Archive<?> archive = createArchiveWithAssets();
-
-      // Export as Exploded directory
-      File explodedDirectory = ExplodedExporter.exportExploded(archive, tempDirectory);
-
-      // Validate the exploded directory was created 
-      Assert.assertNotNull(explodedDirectory);
-
-      // Assert the directory has the correct name
-      File expectedDirectory = new File(tempDirectory, archive.getName());
-      Assert.assertEquals(expectedDirectory, explodedDirectory);
-
-      // Validate entries were written out
-      assertAssetInExploded(explodedDirectory, PATH_ONE, ASSET_ONE);
-      assertAssetInExploded(explodedDirectory, PATH_TWO, ASSET_TWO);
-   }
-
-   /**
-    * Ensure an archive exported to an exploded directory properly explodes nested archives.
-    * 
-    * @throws Exception
-    */
-   @Test
-   public void testExportNestedExploded() throws Exception
-   {
-      log.info("testExportNestedExploded");
-
-      // Get a temp directory
-      File tempDirectory = createTempDirectory("testExportNestedExploded");
-
-      // Get an archive instance
-      Archive<?> archive = createArchiveWithNestedArchives();
-
-      // Export as Exploded directory
-      File explodedDirectory = ExplodedExporter.exportExploded(archive, tempDirectory);
-
-      // Validate the exploded directory was created 
-      Assert.assertNotNull(explodedDirectory);
-
-      // Assert the directory has the correct name
-      File expectedDirectory = new File(tempDirectory, archive.getName());
-      Assert.assertEquals(expectedDirectory, explodedDirectory);
-
-      // Validate nested archive entries were written out
-      Path nestedArchivePath = new BasicPath(NAME_NESTED_ARCHIVE);
-
-      assertAssetInExploded(explodedDirectory, new BasicPath(nestedArchivePath, PATH_ONE), ASSET_ONE);
-      assertAssetInExploded(explodedDirectory, new BasicPath(nestedArchivePath, PATH_TWO), ASSET_TWO);
-
-      Path nestedArchivePathTwo = new BasicPath(NESTED_PATH, NAME_NESTED_ARCHIVE_2);
-
-      assertAssetInExploded(explodedDirectory, new BasicPath(nestedArchivePathTwo, PATH_ONE), ASSET_ONE);
-      assertAssetInExploded(explodedDirectory, new BasicPath(nestedArchivePathTwo, PATH_TWO), ASSET_TWO);
-   }
-
-   /**
-    * Ensure an archive is required to export.
-    * 
-    * @throws Exception
-    */
-   @Test
-   public void testExportExplodedRequiresArchive() throws Exception
-   {
-      log.info("testExportExplodedRequiresArchive");
-
-      try
-      {
-         ExplodedExporter.exportExploded(null, getNonexistantDirectory());
-         Assert.fail("Should have thrown IllegalArgumentException");
-      }
-      catch (IllegalArgumentException expected)
-      {
-      }
-   }
-
-   /**
-    * Ensure an baseDirectory is required to export.
-    * 
-    * @throws Exception
-    */
-   @Test
-   public void testExportExplodedRequiresBaseDirectroy() throws Exception
-   {
-      log.info("testExportExplodedRequiresBaseDirectroy");
-
-      try
-      {
-         ExplodedExporter.exportExploded(new MemoryMapArchiveImpl(), null);
-         Assert.fail("Should have thrown IllegalArgumentException");
-      }
-      catch (IllegalArgumentException expected)
-      {
-      }
-   }
-
-   /**
-    * Ensure an baseDirectory must exist is required to export.
-    * 
-    * @throws Exception
-    */
-   @Test
-   public void testExportExplodedRequiresExisitingDirectroy() throws Exception
-   {
-      log.info("testExportExplodedRequiresExisitingDirectroy");
-
-      try
-      {
-         final File directory = this.getNonexistantDirectory();
-         ExplodedExporter.exportExploded(new MemoryMapArchiveImpl(), directory);
-         Assert.fail("Should have thrown IllegalArgumentException");
-      }
-      catch (IllegalArgumentException expected)
-      {
-      }
-   }
-
-   /**
-    * Ensure an baseDirectory must be a directory.
-    * 
-    * @throws Exception
-    */
-   @Test
-   public void testExportExplodedRequiresExistingDirectory() throws Exception
-   {
-      log.info("testExportExplodedRequiresExistingDirectory");
-      try
-      {
-         final File directory = this.getNonexistantDirectory();
-         ExplodedExporter.exportExploded(new MemoryMapArchiveImpl(), directory);
-         Assert.fail("Should have thrown IllegalArgumentException");
-      }
-      catch (IllegalArgumentException expected)
-      {
-      }
-   }
-
-   /**
-    * Ensure ExpolodedExporter requires a directory
-    */
-   @Test
-   public void testExportExplodedRequiresValidDirectory() throws Exception
-   {
-      log.info("testExportExplodedRequiresValidDirectory");
-      try
-      {
-         final File nonDirectory = new File(this.getTarget(), "tempFile.txt");
-         nonDirectory.createNewFile();
-         ExplodedExporter.exportExploded(new MemoryMapArchiveImpl(), nonDirectory);
-         Assert.fail("Should have thrown IllegalArgumentException");
-      }
-      catch (IllegalArgumentException expected)
-      {
-      }
-   }
-
-   /**
-    * Ensure an ArchiveExportException is thrown when output directory can not be created
-    */
-   @Test
-   public void testExportExplodedOutpuDirCreationFails() throws Exception
-   {
-      log.info("testExportExplodedOutpuDirCreationFails");
-      try
-      {
-         final File directory = createTempDirectory("testExportExplodedOutpuDirCreationFails");
-         // Will cause the creation of Archive directory to fail
-         final File existingFile = new File(directory, NAME_ARCHIVE);
-         existingFile.createNewFile();
-         ExplodedExporter.exportExploded(new MemoryMapArchiveImpl(NAME_ARCHIVE), directory);
-         Assert.fail("Should have thrown ArchiveExportException");
-      }
-      catch (ArchiveExportException expected)
-      {
-      }
-   }
-
-   /**
-    * Ensure ArchiveException is thrown if Asset can not be written
-    */
-   @Test
-   public void testExportExplodedThrowsExceptionOnAssetWrite() throws Exception
-   {
-      log.info("testExportExplodedThrowsExceptionOnAssetWrite");
-      try
-      {
-         Archive<?> archive = createArchiveWithAssets();
-         archive.add(new BasicPath("badAsset"), new Asset()
-         {
-
-            @Override
-            public InputStream openStream()
-            {
-               throw new RuntimeException("Mock Esception getting Stream");
-            }
-
-         });
-         final File directory = createTempDirectory("testExportExplodedThrowsExceptionOnAssetWrite");
-
-         ExplodedExporter.exportExploded(archive, directory);
-         Assert.fail("Should have thrown ArchiveExportException");
-      }
-      catch (ArchiveExportException expected)
-      {
-      }
-   }
-
-   //-------------------------------------------------------------------------------------||
-   // Internal Helper Methods ------------------------------------------------------------||
-   //-------------------------------------------------------------------------------------||
-
-   /**
-    * Obtains a reference to a directory that does not exist
-    */
-   private File getNonexistantDirectory()
-   {
-      final File directory = new File(this.getTarget(), "someNonExistentDirectory");
-      if (directory.exists())
-      {
-         IOUtil.deleteDirectory(directory);
-      }
-      Assert.assertTrue("Precondition Failure: Directory should not exist: " + directory, !directory.exists());
-      return directory;
-   }
-
-   /**
-    * Assert an asset is actually in the exploded directory
-    * 
-    * @throws FileNotFoundException 
-    * @throws IOException 
-    * @throws IllegalArgumentException 
-    */
-   private void assertAssetInExploded(File explodedDirectory, Path path, Asset asset) throws FileNotFoundException
-   {
-      File assetFile = new File(explodedDirectory, path.get());
-      Assert.assertNotNull(assetFile);
-      Assert.assertTrue(assetFile.exists());
-      byte[] expectedContents = IOUtil.asByteArray(asset.openStream());
-
-      InputStream inputStream = new FileInputStream(assetFile);
-
-      byte[] actualContents = IOUtil.asByteArray(inputStream);
-      Assert.assertArrayEquals(expectedContents, actualContents);
-   }
-
-}

Copied: shrinkwrap/trunk/impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/exporter/ExplodedExporterTestCase.java (from rev 3667, shrinkwrap/trunk/impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/export/ExplodedExporterTestCase.java)
===================================================================
--- shrinkwrap/trunk/impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/exporter/ExplodedExporterTestCase.java	                        (rev 0)
+++ shrinkwrap/trunk/impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/exporter/ExplodedExporterTestCase.java	2009-11-11 14:58:48 UTC (rev 3668)
@@ -0,0 +1,245 @@
+/*
+ * JBoss, Home of Professional Open Source  
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.shrinkwrap.impl.base.exporter;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.logging.Logger;
+
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.Asset;
+import org.jboss.shrinkwrap.api.Path;
+import org.jboss.shrinkwrap.api.exporter.ArchiveExportException;
+import org.jboss.shrinkwrap.api.exporter.ExplodedExporter;
+import org.jboss.shrinkwrap.impl.base.MemoryMapArchiveImpl;
+import org.jboss.shrinkwrap.impl.base.io.IOUtil;
+import org.jboss.shrinkwrap.impl.base.path.BasicPath;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * ExplodedExporterTestCase
+ * 
+ * TestCase to ensure that the {@link ExplodedExporter} correctly exports archive.
+ *
+ * @author <a href="mailto:baileyje at gmail.com">John Bailey</a>
+ * @author <a href="mailto:aslak at conduct.no">Aslak Knutsen</a>
+ * @version $Revision: $
+ */
+public class ExplodedExporterTestCase extends ExportTestBase
+{
+
+   //-------------------------------------------------------------------------------------||
+   // Class Members ----------------------------------------------------------------------||
+   //-------------------------------------------------------------------------------------||
+
+   /**
+    * Logger
+    */
+   private static final Logger log = Logger.getLogger(ExplodedExporterTestCase.class.getName());
+
+   //-------------------------------------------------------------------------------------||
+   // Tests ------------------------------------------------------------------------------||
+   //-------------------------------------------------------------------------------------||
+
+   /**
+    * Ensure an archive can be exported to an exploded directory.
+    * 
+    * @throws Exception
+    */
+   @Test
+   public void testExportExploded() throws Exception
+   {
+      log.info("testExportExploded");
+
+      // Get a temp directory
+      File tempDirectory = createTempDirectory("testExportExploded");
+
+      // Get an archive instance
+      Archive<?> archive = createArchiveWithAssets();
+
+      // Export as Exploded directory
+      File explodedDirectory = archive.as(ExplodedExporter.class).exportExploded(tempDirectory);
+
+      // Validate the exploded directory was created 
+      Assert.assertNotNull(explodedDirectory);
+
+      // Assert the directory has the correct name
+      File expectedDirectory = new File(tempDirectory, archive.getName());
+      Assert.assertEquals(expectedDirectory, explodedDirectory);
+
+      // Validate entries were written out
+      assertAssetInExploded(explodedDirectory, PATH_ONE, ASSET_ONE);
+      assertAssetInExploded(explodedDirectory, PATH_TWO, ASSET_TWO);
+   }
+
+   /**
+    * Ensure an archive exported to an exploded directory properly explodes nested archives.
+    * 
+    * @throws Exception
+    */
+   @Test
+   public void testExportNestedExploded() throws Exception
+   {
+      log.info("testExportNestedExploded");
+
+      // Get a temp directory
+      File tempDirectory = createTempDirectory("testExportNestedExploded");
+
+      // Get an archive instance
+      Archive<?> archive = createArchiveWithNestedArchives();
+
+      // Export as Exploded directory
+      File explodedDirectory = archive.as(ExplodedExporter.class).exportExploded(tempDirectory);
+
+      // Validate the exploded directory was created 
+      Assert.assertNotNull(explodedDirectory);
+
+      // Assert the directory has the correct name
+      File expectedDirectory = new File(tempDirectory, archive.getName());
+      Assert.assertEquals(expectedDirectory, explodedDirectory);
+
+      // Validate nested archive entries were written out
+      Path nestedArchivePath = new BasicPath(NAME_NESTED_ARCHIVE);
+
+      assertAssetInExploded(explodedDirectory, new BasicPath(nestedArchivePath, PATH_ONE), ASSET_ONE);
+      assertAssetInExploded(explodedDirectory, new BasicPath(nestedArchivePath, PATH_TWO), ASSET_TWO);
+
+      Path nestedArchivePathTwo = new BasicPath(NESTED_PATH, NAME_NESTED_ARCHIVE_2);
+
+      assertAssetInExploded(explodedDirectory, new BasicPath(nestedArchivePathTwo, PATH_ONE), ASSET_ONE);
+      assertAssetInExploded(explodedDirectory, new BasicPath(nestedArchivePathTwo, PATH_TWO), ASSET_TWO);
+   }
+
+   /**
+    * Ensure an baseDirectory is required to export.
+    * 
+    * @throws Exception
+    */
+   @Test(expected = IllegalArgumentException.class)
+   public void testExportExplodedRequiresBaseDirectroy() throws Exception
+   {
+      log.info("testExportExplodedRequiresBaseDirectroy");
+
+      new MemoryMapArchiveImpl().as(ExplodedExporter.class).exportExploded(null);
+   }
+
+   /**
+    * Ensure an baseDirectory must exist is required to export.
+    * 
+    * @throws Exception
+    */
+   @Test(expected = IllegalArgumentException.class)
+   public void testExportExplodedRequiresExistingDirectory() throws Exception
+   {
+      log.info("testExportExplodedRequiresExisitingDirectroy");
+
+      final File directory = this.getNonexistantDirectory();
+      new MemoryMapArchiveImpl().as(ExplodedExporter.class).exportExploded(directory);
+   }
+
+   /**
+    * Ensure ExpolodedExporter requires a directory
+    */
+   @Test(expected = IllegalArgumentException.class)
+   public void testExportExplodedRequiresValidDirectory() throws Exception
+   {
+      log.info("testExportExplodedRequiresValidDirectory");
+      final File nonDirectory = new File(this.getTarget(), "tempFile.txt");
+      nonDirectory.createNewFile();
+      new MemoryMapArchiveImpl().as(ExplodedExporter.class).exportExploded(nonDirectory);
+   }
+
+   /**
+    * Ensure an ArchiveExportException is thrown when output directory can not be created
+    */
+   @Test(expected = ArchiveExportException.class)
+   public void testExportExplodedOutpuDirCreationFails() throws Exception
+   {
+      log.info("testExportExplodedOutpuDirCreationFails");
+      final File directory = createTempDirectory("testExportExplodedOutpuDirCreationFails");
+      // Will cause the creation of Archive directory to fail
+      final File existingFile = new File(directory, NAME_ARCHIVE);
+      existingFile.createNewFile();
+      new MemoryMapArchiveImpl(NAME_ARCHIVE).as(ExplodedExporter.class).exportExploded(directory);
+   }
+
+   /**
+    * Ensure ArchiveException is thrown if Asset can not be written
+    */
+   @Test(expected = ArchiveExportException.class)
+   public void testExportExplodedThrowsExceptionOnAssetWrite() throws Exception
+   {
+      log.info("testExportExplodedThrowsExceptionOnAssetWrite");
+      Archive<?> archive = createArchiveWithAssets();
+      archive.add(new Asset()
+      {
+
+         @Override
+         public InputStream openStream()
+         {
+            throw new RuntimeException("Mock Esception getting Stream");
+         }
+
+      }, new BasicPath("badAsset"));
+      final File directory = createTempDirectory("testExportExplodedThrowsExceptionOnAssetWrite");
+
+      archive.as(ExplodedExporter.class).exportExploded(directory);
+   }
+
+   //-------------------------------------------------------------------------------------||
+   // Internal Helper Methods ------------------------------------------------------------||
+   //-------------------------------------------------------------------------------------||
+
+   /**
+    * Obtains a reference to a directory that does not exist
+    */
+   private File getNonexistantDirectory()
+   {
+      final File directory = new File(this.getTarget(), "someNonExistentDirectory");
+      if (directory.exists())
+      {
+         IOUtil.deleteDirectory(directory);
+      }
+      Assert.assertTrue("Precondition Failure: Directory should not exist: " + directory, !directory.exists());
+      return directory;
+   }
+
+   /**
+    * Assert an asset is actually in the exploded directory
+    * 
+    * @throws FileNotFoundException 
+    * @throws IOException 
+    * @throws IllegalArgumentException 
+    */
+   private void assertAssetInExploded(File explodedDirectory, Path path, Asset asset) throws FileNotFoundException
+   {
+      File assetFile = new File(explodedDirectory, path.get());
+      Assert.assertNotNull(assetFile);
+      Assert.assertTrue(assetFile.exists());
+      byte[] expectedContents = IOUtil.asByteArray(asset.openStream());
+
+      InputStream inputStream = new FileInputStream(assetFile);
+
+      byte[] actualContents = IOUtil.asByteArray(inputStream);
+      Assert.assertArrayEquals(expectedContents, actualContents);
+   }
+
+}

Deleted: shrinkwrap/trunk/impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/exporter/ExportTestBase.java
===================================================================
--- shrinkwrap/trunk/impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/export/ExportTestBase.java	2009-10-14 15:22:40 UTC (rev 3600)
+++ shrinkwrap/trunk/impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/exporter/ExportTestBase.java	2009-11-11 14:58:48 UTC (rev 3668)
@@ -1,196 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.shrinkwrap.impl.base.export;
-
-import java.io.File;
-import java.net.URISyntaxException;
-import java.util.logging.Logger;
-
-import org.jboss.shrinkwrap.api.Archive;
-import org.jboss.shrinkwrap.api.Asset;
-import org.jboss.shrinkwrap.api.Path;
-import org.jboss.shrinkwrap.impl.base.MemoryMapArchiveImpl;
-import org.jboss.shrinkwrap.impl.base.asset.ClassLoaderAsset;
-import org.jboss.shrinkwrap.impl.base.io.IOUtil;
-import org.jboss.shrinkwrap.impl.base.path.BasicPath;
-import org.jboss.shrinkwrap.spi.MemoryMapArchive;
-import org.junit.Assert;
-
-/**
- * ExportTestBase
- * 
- * Base support for the exporter test cases 
- *
- * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
- * @author <a href="mailto:baileyje at gmail.com">John Bailey</a>
- * @version $Revision: $
- */
-public abstract class ExportTestBase
-{
-
-   //-------------------------------------------------------------------------------------||
-   // Class Members ----------------------------------------------------------------------||
-   //-------------------------------------------------------------------------------------||
-
-   /**
-    * Logger
-    */
-   private static final Logger log = Logger.getLogger(ExportTestBase.class.getName());
-
-   /**
-    * Name of an Archive
-    */
-   protected static final String NAME_ARCHIVE = "testArchive.jar";
-
-   /**
-    * Name of a properties file upon the test CP
-    */
-   protected static final String NAME_TEST_PROPERTIES = "org/jboss/shrinkwrap/impl/base/asset/Test.properties";
-
-   /**
-    * Name of another properties file upon the test CP
-    */
-   protected static final String NAME_TEST_PROPERTIES_2 = "org/jboss/shrinkwrap/impl/base/asset/Test2.properties";
-
-   /**
-    * Path of for nested content
-    */
-   protected static final Path NESTED_PATH = new BasicPath("nested");
-
-   /**
-    * Name of a nested archive
-    */
-   protected static final String NAME_NESTED_ARCHIVE = "nestedArchive.jar";
-
-   /**
-    * Name of another nested archive
-    */
-   protected static final String NAME_NESTED_ARCHIVE_2 = "nestedArchive2.jar";
-
-   /** 
-    * Asset used for testing
-    */
-   protected static final Asset ASSET_ONE = new ClassLoaderAsset(NAME_TEST_PROPERTIES);
-
-   /** 
-    * Path used for testing
-    */
-   protected static final Path PATH_ONE = new BasicPath("Test.properties");
-
-   /** 
-    * Another asset used for testing
-    */
-   protected static final Asset ASSET_TWO = new ClassLoaderAsset(NAME_TEST_PROPERTIES_2);
-
-   /** 
-   * Another path used for testing
-   */
-   protected static final Path PATH_TWO = new BasicPath(NESTED_PATH, "Test2.properties");
-
-   //-------------------------------------------------------------------------------------||
-   // Functional Methods -----------------------------------------------------------------||
-   //-------------------------------------------------------------------------------------||
-
-   /** 
-    * Returns a temp directory for a test.  Needs the test
-    */
-   protected File createTempDirectory(String testName) throws Exception
-   {
-      // Qualify the temp directory by test case
-      File tempDirectoryParent = new File(this.getTarget(), this.getClass().getSimpleName());
-      // Qualify the temp directory by test name
-      File tempDirectory = new File(tempDirectoryParent, testName);
-      log.info("Temp Directory: " + tempDirectory.getCanonicalPath());
-      if (tempDirectory.exists())
-      {
-         IOUtil.deleteDirectory(tempDirectory);
-      }
-      Assert.assertTrue("Temp directory should be clear before start", !tempDirectory.exists());
-      tempDirectory.mkdirs();
-      return tempDirectory;
-   }
-
-   /**
-    * Returns the target directory 
-    */
-   protected File getTarget()
-   {
-      try
-      {
-         return new File(new File(this.getClass().getProtectionDomain().getCodeSource().getLocation().toURI()), "../");
-      }
-      catch (final URISyntaxException urise)
-      {
-         throw new RuntimeException("Could not obtain the target URI", urise);
-      }
-   }
-
-   /**
-    * Create an archive instance and add some assets
-    */
-   protected Archive<?> createArchiveWithAssets()
-   {
-      // Create an archive
-      Archive<?> archive = new MemoryMapArchiveImpl(NAME_ARCHIVE);
-      // Add some content
-      addContent(archive);
-      // Return archive
-      return archive;
-   }
-
-   /**
-    * Create an archive instance and add some assets and some nested archives
-    */
-   protected Archive<?> createArchiveWithNestedArchives()
-   {
-      // Create an archive
-      Archive<?> archive = createArchiveWithAssets();
-
-      // Create a nested archive
-      MemoryMapArchive nestedArchive = new MemoryMapArchiveImpl(NAME_NESTED_ARCHIVE);
-
-      // Add some content
-      addContent(nestedArchive);
-
-      // Add nested archive
-      archive.add(new BasicPath(), nestedArchive);
-
-      // Add an archive nested in a directory
-      MemoryMapArchive nestedArchiveTwo = new MemoryMapArchiveImpl(NAME_NESTED_ARCHIVE_2);
-
-      // Add some content
-      addContent(nestedArchiveTwo);
-
-      // Add the archive under a nested path
-      archive.add(NESTED_PATH, nestedArchiveTwo);
-
-      // Return archive
-      return archive;
-   }
-
-   /**
-    * Add basic contents to the archive
-    * 
-    * @param archive
-    */
-   protected void addContent(Archive<?> archive)
-   {
-      archive.add(PATH_ONE, ASSET_ONE);
-      archive.add(PATH_TWO, ASSET_TWO);
-   }
-
-}

Copied: shrinkwrap/trunk/impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/exporter/ExportTestBase.java (from rev 3664, shrinkwrap/trunk/impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/export/ExportTestBase.java)
===================================================================
--- shrinkwrap/trunk/impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/exporter/ExportTestBase.java	                        (rev 0)
+++ shrinkwrap/trunk/impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/exporter/ExportTestBase.java	2009-11-11 14:58:48 UTC (rev 3668)
@@ -0,0 +1,196 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.shrinkwrap.impl.base.exporter;
+
+import java.io.File;
+import java.net.URISyntaxException;
+import java.util.logging.Logger;
+
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.Asset;
+import org.jboss.shrinkwrap.api.Path;
+import org.jboss.shrinkwrap.impl.base.MemoryMapArchiveImpl;
+import org.jboss.shrinkwrap.impl.base.asset.ClassLoaderAsset;
+import org.jboss.shrinkwrap.impl.base.io.IOUtil;
+import org.jboss.shrinkwrap.impl.base.path.BasicPath;
+import org.jboss.shrinkwrap.spi.MemoryMapArchive;
+import org.junit.Assert;
+
+/**
+ * ExportTestBase
+ * 
+ * Base support for the exporter test cases 
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @author <a href="mailto:baileyje at gmail.com">John Bailey</a>
+ * @version $Revision: $
+ */
+public abstract class ExportTestBase
+{
+
+   //-------------------------------------------------------------------------------------||
+   // Class Members ----------------------------------------------------------------------||
+   //-------------------------------------------------------------------------------------||
+
+   /**
+    * Logger
+    */
+   private static final Logger log = Logger.getLogger(ExportTestBase.class.getName());
+
+   /**
+    * Name of an Archive
+    */
+   protected static final String NAME_ARCHIVE = "testArchive.jar";
+
+   /**
+    * Name of a properties file upon the test CP
+    */
+   protected static final String NAME_TEST_PROPERTIES = "org/jboss/shrinkwrap/impl/base/asset/Test.properties";
+
+   /**
+    * Name of another properties file upon the test CP
+    */
+   protected static final String NAME_TEST_PROPERTIES_2 = "org/jboss/shrinkwrap/impl/base/asset/Test2.properties";
+
+   /**
+    * Path of for nested content
+    */
+   protected static final Path NESTED_PATH = new BasicPath("nested");
+
+   /**
+    * Name of a nested archive
+    */
+   protected static final String NAME_NESTED_ARCHIVE = "nestedArchive.jar";
+
+   /**
+    * Name of another nested archive
+    */
+   protected static final String NAME_NESTED_ARCHIVE_2 = "nestedArchive2.jar";
+
+   /** 
+    * Asset used for testing
+    */
+   protected static final Asset ASSET_ONE = new ClassLoaderAsset(NAME_TEST_PROPERTIES);
+
+   /** 
+    * Path used for testing
+    */
+   protected static final Path PATH_ONE = new BasicPath("Test.properties");
+
+   /** 
+    * Another asset used for testing
+    */
+   protected static final Asset ASSET_TWO = new ClassLoaderAsset(NAME_TEST_PROPERTIES_2);
+
+   /** 
+   * Another path used for testing
+   */
+   protected static final Path PATH_TWO = new BasicPath(NESTED_PATH, "Test2.properties");
+
+   //-------------------------------------------------------------------------------------||
+   // Functional Methods -----------------------------------------------------------------||
+   //-------------------------------------------------------------------------------------||
+
+   /** 
+    * Returns a temp directory for a test.  Needs the test
+    */
+   protected File createTempDirectory(String testName) throws Exception
+   {
+      // Qualify the temp directory by test case
+      File tempDirectoryParent = new File(this.getTarget(), this.getClass().getSimpleName());
+      // Qualify the temp directory by test name
+      File tempDirectory = new File(tempDirectoryParent, testName);
+      log.info("Temp Directory: " + tempDirectory.getCanonicalPath());
+      if (tempDirectory.exists())
+      {
+         IOUtil.deleteDirectory(tempDirectory);
+      }
+      Assert.assertTrue("Temp directory should be clear before start", !tempDirectory.exists());
+      tempDirectory.mkdirs();
+      return tempDirectory;
+   }
+
+   /**
+    * Returns the target directory 
+    */
+   protected File getTarget()
+   {
+      try
+      {
+         return new File(new File(this.getClass().getProtectionDomain().getCodeSource().getLocation().toURI()), "../");
+      }
+      catch (final URISyntaxException urise)
+      {
+         throw new RuntimeException("Could not obtain the target URI", urise);
+      }
+   }
+
+   /**
+    * Create an archive instance and add some assets
+    */
+   protected Archive<?> createArchiveWithAssets()
+   {
+      // Create an archive
+      Archive<?> archive = new MemoryMapArchiveImpl(NAME_ARCHIVE);
+      // Add some content
+      addContent(archive);
+      // Return archive
+      return archive;
+   }
+
+   /**
+    * Create an archive instance and add some assets and some nested archives
+    */
+   protected Archive<?> createArchiveWithNestedArchives()
+   {
+      // Create an archive
+      Archive<?> archive = createArchiveWithAssets();
+
+      // Create a nested archive
+      MemoryMapArchive nestedArchive = new MemoryMapArchiveImpl(NAME_NESTED_ARCHIVE);
+
+      // Add some content
+      addContent(nestedArchive);
+
+      // Add nested archive
+      archive.add(nestedArchive, new BasicPath());
+
+      // Add an archive nested in a directory
+      MemoryMapArchive nestedArchiveTwo = new MemoryMapArchiveImpl(NAME_NESTED_ARCHIVE_2);
+
+      // Add some content
+      addContent(nestedArchiveTwo);
+
+      // Add the archive under a nested path
+      archive.add(nestedArchiveTwo, NESTED_PATH);
+
+      // Return archive
+      return archive;
+   }
+
+   /**
+    * Add basic contents to the archive
+    * 
+    * @param archive
+    */
+   protected void addContent(Archive<?> archive)
+   {
+      archive.add(ASSET_ONE, PATH_ONE);
+      archive.add(ASSET_TWO, PATH_TWO);
+   }
+
+}

Deleted: 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/export/ZipExporterTestCase.java	2009-10-14 15:22:40 UTC (rev 3600)
+++ shrinkwrap/trunk/impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/exporter/ZipExporterTestCase.java	2009-11-11 14:58:48 UTC (rev 3668)
@@ -1,247 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source  
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.shrinkwrap.impl.base.export;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.logging.Logger;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipFile;
-
-import org.jboss.shrinkwrap.api.Archive;
-import org.jboss.shrinkwrap.api.Asset;
-import org.jboss.shrinkwrap.api.Path;
-import org.jboss.shrinkwrap.api.export.ArchiveExportException;
-import org.jboss.shrinkwrap.api.export.ZipExporter;
-import org.jboss.shrinkwrap.impl.base.io.IOUtil;
-import org.jboss.shrinkwrap.impl.base.path.BasicPath;
-import org.junit.Assert;
-import org.junit.Test;
-
-/**
- * ZipExporterTestCase
- * 
- * TestCase to ensure that the {@link ZipExporter} correctly exports archives to Zip format.
- *
- * @author <a href="mailto:baileyje at gmail.com">John Bailey</a>
- * @version $Revision: $
- */
-public class ZipExporterTestCase extends ExportTestBase
-{
-   //-------------------------------------------------------------------------------------||
-   // Class Members ----------------------------------------------------------------------||
-   //-------------------------------------------------------------------------------------||
-
-   /**
-    * Logger
-    */
-   private static final Logger log = Logger.getLogger(ZipExporterTestCase.class.getName());
-
-   //-------------------------------------------------------------------------------------||
-   // Tests ------------------------------------------------------------------------------||
-   //-------------------------------------------------------------------------------------||
-
-   /**
-    * Test to make sue an archive can be exported to Zip and all contents are correctly located in the Zip.
-    * @throws Exception
-    */
-   @Test
-   public void testExportZip() throws Exception
-   {
-      log.info("testExportZip");
-
-      // Get a temp directory for the test
-      File tempDirectory = createTempDirectory("testExportZip");
-
-      // Get an archive instance
-      Archive<?> archive = createArchiveWithAssets();
-
-      // Export as Zip InputStream
-      InputStream zipStream = ZipExporter.exportZip(archive);
-
-      // Write zip content to temporary file 
-      ZipFile expectedZip = getExportedZipFile(NAME_ARCHIVE, zipStream, tempDirectory);
-
-      // Validate entries were written out
-      assertAssetInZip(expectedZip, PATH_ONE, ASSET_ONE);
-      assertAssetInZip(expectedZip, PATH_TWO, ASSET_TWO);
-
-   }
-
-   /**
-    * Test to make sue an archive can be exported to Zip and nested archives are also in exported as nested Zip.
-    * @throws Exception
-    */
-   @Test
-   public void testExportNestedZip() throws Exception
-   {
-      log.info("testExportNestedZip");
-
-      // Get a temp directory for the test
-      File tempDirectory = createTempDirectory("testExportNestedZip");
-
-      // Get an archive instance
-      Archive<?> archive = createArchiveWithNestedArchives();
-
-      // Export as Zip InputStream
-      InputStream zipStream = ZipExporter.exportZip(archive);
-
-      // Write out and retrieve Zip 
-      ZipFile expectedZip = getExportedZipFile(NAME_ARCHIVE, zipStream, tempDirectory);
-
-      // Validate entries were written out
-      assertAssetInZip(expectedZip, PATH_ONE, ASSET_ONE);
-      assertAssetInZip(expectedZip, PATH_TWO, ASSET_TWO);
-
-      // Validate nested archive entries were written out
-      Path nestedArchivePath = new BasicPath(NAME_NESTED_ARCHIVE);
-
-      // Get Zip entry path
-      String nestedArchiveZipEntryPath = ZipExporterUtil.toZipEntryPath(nestedArchivePath);
-
-      // Get nested archive entry from exported zip
-      ZipEntry nestedArchiveEntry = expectedZip.getEntry(nestedArchiveZipEntryPath);
-
-      // Get inputstream for entry 
-      InputStream nesterArchiveStream = expectedZip.getInputStream(nestedArchiveEntry);
-
-      // Write out and retrieve nested Zip
-      ZipFile nestedZip = getExportedZipFile(NAME_NESTED_ARCHIVE, nesterArchiveStream, tempDirectory);
-
-      assertAssetInZip(nestedZip, PATH_ONE, ASSET_ONE);
-      assertAssetInZip(nestedZip, PATH_TWO, ASSET_TWO);
-
-      // Validate nested archive entries were written out
-      Path nestedArchiveTwoPath = new BasicPath(NESTED_PATH, NAME_NESTED_ARCHIVE_2);
-
-      // Get Zip entry path
-      String nestedArchiveTwoZipEntryPath = ZipExporterUtil.toZipEntryPath(nestedArchiveTwoPath);
-
-      // Get second nested archive entry from exported zip
-      ZipEntry nestedArchiveTwoEntry = expectedZip.getEntry(nestedArchiveTwoZipEntryPath);
-
-      // Get inputstream for entry 
-      InputStream nesterArchiveTwoStream = expectedZip.getInputStream(nestedArchiveTwoEntry);
-
-      // Write out and retrieve second nested Zip
-      ZipFile nestedZipTwo = getExportedZipFile(NAME_NESTED_ARCHIVE_2, nesterArchiveTwoStream, tempDirectory);
-
-      assertAssetInZip(nestedZipTwo, PATH_ONE, ASSET_ONE);
-      assertAssetInZip(nestedZipTwo, PATH_TWO, ASSET_TWO);
-
-   }
-
-   /**
-    * Ensure an archive is required to export.
-    * 
-    * @throws Exception
-    */
-   @Test
-   public void testExportZipRequiresArchive() throws Exception
-   {
-      log.info("testExportZipRequiresArchive");
-      try
-      {
-         ZipExporter.exportZip(null);
-         Assert.fail("Should have thrown IllegalArgumentException");
-      }
-      catch (IllegalArgumentException expected)
-      {
-      }
-   }
-
-   @Test
-   public void testExportThrowsArchiveExcepitonOnAssetWriteFailure()
-   {
-      log.info("testExportThrowsArchiveExcepitonOnAssetWriteFailure");
-      try
-      {
-         Archive<?> archive = createArchiveWithAssets();
-
-         archive.add(PATH_ONE, new Asset()
-         {
-
-            @Override
-            public InputStream openStream()
-            {
-               throw new RuntimeException("Mock Exception from an Asset write");
-            }
-
-         });
-
-         ZipExporter.exportZip(archive);
-         Assert.fail("Should have thrown ArchiveExportException");
-      }
-      catch (ArchiveExportException expected)
-      {
-      }
-   }
-
-   //-------------------------------------------------------------------------------------||
-   // Internal Helper Methods ------------------------------------------------------------||
-   //-------------------------------------------------------------------------------------||
-
-   private ZipFile getExportedZipFile(String archiveName, InputStream zipStream, File tempDirectory) throws Exception
-   {
-
-      // Validate the InputStream was created 
-      Assert.assertNotNull(zipStream);
-
-      // Create a temp file
-      File outFile = new File(tempDirectory, archiveName);
-
-      // Write Zip contents to file
-      writeOutFile(outFile, zipStream);
-
-      // Use standard ZipFile library to read in written Zip file
-      ZipFile expectedZip = new ZipFile(outFile);
-
-      return expectedZip;
-   }
-
-   /**
-    * Assert an asset is actually in the Zip file
-    * @throws IOException 
-    * @throws IllegalArgumentException 
-    */
-   private void assertAssetInZip(ZipFile expectedZip, Path path, Asset asset) throws IllegalArgumentException,
-         IOException
-   {
-      String entryPath = ZipExporterUtil.toZipEntryPath(path);
-      ZipEntry entry = expectedZip.getEntry(entryPath);
-      Assert.assertNotNull(entry);
-      byte[] expectedContents = IOUtil.asByteArray(asset.openStream());
-      byte[] actualContents = IOUtil.asByteArray(expectedZip.getInputStream(entry));
-      Assert.assertArrayEquals(expectedContents, actualContents);
-   }
-
-   /**
-    * Write a InputStream out to file.
-    * @param outFile
-    * @param zipInputStream
-    * @throws Exception
-    */
-   private void writeOutFile(File outFile, InputStream inputStream) throws Exception
-   {
-      OutputStream fileOutputStream = new FileOutputStream(outFile);
-      IOUtil.copyWithClose(inputStream, fileOutputStream);
-   }
-
-}

Copied: shrinkwrap/trunk/impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/exporter/ZipExporterTestCase.java (from rev 3667, shrinkwrap/trunk/impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/export/ZipExporterTestCase.java)
===================================================================
--- shrinkwrap/trunk/impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/exporter/ZipExporterTestCase.java	                        (rev 0)
+++ shrinkwrap/trunk/impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/exporter/ZipExporterTestCase.java	2009-11-11 14:58:48 UTC (rev 3668)
@@ -0,0 +1,223 @@
+/*
+ * JBoss, Home of Professional Open Source  
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.shrinkwrap.impl.base.exporter;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.logging.Logger;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
+
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.Asset;
+import org.jboss.shrinkwrap.api.Path;
+import org.jboss.shrinkwrap.api.exporter.ArchiveExportException;
+import org.jboss.shrinkwrap.api.exporter.ZipExporter;
+import org.jboss.shrinkwrap.impl.base.exporter.ZipExporterUtil;
+import org.jboss.shrinkwrap.impl.base.io.IOUtil;
+import org.jboss.shrinkwrap.impl.base.path.BasicPath;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * ZipExporterTestCase
+ * 
+ * TestCase to ensure that the {@link ZipExporter} correctly exports archives to Zip format.
+ *
+ * @author <a href="mailto:baileyje at gmail.com">John Bailey</a>
+ * @author <a href="mailto:aslak at conduct.no">Aslak Knutsen</a>
+ * @version $Revision: $
+ */
+public class ZipExporterTestCase extends ExportTestBase
+{
+   //-------------------------------------------------------------------------------------||
+   // Class Members ----------------------------------------------------------------------||
+   //-------------------------------------------------------------------------------------||
+
+   /**
+    * Logger
+    */
+   private static final Logger log = Logger.getLogger(ZipExporterTestCase.class.getName());
+
+   //-------------------------------------------------------------------------------------||
+   // Tests ------------------------------------------------------------------------------||
+   //-------------------------------------------------------------------------------------||
+
+   /**
+    * Test to make sue an archive can be exported to Zip and all contents are correctly located in the Zip.
+    * @throws Exception
+    */
+   @Test
+   public void testExportZip() throws Exception
+   {
+      log.info("testExportZip");
+
+      // Get a temp directory for the test
+      File tempDirectory = createTempDirectory("testExportZip");
+
+      // Get an archive instance
+      Archive<?> archive = createArchiveWithAssets();
+
+      // Export as Zip InputStream
+      InputStream zipStream = archive.as(ZipExporter.class).exportZip();
+
+      // Write zip content to temporary file 
+      ZipFile expectedZip = getExportedZipFile(NAME_ARCHIVE, zipStream, tempDirectory);
+
+      // Validate entries were written out
+      assertAssetInZip(expectedZip, PATH_ONE, ASSET_ONE);
+      assertAssetInZip(expectedZip, PATH_TWO, ASSET_TWO);
+
+   }
+
+   /**
+    * Test to make sue an archive can be exported to Zip and nested archives are also in exported as nested Zip.
+    * @throws Exception
+    */
+   @Test
+   public void testExportNestedZip() throws Exception
+   {
+      log.info("testExportNestedZip");
+
+      // Get a temp directory for the test
+      File tempDirectory = createTempDirectory("testExportNestedZip");
+
+      // Get an archive instance
+      Archive<?> archive = createArchiveWithNestedArchives();
+
+      // Export as Zip InputStream
+      InputStream zipStream = archive.as(ZipExporter.class).exportZip();
+
+      // Write out and retrieve Zip 
+      ZipFile expectedZip = getExportedZipFile(NAME_ARCHIVE, zipStream, tempDirectory);
+
+      // Validate entries were written out
+      assertAssetInZip(expectedZip, PATH_ONE, ASSET_ONE);
+      assertAssetInZip(expectedZip, PATH_TWO, ASSET_TWO);
+
+      // Validate nested archive entries were written out
+      Path nestedArchivePath = new BasicPath(NAME_NESTED_ARCHIVE);
+
+      // Get Zip entry path
+      String nestedArchiveZipEntryPath = ZipExporterUtil.toZipEntryPath(nestedArchivePath);
+
+      // Get nested archive entry from exported zip
+      ZipEntry nestedArchiveEntry = expectedZip.getEntry(nestedArchiveZipEntryPath);
+
+      // Get inputstream for entry 
+      InputStream nesterArchiveStream = expectedZip.getInputStream(nestedArchiveEntry);
+
+      // Write out and retrieve nested Zip
+      ZipFile nestedZip = getExportedZipFile(NAME_NESTED_ARCHIVE, nesterArchiveStream, tempDirectory);
+
+      assertAssetInZip(nestedZip, PATH_ONE, ASSET_ONE);
+      assertAssetInZip(nestedZip, PATH_TWO, ASSET_TWO);
+
+      // Validate nested archive entries were written out
+      Path nestedArchiveTwoPath = new BasicPath(NESTED_PATH, NAME_NESTED_ARCHIVE_2);
+
+      // Get Zip entry path
+      String nestedArchiveTwoZipEntryPath = ZipExporterUtil.toZipEntryPath(nestedArchiveTwoPath);
+
+      // Get second nested archive entry from exported zip
+      ZipEntry nestedArchiveTwoEntry = expectedZip.getEntry(nestedArchiveTwoZipEntryPath);
+
+      // Get inputstream for entry 
+      InputStream nesterArchiveTwoStream = expectedZip.getInputStream(nestedArchiveTwoEntry);
+
+      // Write out and retrieve second nested Zip
+      ZipFile nestedZipTwo = getExportedZipFile(NAME_NESTED_ARCHIVE_2, nesterArchiveTwoStream, tempDirectory);
+
+      assertAssetInZip(nestedZipTwo, PATH_ONE, ASSET_ONE);
+      assertAssetInZip(nestedZipTwo, PATH_TWO, ASSET_TWO);
+
+   }
+
+   @Test(expected = ArchiveExportException.class)
+   public void testExportThrowsArchiveExcepitonOnAssetWriteFailure()
+   {
+      log.info("testExportThrowsArchiveExcepitonOnAssetWriteFailure");
+      Archive<?> archive = createArchiveWithAssets();
+
+      archive.add(new Asset()
+      {
+
+         @Override
+         public InputStream openStream()
+         {
+            throw new RuntimeException("Mock Exception from an Asset write");
+         }
+
+      }, PATH_ONE);
+
+      archive.as(ZipExporter.class).exportZip();
+   }
+
+   //-------------------------------------------------------------------------------------||
+   // Internal Helper Methods ------------------------------------------------------------||
+   //-------------------------------------------------------------------------------------||
+
+   private ZipFile getExportedZipFile(String archiveName, InputStream zipStream, File tempDirectory) throws Exception
+   {
+
+      // Validate the InputStream was created 
+      Assert.assertNotNull(zipStream);
+
+      // Create a temp file
+      File outFile = new File(tempDirectory, archiveName);
+
+      // Write Zip contents to file
+      writeOutFile(outFile, zipStream);
+
+      // Use standard ZipFile library to read in written Zip file
+      ZipFile expectedZip = new ZipFile(outFile);
+
+      return expectedZip;
+   }
+
+   /**
+    * Assert an asset is actually in the Zip file
+    * @throws IOException 
+    * @throws IllegalArgumentException 
+    */
+   private void assertAssetInZip(ZipFile expectedZip, Path path, Asset asset) throws IllegalArgumentException,
+         IOException
+   {
+      String entryPath = ZipExporterUtil.toZipEntryPath(path);
+      ZipEntry entry = expectedZip.getEntry(entryPath);
+      Assert.assertNotNull(entry);
+      byte[] expectedContents = IOUtil.asByteArray(asset.openStream());
+      byte[] actualContents = IOUtil.asByteArray(expectedZip.getInputStream(entry));
+      Assert.assertArrayEquals(expectedContents, actualContents);
+   }
+
+   /**
+    * Write a InputStream out to file.
+    * @param outFile
+    * @param zipInputStream
+    * @throws Exception
+    */
+   private void writeOutFile(File outFile, InputStream inputStream) throws Exception
+   {
+      OutputStream fileOutputStream = new FileOutputStream(outFile);
+      IOUtil.copyWithClose(inputStream, fileOutputStream);
+   }
+
+}

Modified: shrinkwrap/trunk/impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/importer/ZipImporterImplTestCase.java
===================================================================
--- shrinkwrap/trunk/impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/importer/ZipImporterImplTestCase.java	2009-11-11 14:47:18 UTC (rev 3667)
+++ shrinkwrap/trunk/impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/importer/ZipImporterImplTestCase.java	2009-11-11 14:58:48 UTC (rev 3668)
@@ -31,7 +31,7 @@
 import junit.framework.Assert;
 
 import org.jboss.shrinkwrap.api.Archive;
-import org.jboss.shrinkwrap.api.export.ZipExporter;
+import org.jboss.shrinkwrap.api.exporter.ZipExporter;
 import org.jboss.shrinkwrap.api.importer.ZipImporter;
 import org.jboss.shrinkwrap.api.spec.JavaArchive;
 import org.jboss.shrinkwrap.impl.base.Archives;



More information about the jboss-svn-commits mailing list