Index: impl-base/src/test/java/org/jboss/shrinkwrap/api/ExtensionTypeExposer.java
===================================================================
--- impl-base/src/test/java/org/jboss/shrinkwrap/api/ExtensionTypeExposer.java	(revision )
+++ impl-base/src/test/java/org/jboss/shrinkwrap/api/ExtensionTypeExposer.java	(revision )
@@ -0,0 +1,48 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, 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;
+
+/**
+ * ExtensionTypeExposer
+ * This class is a utility that helps expose the toString of package private class {@link ExtensionType} 
+ *
+ * @author <a href="mailto:ken@glxn.net">Ken Gullaksen</a>
+ * @version $Revision: $
+ */
+public class ExtensionTypeExposer
+{
+   public static String WARExtensionTypeToString()
+   {
+      return ExtensionType.WAR.toString();
+   }
+
+   public static String EARExtensionTypeToString()
+   {
+      return ExtensionType.EAR.toString();
+   }
+
+   public static String JARExtensionTypeToString()
+   {
+      return ExtensionType.JAR.toString();
+   }
+
+   public static String RARExtensionTypeToString()
+   {
+      return ExtensionType.RAR.toString();
+   }
+}
Index: api/src/main/java/org/jboss/shrinkwrap/api/ArchiveFactory.java
===================================================================
--- api/src/main/java/org/jboss/shrinkwrap/api/ArchiveFactory.java	(revision 4266)
+++ api/src/main/java/org/jboss/shrinkwrap/api/ArchiveFactory.java	(revision )
@@ -16,10 +16,13 @@
  */
 package org.jboss.shrinkwrap.api;
 
+import java.util.UUID;
+
 /**
  * 
  *
  * @author <a href="mailto:andrew.rubinger@jboss.org">ALR</a>
+ * @author <a href="mailto:ken@glxn.net">Ken Gullaksen</a>
  * @version $Revision: $
  */
 public final class ArchiveFactory
@@ -50,7 +53,8 @@
     * Creates a new {@link ArchiveFactory} which will use the supplied 
     * {@link Configuration} for each new {@link Archive} it creates.
     * 
-    * @param configuration
+    * @param configuration the {@link Configuration} to use
+    * @throws IllegalArgumentException if configuration is not supplied
     */
    ArchiveFactory(final Configuration configuration) throws IllegalArgumentException
    {
@@ -69,23 +73,75 @@
     * Creates a new archive of the specified type.  The archive
     * will be be backed by the {@link Configuration}
     * specific to this {@link ArchiveFactory}.
-    * 
+    *
+    * Deprecated as part of SHRINKWRAP-163
+    * Use {@link ArchiveFactory#create(Class, String)} instead.
+    *
     * @param archiveName The name of the archive
+    * @param type The type of the archive e.g. {@link org.jboss.shrinkwrap.api.spec.WebArchive}
-    * @return An {@link Assignable} archive base  
+    * @return An {@link Assignable} archive base
     * @throws IllegalArgumentException If either argument is not specified
     */
+   @Deprecated
    public <T extends Assignable> T create(final String archiveName, final Class<T> type)
          throws IllegalArgumentException
    {
+      return create(type, archiveName);
+   }
+
+   /**
+    * Creates a new archive of the specified type.  The archive
+    * will be be backed by the {@link Configuration}
+    * specific to this {@link ArchiveFactory}.
+    * Generates a random name for the archive and adds proper extension based on the type.
+    * If no extension is found for the given type an exception is thrown.
+    *
+    * @param type The type of the archive e.g. {@link org.jboss.shrinkwrap.api.spec.WebArchive}
+    * @return An {@link Assignable} archive base
+    * @throws IllegalArgumentException if type is not specified
+    */
+   public <T extends Assignable> T create(final Class<T> type)
+      throws IllegalArgumentException
+   {
       // Precondition checks
-      if (archiveName == null)
+      if (type == null)
       {
-         throw new IllegalArgumentException("ArchiveName must be specified");
+         throw new IllegalArgumentException("Type must be specified");
       }
+
+      String archiveName = UUID.randomUUID().toString();
+
+      ExtensionType extensionType = configuration.getExtensionMapping().get(type);
+      if (extensionType == null) {
+         throw new RuntimeException("The current configuration has no mapping for type " + type.getCanonicalName() +
+            ", unable to determine extension. Either add a mapping via Configuration.getExtensionMapping or manually assign a name.");
+      }
+      
+      return create(type, archiveName += extensionType);
+   }
+
+   /**
+    * Creates a new archive of the specified type.  The archive
+    * will be be backed by the {@link Configuration}
+    * specific to this {@link ArchiveFactory}.
+    *
+    * @param type The type of the archive e.g. {@link org.jboss.shrinkwrap.api.spec.WebArchive}
+    * @param archiveName the archiveName to use
+    * @return An {@link Assignable} archive base
+    * @throws IllegalArgumentException either argument is not supplied
+    */
+   public <T extends Assignable> T create(final Class<T> type, final String archiveName)
+      throws IllegalArgumentException
+   {
+      // Precondition checks
       if (type == null)
       {
          throw new IllegalArgumentException("Type must be specified");
       }
+      if (archiveName == null)
+      {
+         throw new IllegalArgumentException("ArchiveName must be specified");
+      }
 
       final Archive<?> archive = SecurityActions.newInstance(ARCHIVE_IMPL, new Class<?>[]
       {String.class, Configuration.class}, new Object[]
Index: impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/ShrinkWrapTestCase.java
===================================================================
--- impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/ShrinkWrapTestCase.java	(revision 4311)
+++ impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/ShrinkWrapTestCase.java	(revision )
@@ -22,17 +22,12 @@
 import junit.framework.Assert;
 import junit.framework.TestCase;
 
-import org.jboss.shrinkwrap.api.Archive;
-import org.jboss.shrinkwrap.api.ArchivePath;
-import org.jboss.shrinkwrap.api.ArchivePaths;
-import org.jboss.shrinkwrap.api.Assignable;
-import org.jboss.shrinkwrap.api.Configuration;
-import org.jboss.shrinkwrap.api.ConfigurationBuilder;
-import org.jboss.shrinkwrap.api.Domain;
-import org.jboss.shrinkwrap.api.ExtensionLoader;
-import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.*;
 import org.jboss.shrinkwrap.api.formatter.Formatter;
+import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
 import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.jboss.shrinkwrap.api.spec.ResourceAdapterArchive;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
 import org.jboss.shrinkwrap.impl.base.container.ContainerBase;
 import org.junit.Test;
 
@@ -58,7 +53,7 @@
    public void createNewArchiveUnderDefaultDomain()
    {
       final String archiveName = "test.war";
-      final JavaArchive archive = ShrinkWrap.create(archiveName, JavaArchive.class);
+      final JavaArchive archive = ShrinkWrap.create(JavaArchive.class, archiveName);
 
       // Test
       Assert.assertNotNull("A archive should have been created", archive);
@@ -183,13 +178,78 @@
    {
       final Domain domain = ShrinkWrap.createDomain();
       domain.getConfiguration().getExtensionLoader().addOverride(JavaArchive.class, MockJavaArchiveImpl.class);
-      final JavaArchive archive = domain.getArchiveFactory().create("test.jar", JavaArchive.class);
+      final JavaArchive archive = domain.getArchiveFactory().create(JavaArchive.class,"test.jar");
 
       Assert.assertEquals("Should have overridden normal JavaArchive impl", MockJavaArchiveImpl.class, archive
             .getClass());
 
    }
 
+   @Test
+   public void shouldCreateArchiveWithCorrectExtensionForJavaArchive() throws Exception
+   {
+      JavaArchive javaArchive = ShrinkWrap.create(JavaArchive.class);
+      String archiveExtension = javaArchive.getName().substring(javaArchive.getName().lastIndexOf("."));
+      Assert.assertEquals("JavaArchive should have proper extension", ExtensionTypeExposer.JARExtensionTypeToString(), archiveExtension);
+   }
+
+   @Test
+   public void shouldCreateJavaArchiveWithGivenName() throws Exception
+   {
+      String archiveName = "testArchive";
+      JavaArchive javaArchive = ShrinkWrap.create(JavaArchive.class, archiveName);
+      Assert.assertEquals("JavaArchive should have given name", archiveName, javaArchive.getName());
+   }
+
+   @Test
+   public void shouldCreateArchiveWithCorrectExtensionForWebArchive() throws Exception
+   {
+      WebArchive webArchive = ShrinkWrap.create(WebArchive.class);
+      String archiveExtension = webArchive.getName().substring(webArchive.getName().lastIndexOf("."));
+      Assert.assertEquals("WebArchive should have proper extension", ExtensionTypeExposer.WARExtensionTypeToString(), archiveExtension);
+   }
+
+   @Test
+   public void shouldCreateWebArchiveWithGivenName() throws Exception
+   {
+      String archiveName = "testArchive";
+      WebArchive webArchive = ShrinkWrap.create(WebArchive.class, archiveName);
+      Assert.assertEquals("WebArchive should have given name", archiveName, webArchive.getName());
+   }
+
+   @Test
+   public void shouldCreateArchiveWithCorrectExtensionForEnterpriseArchive() throws Exception
+   {
+      EnterpriseArchive enterpriseArchive = ShrinkWrap.create(EnterpriseArchive.class);
+      String archiveExtension = enterpriseArchive.getName().substring(enterpriseArchive.getName().lastIndexOf("."));
+      Assert.assertEquals("EnterpriseArchive should have proper extension", ExtensionTypeExposer.EARExtensionTypeToString(), archiveExtension);
+   }
+
+   @Test
+   public void shouldCreateEnterpriseArchiveWithGivenName() throws Exception
+   {
+      String archiveName = "testArchive";
+      EnterpriseArchive enterpriseArchive = ShrinkWrap.create(EnterpriseArchive.class, archiveName);
+      Assert.assertEquals("EnterpriseArchive should have given name", archiveName, enterpriseArchive.getName());
+   }
+
+   @Test
+   public void shouldCreateArchiveWithCorrectExtensionForResourceAdapterArchive() throws Exception
+   {
+      ResourceAdapterArchive resourceAdapterArchive = ShrinkWrap.create(ResourceAdapterArchive.class);
+      String archiveExtension = resourceAdapterArchive.getName().substring(resourceAdapterArchive.getName().lastIndexOf("."));
+      Assert.assertEquals("ResourceAdapterArchive should have proper extension", ExtensionTypeExposer.RARExtensionTypeToString(), archiveExtension);
+   }
+   
+   @Test
+   public void shouldCreateResourceAdapterArchiveWithGivenName() throws Exception
+   {
+      String archiveName = "testArchive";
+      ResourceAdapterArchive resourceAdapterArchive = ShrinkWrap.create(ResourceAdapterArchive.class, archiveName);
+      Assert.assertEquals("ResourceAdapterArchive should have given name", archiveName, resourceAdapterArchive.getName());
+   }
+
+
    //-------------------------------------------------------------------------------------||
    // Internal Helper Members ------------------------------------------------------------||
    //-------------------------------------------------------------------------------------||
Index: api/src/main/java/org/jboss/shrinkwrap/api/ExtensionType.java
===================================================================
--- api/src/main/java/org/jboss/shrinkwrap/api/ExtensionType.java	(revision )
+++ api/src/main/java/org/jboss/shrinkwrap/api/ExtensionType.java	(revision )
@@ -0,0 +1,46 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, 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;
+
+/**
+ * ExtensionType
+ * Class to help provide correct extension in {@link ArchiveFactory#create(Class)} 
+ *
+ * @author <a href="mailto:ken@glxn.net">Ken Gullaksen</a>
+ * @version $Revision: $
+ */
+class ExtensionType
+{
+   static final ExtensionType WAR = new ExtensionType("war");
+   static final ExtensionType JAR = new ExtensionType("jar");
+   static final ExtensionType EAR = new ExtensionType("ear");
+   static final ExtensionType RAR = new ExtensionType("rar");
+   private final String string = ".";
+   private final String extension;
+
+   private ExtensionType(String extension)
+   {
+      this.extension = extension;
+   }
+
+   @Override
+   public String toString()
+   {
+      return string + extension;
+   }
+}
Index: api/src/main/java/org/jboss/shrinkwrap/api/ShrinkWrap.java
===================================================================
--- api/src/main/java/org/jboss/shrinkwrap/api/ShrinkWrap.java	(revision 4282)
+++ api/src/main/java/org/jboss/shrinkwrap/api/ShrinkWrap.java	(revision )
@@ -30,6 +30,7 @@
  * {@link ShrinkWrap#createDomain(Configuration)}.
  *
  * @author <a href="mailto:andrew.rubinger@jboss.org">ALR</a>
+ * @author <a href="mailto:ken@glxn.net">Ken Gullaksen</a>
  * @version $Revision: $
  */
 public final class ShrinkWrap
@@ -113,7 +114,7 @@
     * Returns a single domain with default configuration
     * for use in applications with no explicit configuration
     * or isolation requirements.
-    * @return
+    * @return default {@link Domain}
     */
    public static Domain getDefaultDomain()
    {
@@ -127,11 +128,16 @@
     * {@link ArchiveFactory#create(String, Class)} upon
     * {@link Domain#getArchiveFactory()} upon the domain returned
     * by {@link ShrinkWrap#getDefaultDomain()}.
-    * 
+    *
+    * Deprecated as part of SHRINKWRAP-163
+    * Use {@link ShrinkWrap#create(Class, String)} instead.
+    * 
     * @param archiveName The name of the archive
+    * @param type The type of the archive e.g. {@link org.jboss.shrinkwrap.api.spec.WebArchive}
-    * @return An {@link Assignable} archive base  
+    * @return An {@link Assignable} archive base
     * @throws IllegalArgumentException If either argument is not specified
     */
+   @Deprecated
    public static <T extends Assignable> T create(final String archiveName, final Class<T> type)
          throws IllegalArgumentException
    {
@@ -146,9 +152,64 @@
       }
 
       // Delegate to the default domain's archive factory for creation
-      return ShrinkWrap.getDefaultDomain().getArchiveFactory().create(archiveName, type);
+      return ShrinkWrap.getDefaultDomain().getArchiveFactory().create(type, archiveName);
    }
 
+   /**
+    * Creates a new archive of the specified type.  The archive
+    * will be be backed by the default {@link Configuration}.
+    * Invoking this method is functionally equivalent to calling
+    * {@link ArchiveFactory#create(Class)} upon
+    * {@link Domain#getArchiveFactory()} upon the domain returned
+    * by {@link ShrinkWrap#getDefaultDomain()}.
+    *
+    * @param type The type of the archive e.g. {@link org.jboss.shrinkwrap.api.spec.WebArchive}
+    * @return An {@link Assignable} archive base
+    * @throws IllegalArgumentException if type is not specified
+    */
+   public static <T extends Assignable> T create(final Class<T> type)
+      throws IllegalArgumentException
+   {
+      // Precondition checks
+      if (type == null)
+      {
+         throw new IllegalArgumentException("Type must be specified");
+      }
+
+      // Delegate to the default domain's archive factory for creation
+      return ShrinkWrap.getDefaultDomain().getArchiveFactory().create(type);
+   }
+
+   /**
+    * Creates a new archive of the specified type.  The archive
+    * will be be backed by the default {@link Configuration}.
+    * Invoking this method is functionally equivalent to calling
+    * {@link ArchiveFactory#create(String, Class)} upon
+    * {@link Domain#getArchiveFactory()} upon the domain returned
+    * by {@link ShrinkWrap#getDefaultDomain()}.
+    *
+    * @param type The type of the archive e.g. {@link org.jboss.shrinkwrap.api.spec.WebArchive}
+    * @param archiveName The name of the archive
+    * @return An {@link Assignable} archive base
+    * @throws IllegalArgumentException either argument is not specified
+    */
+   public static <T extends Assignable> T create(final Class<T> type, final String archiveName)
+      throws IllegalArgumentException
+   {
+      // Precondition checks
+      if (type == null)
+      {
+         throw new IllegalArgumentException("Type must be specified");
+      }
+      if (archiveName == null || archiveName.length() == 0)
+      {
+         throw new IllegalArgumentException("ArchiveName must be specified");
+      }
+
+      // Delegate to the default domain's archive factory for creation
+      return ShrinkWrap.getDefaultDomain().getArchiveFactory().create(type, archiveName);
+   }
+
    //-------------------------------------------------------------------------------------||
    // Internal Helper Members ------------------------------------------------------------||
    //-------------------------------------------------------------------------------------||
Index: api/src/main/java/org/jboss/shrinkwrap/api/ConfigurationBuilder.java
===================================================================
--- api/src/main/java/org/jboss/shrinkwrap/api/ConfigurationBuilder.java	(revision 4284)
+++ api/src/main/java/org/jboss/shrinkwrap/api/ConfigurationBuilder.java	(revision )
@@ -16,6 +16,13 @@
  */
 package org.jboss.shrinkwrap.api;
 
+import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.jboss.shrinkwrap.api.spec.ResourceAdapterArchive;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+
+import java.util.HashMap;
+import java.util.Map;
 import java.util.concurrent.ExecutorService;
 import java.util.logging.Level;
 import java.util.logging.Logger;
@@ -33,6 +40,7 @@
  * constructed by calling upon {@link ConfigurationBuilder#build()}.
  *
  * @author <a href="mailto:andrew.rubinger@jboss.org">ALR</a>
+ * @author <a href="mailto:ken@glxn.net">Ken Gullaksen</a>
  * @version $Revision: $
  */
 public class ConfigurationBuilder
@@ -65,6 +73,11 @@
     */
    private ExecutorService executorService;
 
+   /**
+    * Mapping between {@link org.jboss.shrinkwrap.api.Assignable}  and {@link org.jboss.shrinkwrap.api.ExtensionType}
+    */
+   private Map<Class<?>, ExtensionType> extensionMapping;
+
    //-------------------------------------------------------------------------------------||
    // Constructor ------------------------------------------------------------------------||
    //-------------------------------------------------------------------------------------||
@@ -99,6 +112,14 @@
    }
 
    /**
+    * @return the extensionMapping
+    */
+   public Map<Class<?>, ExtensionType> getExtensionMapping()
+   {
+      return extensionMapping;
+   }
+
+   /**
     * Sets the {@link ExtensionLoader} to be used, returning this instance
     * 
     * @param extensionLoader
@@ -122,6 +143,17 @@
    }
 
    /**
+    *  Sets the extensionMapping to be used, returning this instance
+    * @param extensionMapping the extensionMapping
+    * @return the ConfigurationBuilder
+    */
+   public ConfigurationBuilder extensionMapping(final Map<Class<?>, ExtensionType> extensionMapping)
+   {
+      this.extensionMapping = extensionMapping;
+      return this;
+   }
+
+   /**
     * Builds a new {@link Configuration} using the properties contained
     * in this builder.  In the case a property has not been specified, it will be defaulted
     * according to the rules set forth in this {@link ConfigurationBuilder}'s contract.
@@ -157,10 +189,18 @@
          }
          this.extensionLoader(loader);
       }
+      if(getExtensionMapping() == null) {
+         final Map<Class<?>, ExtensionType> extensionMapping = createDefaultExtensionMapping();
+         if (log.isLoggable(Level.FINER))
+         {
+            log.finer("User has not defined an explicit extensionMapping; defaulting to " + extensionMapping);
-   }
+         }
+         this.extensionMapping(extensionMapping);
+      }
+   }
 
    /**
-    * Obtains the default {@link ExtensionLoader} to be used if none 
+    * Obtains the default {@link ExtensionLoader} to be used if none
     * is specified
     * @return
     */
@@ -171,4 +211,20 @@
       {}, ExtensionLoader.class);
    }
 
+   /**
+    * Creates and populates the default extensionMapping
+    * @return the extensionMapping
+    */
+   private Map<Class<?>, ExtensionType> createDefaultExtensionMapping()
+   {
+      extensionMapping = new HashMap<Class<?>, ExtensionType>();
+
+      extensionMapping.put(WebArchive.class, ExtensionType.WAR);
+      extensionMapping.put(JavaArchive.class, ExtensionType.JAR);
+      extensionMapping.put(EnterpriseArchive.class, ExtensionType.EAR);
+      extensionMapping.put(ResourceAdapterArchive.class, ExtensionType.RAR);
+
+      return extensionMapping;
-}
+   }
+
+}
Index: api/src/main/java/org/jboss/shrinkwrap/api/Configuration.java
===================================================================
--- api/src/main/java/org/jboss/shrinkwrap/api/Configuration.java	(revision 4283)
+++ api/src/main/java/org/jboss/shrinkwrap/api/Configuration.java	(revision )
@@ -16,6 +16,7 @@
  */
 package org.jboss.shrinkwrap.api;
 
+import java.util.Map;
 import java.util.concurrent.ExecutorService;
 
 /**
@@ -31,6 +32,7 @@
  * {@link Domain}s when creating {@link Archive}s.
  * 
  * @author <a href="mailto:andrew.rubinger@jboss.org">ALR</a>
+ * @author <a href="mailto:ken@glxn.net">Ken Gullaksen</a>
  * @version $Revision: $
  */
 public class Configuration
@@ -53,6 +55,8 @@
     */
    private final ExecutorService executorService;
 
+   private final Map<Class<?>, ExtensionType> extensionMapping;
+
    //-------------------------------------------------------------------------------------||
    // Constructor ------------------------------------------------------------------------||
    //-------------------------------------------------------------------------------------||
@@ -75,6 +79,7 @@
       // Set 
       this.extensionLoader = builder.getExtensionLoader();
       this.executorService = builder.getExecutorService();
+      this.extensionMapping = builder.getExtensionMapping();
    }
 
    //-------------------------------------------------------------------------------------||
@@ -97,4 +102,11 @@
       return executorService;
    }
 
+   /**
+    * @return the extensionMapping
+    */
+   public Map<Class<?>, ExtensionType> getExtensionMapping()
+   {
+      return extensionMapping;
-}
+   }
+}
