Index: impl-base/src/test/java/org/jboss/declarchive/impl/base/resource/ClassloaderResourceTestCase.java
===================================================================
--- impl-base/src/test/java/org/jboss/declarchive/impl/base/resource/ClassloaderResourceTestCase.java	(revision 3448)
+++ impl-base/src/test/java/org/jboss/declarchive/impl/base/resource/ClassloaderResourceTestCase.java	(working copy)
@@ -20,7 +20,7 @@
 
 import junit.framework.Assert;
 
-import org.jboss.declarchive.spi.Resource;
+import org.jboss.declarchive.api.Resource;
 import org.junit.Test;
 
 /**
@@ -53,7 +53,7 @@
    {
       Resource resource = new ClassloaderResource(EXISTING_RESOURCE);
       Assert.assertEquals("A Classloader resource should use file name as default name, not absolute path",
-            "Test.properties", resource.getDefaultName());
+            "Test.properties", resource.getDefaultPath());
    }
 
    @Test
Index: impl-base/src/test/java/org/jboss/declarchive/impl/base/resource/FileResourceTestCase.java
===================================================================
--- impl-base/src/test/java/org/jboss/declarchive/impl/base/resource/FileResourceTestCase.java	(revision 3448)
+++ impl-base/src/test/java/org/jboss/declarchive/impl/base/resource/FileResourceTestCase.java	(working copy)
@@ -21,7 +21,7 @@
 
 import junit.framework.Assert;
 
-import org.jboss.declarchive.spi.Resource;
+import org.jboss.declarchive.api.Resource;
 import org.junit.Test;
 
 /**
@@ -56,7 +56,7 @@
    {
       Resource resource = new FileResource(new File(EXISTING_FILE));
       Assert.assertEquals("A File resource should use the file name as default name, not absolute path",
-            "Test.properties", resource.getDefaultName());
+            "Test.properties", resource.getDefaultPath());
    }
 
    @Test
Index: impl-base/src/test/java/org/jboss/declarchive/impl/base/resource/URLResourceTestCase.java
===================================================================
--- impl-base/src/test/java/org/jboss/declarchive/impl/base/resource/URLResourceTestCase.java	(revision 3448)
+++ impl-base/src/test/java/org/jboss/declarchive/impl/base/resource/URLResourceTestCase.java	(working copy)
@@ -20,7 +20,7 @@
 
 import junit.framework.Assert;
 
-import org.jboss.declarchive.spi.Resource;
+import org.jboss.declarchive.api.Resource;
 import org.junit.Test;
 
 /**
@@ -53,7 +53,7 @@
       Resource resource = new URLResource(Thread.currentThread().getContextClassLoader().getResource(EXISTING_RESOURCE));
 
       Assert.assertEquals("A URL resource should use the file name as default name, not absolute path",
-            "Test.properties", resource.getDefaultName());
+            "Test.properties", resource.getDefaultPath());
    }
 
    @Test
Index: impl-base/src/test/java/org/jboss/declarchive/impl/base/resource/ClassResourceTestCase.java
===================================================================
--- impl-base/src/test/java/org/jboss/declarchive/impl/base/resource/ClassResourceTestCase.java	(revision 3448)
+++ impl-base/src/test/java/org/jboss/declarchive/impl/base/resource/ClassResourceTestCase.java	(working copy)
@@ -18,7 +18,7 @@
 
 import java.io.InputStream;
 
-import org.jboss.declarchive.spi.Resource;
+import org.jboss.declarchive.api.Resource;
 import org.junit.Assert;
 import org.junit.Test;
 
@@ -49,7 +49,7 @@
    {
       Resource resource = new ClassResource(ClassResourceTestCase.class);
       Assert.assertEquals("A Class resource should use class name + '.class' as default name",
-            "org/jboss/declarchive/impl/base/resource/ClassResourceTestCase.class", resource.getDefaultName());
+            "org/jboss/declarchive/impl/base/resource/ClassResourceTestCase.class", resource.getDefaultPath());
    }
 
    @Test
Index: impl-base/src/main/java/org/jboss/declarchive/impl/base/container/ThreadContextClassLoaderResourceContainer.java
===================================================================
--- impl-base/src/main/java/org/jboss/declarchive/impl/base/container/ThreadContextClassLoaderResourceContainer.java	(revision 0)
+++ impl-base/src/main/java/org/jboss/declarchive/impl/base/container/ThreadContextClassLoaderResourceContainer.java	(revision 0)
@@ -0,0 +1,63 @@
+/*
+ * 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.declarchive.impl.base.container;
+
+import org.jboss.declarchive.api.Archive;
+import org.jboss.declarchive.api.container.ResourceContainer;
+
+/**
+ * ThreadContextClassLoaderResourceContainer
+ * 
+ * A {@link ResourceContainer} which uses the Thread Context ClassLoader
+ * to load requested resources.
+ *
+ * @author <a href="mailto:andrew.rubinger@jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public class ThreadContextClassLoaderResourceContainer<T extends Archive<T>> extends ResourceContainerBase<T>
+{
+
+   //-------------------------------------------------------------------------------------||
+   // Constructor ------------------------------------------------------------------------||
+   //-------------------------------------------------------------------------------------||
+
+   /**
+    * Creates a new Resource Container targeted to 
+    * the specified archive
+    * 
+    * @param archive
+    * @throws IllegalArgumentException If the archive is not specified
+    */
+   public ThreadContextClassLoaderResourceContainer(final T archive)
+   {
+      // Super
+      super(archive);
+   }
+
+   //-------------------------------------------------------------------------------------||
+   // Required Implementations -----------------------------------------------------------||
+   //-------------------------------------------------------------------------------------||
+
+   /**
+    * @see org.jboss.declarchive.impl.base.container.ResourceContainerBase#getClassLoader()
+    */
+   @Override
+   ClassLoader getClassLoader()
+   {
+      return SecurityActions.getThreadContextClassLoader();
+   }
+}
Index: impl-base/src/main/java/org/jboss/declarchive/impl/base/container/ResourceContainerBase.java
===================================================================
--- impl-base/src/main/java/org/jboss/declarchive/impl/base/container/ResourceContainerBase.java	(revision 0)
+++ impl-base/src/main/java/org/jboss/declarchive/impl/base/container/ResourceContainerBase.java	(revision 0)
@@ -0,0 +1,191 @@
+/*
+ * 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.declarchive.impl.base.container;
+
+import java.util.logging.Logger;
+
+import org.jboss.declarchive.api.Archive;
+import org.jboss.declarchive.api.Path;
+import org.jboss.declarchive.api.Resource;
+import org.jboss.declarchive.api.container.ResourceContainer;
+import org.jboss.declarchive.impl.base.path.BasePath;
+import org.jboss.declarchive.impl.base.resource.ClassloaderResource;
+
+/**
+ * ResourceContainerBase
+ * 
+ * A {@link ResourceContainer} which uses the Thread Context ClassLoader
+ * to load requested resources.
+ *
+ * @author <a href="mailto:andrew.rubinger@jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+abstract class ResourceContainerBase<T extends Archive<T>> implements ResourceContainer<T>
+{
+
+   //-------------------------------------------------------------------------------------||
+   // Class Members ----------------------------------------------------------------------||
+   //-------------------------------------------------------------------------------------||
+
+   /**
+    * Logger
+    */
+   private static final Logger log = Logger.getLogger(ResourceContainerBase.class.getName());
+
+   //-------------------------------------------------------------------------------------||
+   // Instance Members -------------------------------------------------------------------||
+   //-------------------------------------------------------------------------------------||
+
+   /**
+    * Backing archive for this Container
+    */
+   private final T archive;
+
+   //-------------------------------------------------------------------------------------||
+   // Constructor ------------------------------------------------------------------------||
+   //-------------------------------------------------------------------------------------||
+
+   /**
+    * Creates a new Resource Container targeted to 
+    * the specified archive
+    * 
+    * @param archive
+    * @throws IllegalArgumentException If the archive is not specified
+    */
+   public ResourceContainerBase(final T archive)
+   {
+      // Precondition check
+      if (archive == null)
+      {
+         throw new IllegalArgumentException("archive must be specified");
+      }
+
+      // Set properties
+      this.archive = archive;
+   }
+
+   //-------------------------------------------------------------------------------------||
+   // Required Implementations -----------------------------------------------------------||
+   //-------------------------------------------------------------------------------------||
+
+   /**
+    * @see org.jboss.declarchive.api.container.ResourceContainer#addResource(java.lang.String)
+    */
+   @Override
+   public T addResource(final String name) throws IllegalArgumentException
+   {
+      // Make a resource
+      final Resource resource = this.getResource(name);
+
+      // Make a Path
+      final Path path = resource.getDefaultPath();
+
+      // Return
+      return this.addResource(resource, path);
+   }
+
+   /**
+    * @see org.jboss.declarchive.api.container.ResourceContainer#addResource(java.lang.String, java.lang.String)
+    */
+   @Override
+   public T addResource(final String name, final String locationWithinContainer) throws IllegalArgumentException
+   {
+      // Make a resource
+      final Resource resource = this.getResource(name);
+
+      // Make a Path using the explicit location
+      final Path path = new BasePath(locationWithinContainer);
+
+      // Return
+      return this.addResource(resource, path);
+   }
+
+   //-------------------------------------------------------------------------------------||
+   // Contracts --------------------------------------------------------------------------||
+   //-------------------------------------------------------------------------------------||
+
+   /**
+    * Obtains the ClassLoader used to look up resources 
+    */
+   abstract ClassLoader getClassLoader();
+
+   //-------------------------------------------------------------------------------------||
+   // Internal Helper Methods ------------------------------------------------------------||
+   //-------------------------------------------------------------------------------------||
+
+   /**
+    * Adds the specified resource to the specified path
+    * 
+    * @param resource
+    * @param path
+    * @throws IllegalArgumentException If either the resource or path is not specified
+    */
+   private T addResource(final Resource resource, final Path path) throws IllegalArgumentException
+   {
+      // Precondition checks
+      if (resource == null)
+      {
+         throw new IllegalArgumentException("resource must be specified");
+      }
+      if (path == null)
+      {
+         throw new IllegalArgumentException("path must be specified");
+      }
+
+      // Get Archive
+      final T archive = this.getArchive();
+
+      // Add
+      archive.addResource(resource, path);
+
+      // Return
+      return archive;
+   }
+
+   /**
+    * Obtains a resource from the specified name
+    * 
+    * @param name
+    * @return
+    * @throws IllegalArgumentException If the name is not specified
+    */
+   private Resource getResource(final String name)
+   {
+      // Precondition checks
+      if (name == null || name.length() == 0)
+      {
+         throw new IllegalArgumentException("name must be specified");
+      }
+
+      // Get the CL
+      final ClassLoader cl = this.getClassLoader();
+
+      // Make a resource
+      final Resource resource = new ClassloaderResource(name, cl);
+
+      // Return
+      return resource;
+   }
+
+   /**
+    * @return the archive
+    */
+   private final T getArchive()
+   {
+      return archive;
+   }
+}
Index: impl-base/src/main/java/org/jboss/declarchive/impl/base/container/SecurityActions.java
===================================================================
--- impl-base/src/main/java/org/jboss/declarchive/impl/base/container/SecurityActions.java	(revision 0)
+++ impl-base/src/main/java/org/jboss/declarchive/impl/base/container/SecurityActions.java	(revision 0)
@@ -0,0 +1,63 @@
+/*
+ * 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.declarchive.impl.base.container;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+/**
+ * SecurityActions
+ * 
+ * A set of privileged actions that are not to leak out
+ * of this package 
+ *
+ * @author <a href="mailto:andrew.rubinger@jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+class SecurityActions
+{
+
+   //-------------------------------------------------------------------------------||
+   // Constructor ------------------------------------------------------------------||
+   //-------------------------------------------------------------------------------||
+
+   /**
+    * No external instantiation
+    */
+   private SecurityActions()
+   {
+
+   }
+
+   //-------------------------------------------------------------------------------||
+   // Utility Methods --------------------------------------------------------------||
+   //-------------------------------------------------------------------------------||
+
+   /**
+    * Obtains the Thread Context ClassLoader
+    */
+   static ClassLoader getThreadContextClassLoader()
+   {
+      return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>()
+      {
+         public ClassLoader run()
+         {
+            return Thread.currentThread().getContextClassLoader();
+         }
+      });
+   }
+}

Property changes on: impl-base/src/main/java/org/jboss/declarchive/impl/base/container/SecurityActions.java
___________________________________________________________________
Added: svn:executable
   + *

Index: impl-base/src/main/java/org/jboss/declarchive/impl/base/resource/ClassloaderResource.java
===================================================================
--- impl-base/src/main/java/org/jboss/declarchive/impl/base/resource/ClassloaderResource.java	(revision 3448)
+++ impl-base/src/main/java/org/jboss/declarchive/impl/base/resource/ClassloaderResource.java	(working copy)
@@ -19,7 +19,9 @@
 import java.io.InputStream;
 import java.net.URL;
 
-import org.jboss.declarchive.spi.Resource;
+import org.jboss.declarchive.api.Path;
+import org.jboss.declarchive.api.Resource;
+import org.jboss.declarchive.impl.base.path.BasePath;
 
 /**
  * Loads the content of any resource located in the Classloader.
@@ -78,9 +80,9 @@
     * @return Returns only the file name part of a URL, not the absolute path.
     */
    @Override
-   public String getDefaultName()
+   public Path getDefaultPath()
    {
-      return extractFileName(classLoader.getResource(resourceName));
+      return new BasePath(extractFileName(classLoader.getResource(resourceName)));
    }
 
    /**
Index: impl-base/src/main/java/org/jboss/declarchive/impl/base/resource/FileResource.java
===================================================================
--- impl-base/src/main/java/org/jboss/declarchive/impl/base/resource/FileResource.java	(revision 3448)
+++ impl-base/src/main/java/org/jboss/declarchive/impl/base/resource/FileResource.java	(working copy)
@@ -21,7 +21,9 @@
 import java.io.FileNotFoundException;
 import java.io.InputStream;
 
-import org.jboss.declarchive.spi.Resource;
+import org.jboss.declarchive.api.Path;
+import org.jboss.declarchive.api.Resource;
+import org.jboss.declarchive.impl.base.path.BasePath;
 
 /**
  * Loads any File.
@@ -58,9 +60,9 @@
     * Get the default name using File.getName();
     */
    @Override
-   public String getDefaultName()
+   public Path getDefaultPath()
    {
-      return file.getName();
+      return new BasePath(file.getName());
    }
 
    /**
Index: impl-base/src/main/java/org/jboss/declarchive/impl/base/resource/URLResource.java
===================================================================
--- impl-base/src/main/java/org/jboss/declarchive/impl/base/resource/URLResource.java	(revision 3448)
+++ impl-base/src/main/java/org/jboss/declarchive/impl/base/resource/URLResource.java	(working copy)
@@ -19,7 +19,9 @@
 import java.io.InputStream;
 import java.net.URL;
 
-import org.jboss.declarchive.spi.Resource;
+import org.jboss.declarchive.api.Path;
+import org.jboss.declarchive.api.Resource;
+import org.jboss.declarchive.impl.base.path.BasePath;
 
 /**
  * Loads the content of any URL supported by the runtime.
@@ -51,9 +53,9 @@
     * Get the default name using URL.getFile().
     */
    @Override
-   public String getDefaultName()
+   public Path getDefaultPath()
    {
-      return extractFileName(url);
+      return new BasePath(extractFileName(url));
    }
 
    /**
Index: impl-base/src/main/java/org/jboss/declarchive/impl/base/resource/ClassResource.java
===================================================================
--- impl-base/src/main/java/org/jboss/declarchive/impl/base/resource/ClassResource.java	(revision 3448)
+++ impl-base/src/main/java/org/jboss/declarchive/impl/base/resource/ClassResource.java	(working copy)
@@ -18,7 +18,9 @@
 
 import java.io.InputStream;
 
-import org.jboss.declarchive.spi.Resource;
+import org.jboss.declarchive.api.Path;
+import org.jboss.declarchive.api.Resource;
+import org.jboss.declarchive.impl.base.path.BasePath;
 
 /**
  * Loads the given class using the class's ClassLoader.
@@ -65,9 +67,9 @@
     * Get the default name using Class.getSimpleName().
     */
    @Override
-   public String getDefaultName()
+   public Path getDefaultPath()
    {
-      return getResourceNameOfClass(clazz);
+      return new BasePath(getResourceNameOfClass(clazz));
    }
 
    /**
Index: impl-base/src/main/java/org/jboss/declarchive/impl/base/ArchiveBase.java
===================================================================
--- impl-base/src/main/java/org/jboss/declarchive/impl/base/ArchiveBase.java	(revision 3445)
+++ impl-base/src/main/java/org/jboss/declarchive/impl/base/ArchiveBase.java	(working copy)
@@ -25,6 +25,9 @@
 import java.util.logging.Logger;
 
 import org.jboss.declarchive.api.Archive;
+import org.jboss.declarchive.api.Path;
+import org.jboss.declarchive.api.Resource;
+import org.jboss.declarchive.api.container.ResourceContainer;
 
 /**
  * ArchiveBase
@@ -34,7 +37,7 @@
  * @author <a href="mailto:andrew.rubinger@jboss.org">ALR</a>
  * @version $Revision: $
  */
-public abstract class ArchiveBase<T extends Archive<?>> implements Archive<T>
+public abstract class ArchiveBase<T extends Archive<T>> implements Archive<T>, ResourceContainer<T>
 {
 
    //-------------------------------------------------------------------------------------||
@@ -260,6 +263,26 @@
       return this.covarientReturn();
    }
 
+   /**
+    * @see org.jboss.declarchive.api.container.ResourceContainer#addResource(java.lang.String, java.lang.String)
+    */
+   @Override
+   public T addResource(final String name, final String locationWithinContainer) throws IllegalArgumentException
+   {
+      // TODO Auto-generated method stub
+      return null;
+   }
+
+   /**
+    * @see org.jboss.declarchive.api.Archive#addResource(org.jboss.declarchive.api.Resource, org.jboss.declarchive.api.Path)
+    */
+   @Override
+   public T addResource(final Resource resource, final Path path) throws IllegalArgumentException
+   {
+      // TODO Auto-generated method stub
+      return null;
+   }
+
    //-------------------------------------------------------------------------------------||
    // Contracts --------------------------------------------------------------------------||
    //-------------------------------------------------------------------------------------||
Index: impl-base/src/main/java/org/jboss/declarchive/impl/base/jar/JavaArchiveImpl.java
===================================================================
--- impl-base/src/main/java/org/jboss/declarchive/impl/base/jar/JavaArchiveImpl.java	(revision 3448)
+++ impl-base/src/main/java/org/jboss/declarchive/impl/base/jar/JavaArchiveImpl.java	(working copy)
@@ -22,6 +22,8 @@
 import java.util.logging.Logger;
 
 import org.jboss.declarchive.api.Archive;
+import org.jboss.declarchive.api.Path;
+import org.jboss.declarchive.api.Resource;
 import org.jboss.declarchive.api.jar.JavaArchive;
 
 /**
@@ -165,6 +167,27 @@
    }
 
    /**
+    * @see org.jboss.declarchive.api.Archive#addResource(org.jboss.declarchive.api.Resource, org.jboss.declarchive.api.Path)
+    */
+   @Override
+   public JavaArchive addResource(final Resource resource, final Path path) throws IllegalArgumentException
+   {
+      delegate.addResource(resource, path);
+      return this;
+   }
+
+   /**
+    * @see org.jboss.declarchive.api.container.ResourceContainer#addResource(java.lang.String, java.lang.String)
+    */
+   @Override
+   public JavaArchive addResource(final String name, final String locationWithinContainer)
+         throws IllegalArgumentException
+   {
+      //TODO Impl
+      throw new RuntimeException("Not Implemented");
+   }
+
+   /**
     * @param verbose
     * @return
     * @see org.jboss.declarchive.api.Archive#toString(boolean)
Index: impl-base/src/main/java/org/jboss/declarchive/impl/base/path/BasePath.java
===================================================================
--- impl-base/src/main/java/org/jboss/declarchive/impl/base/path/BasePath.java	(revision 0)
+++ impl-base/src/main/java/org/jboss/declarchive/impl/base/path/BasePath.java	(revision 0)
@@ -0,0 +1,67 @@
+/*
+ * 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.declarchive.impl.base.path;
+
+import org.jboss.declarchive.api.Path;
+
+/**
+ * BasePath
+ * 
+ * A {@link Path} which has no namespace and is relative to the
+ * root.
+ *
+ * @author <a href="mailto:andrew.rubinger@jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public class BasePath extends PrefixPath
+{
+
+   //-------------------------------------------------------------------------------------||
+   // Class Members ----------------------------------------------------------------------||
+   //-------------------------------------------------------------------------------------||
+
+   private static final String PREFIX = null;
+
+   //-------------------------------------------------------------------------------------||
+   // Constructor ------------------------------------------------------------------------||
+   //-------------------------------------------------------------------------------------||
+
+   /**
+    * Creates a new Path representing the specified
+    * context.  Null or blank may be used to 
+    * denote the root.
+    * 
+    * @param context
+    */
+   public BasePath(final String context)
+   {
+      super(context);
+   }
+
+   //-------------------------------------------------------------------------------------||
+   // Required Implementations -----------------------------------------------------------||
+   //-------------------------------------------------------------------------------------||
+
+   /**
+    * @see org.jboss.declarchive.impl.base.path.PrefixPath#getPrefix()
+    */
+   @Override
+   String getPrefix()
+   {
+      return PREFIX;
+   }
+}
Index: impl-base/src/main/java/org/jboss/declarchive/impl/base/path/PrefixPath.java
===================================================================
--- impl-base/src/main/java/org/jboss/declarchive/impl/base/path/PrefixPath.java	(revision 0)
+++ impl-base/src/main/java/org/jboss/declarchive/impl/base/path/PrefixPath.java	(revision 0)
@@ -0,0 +1,93 @@
+/*
+ * 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.declarchive.impl.base.path;
+
+import org.jboss.declarchive.api.Path;
+
+/**
+ * PrefixPath
+ * 
+ * A Path which may be optionally prefixed with some common
+ * namespace
+ *
+ * @author <a href="mailto:andrew.rubinger@jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+abstract class PrefixPath implements Path
+{
+
+   //-------------------------------------------------------------------------------------||
+   // Class Members ----------------------------------------------------------------------||
+   //-------------------------------------------------------------------------------------||
+
+   /**
+    * Empty String
+    */
+   private static final String EMPTY_STRING = "";
+
+   //-------------------------------------------------------------------------------------||
+   // Instance Members -------------------------------------------------------------------||
+   //-------------------------------------------------------------------------------------||
+
+   /**
+    * The context which this path represents
+    */
+   private final String context;
+
+   //-------------------------------------------------------------------------------------||
+   // Constructor ------------------------------------------------------------------------||
+   //-------------------------------------------------------------------------------------||
+
+   /**
+    * Creates a new Path with the specified Prefix and context
+    * 
+    * @param prefix The prefix to prepend to every context returned
+    * in {@link PrefixPath#get()}.  May be null or blank
+    * @param context The context which this path represents.  Null or 
+    * blank represents the root.
+    */
+   PrefixPath(final String context)
+   {
+      this.context = context;
+   }
+
+   //-------------------------------------------------------------------------------------||
+   // Required Implementations -----------------------------------------------------------||
+   //-------------------------------------------------------------------------------------||
+
+   /**
+    * @see org.jboss.declarchive.api.Path#get()
+    */
+   @Override
+   public String get()
+   {
+      // Return the prefix plus the context
+      final String prefix = this.getPrefix();
+      final String prefixToUse = prefix == null ? EMPTY_STRING : prefix;
+      final String resolvedContext = prefixToUse + context;
+      return resolvedContext;
+   }
+
+   //-------------------------------------------------------------------------------------||
+   // Contracts --------------------------------------------------------------------------||
+   //-------------------------------------------------------------------------------------||
+
+   /**
+    * Obtains the prefix to prepend to all path contexts
+    */
+   abstract String getPrefix();
+}
Index: api/src/main/java/org/jboss/declarchive/api/Archive.java
===================================================================
--- api/src/main/java/org/jboss/declarchive/api/Archive.java	(revision 3445)
+++ api/src/main/java/org/jboss/declarchive/api/Archive.java	(working copy)
@@ -52,6 +52,17 @@
    T addClasses(Class<?>... classes) throws IllegalArgumentException;
 
    /**
+    * Adds the specified resource to the archive at the specified Path
+    * 
+    * @param resource
+    * @param path
+    * @return
+    * @throws IllegalArgumentException If either the resource or path is
+    * unspecified
+    */
+   T addResource(Resource resource, Path path) throws IllegalArgumentException;
+
+   /**
     * Adds the resource with the specified name to the 
     * deployment.  The resource name must be visible to the ClassLoader
     * of the archive
Index: api/src/main/java/org/jboss/declarchive/api/container/ResourceContainer.java
===================================================================
--- api/src/main/java/org/jboss/declarchive/api/container/ResourceContainer.java	(revision 0)
+++ api/src/main/java/org/jboss/declarchive/api/container/ResourceContainer.java	(revision 0)
@@ -0,0 +1,64 @@
+/*
+ * 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.declarchive.api.container;
+
+import org.jboss.declarchive.api.Archive;
+
+/**
+ * ResourceContainer
+ * 
+ * Defines the contract for a component capable of storing 
+ * a series of ClassLoader resources
+ *
+ * @author <a href="mailto:andrew.rubinger@jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public interface ResourceContainer<T extends Archive<T>>
+{
+   //-------------------------------------------------------------------------------------||
+   // Contracts --------------------------------------------------------------------------||
+   //-------------------------------------------------------------------------------------||
+
+   /**
+    * Adds the resource with the specified name
+    * to the container, returning the container itself.
+    * The ClassLoader used to obtain the resource is up to
+    * the implementation.  The resource will be placed into 
+    * the Container under the same context from which it was retrieved.
+    * For instance a name of "META-INF/resource.xml" will be placed
+    * at the same location within the Container.
+    * 
+    * @param name Name of the ClassLoader resource to add
+    * @throws IllegalArgumentException If the name is not specified
+    */
+   T addResource(String name) throws IllegalArgumentException;
+
+   /**
+    * Adds the resource with the specified name
+    * to the container, returning the container itself.
+    * The ClassLoader used to obtain the resource is up to
+    * the implementation.  The resource will be placed into 
+    * the Container under the same context specified by
+    * "locationWithinContainer"
+    * 
+    * @param name Name of the ClassLoader resource to add
+    * @param locationWithinContainer Context within the Container
+    *       under which to place the resource
+    * @throws IllegalArgumentException If the name or location is not specified
+    */
+   T addResource(String name, String locationWithinContainer) throws IllegalArgumentException;
+}
Index: api/src/main/java/org/jboss/declarchive/api/Resource.java
===================================================================
--- api/src/main/java/org/jboss/declarchive/api/Resource.java	(revision 0)
+++ api/src/main/java/org/jboss/declarchive/api/Resource.java	(revision 0)
@@ -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.declarchive.api;
+
+import java.io.InputStream;
+
+/**
+ * Represents a Class, file, or any other collection
+ * of bytes stored under some context within an {@link Archive} 
+ * 
+ * @author <a href="mailto:aslak@conduct.no">Aslak Knutsen</a>
+ * @author <a href="mailto:andrew.rubinger@jboss.org">ALR</a>
+ */
+public interface Resource
+{
+
+   /**
+    * Get the default path for this resource, which will 
+    * be the context under with the resource is placed into
+    * an archive unless explicitly specified otherwise.
+    * 
+    * @return A name for this Resource
+    */
+   Path getDefaultPath();
+
+   /**
+    * Get a open stream for the resource content.
+    * The caller is responsible for closing the stream. 
+    * 
+    * @return A new open inputstream for each call.
+    */
+   InputStream getStream();
+}
Index: api/src/main/java/org/jboss/declarchive/api/jar/JavaArchive.java
===================================================================
--- api/src/main/java/org/jboss/declarchive/api/jar/JavaArchive.java	(revision 3449)
+++ api/src/main/java/org/jboss/declarchive/api/jar/JavaArchive.java	(working copy)
@@ -20,6 +20,7 @@
 import java.net.URL;
 
 import org.jboss.declarchive.api.Archive;
+import org.jboss.declarchive.api.container.ResourceContainer;
 
 /**
  * JavaArchive
@@ -31,7 +32,7 @@
  * @author <a href="mailto:andrew.rubinger@jboss.org">ALR</a>
  * @version $Revision: $
  */
-public interface JavaArchive extends Archive<JavaArchive>
+public interface JavaArchive extends Archive<JavaArchive>, ResourceContainer<JavaArchive>
 {
 
    //-------------------------------------------------------------------------------------||
Index: api/src/main/java/org/jboss/declarchive/api/Path.java
===================================================================
--- api/src/main/java/org/jboss/declarchive/api/Path.java	(revision 0)
+++ api/src/main/java/org/jboss/declarchive/api/Path.java	(revision 0)
@@ -0,0 +1,36 @@
+/*
+ * 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.declarchive.api;
+
+/**
+ * Path
+ * 
+ * Represents a target context within an {@link Archive} under
+ * which a {@link Resource} may be found.
+ *
+ * @author <a href="mailto:andrew.rubinger@jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public interface Path
+{
+   /**
+    * Obtains the context which this Path represents
+    * 
+    * @return
+    */
+   String get();
+}
Index: spi/src/main/java/org/jboss/declarchive/spi/Resource.java
===================================================================
--- spi/src/main/java/org/jboss/declarchive/spi/Resource.java	(revision 3445)
+++ spi/src/main/java/org/jboss/declarchive/spi/Resource.java	(working copy)
@@ -1,46 +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.declarchive.spi;
-
-import java.io.InputStream;
-
-/**
- * Generic interface for resource loading. 
- * 
- * Used to move the resource loading logic out of the archive backends.  
- * 
- * @author <a href="mailto:aslak@conduct.no">Aslak Knutsen</a>
- *
- */
-public interface Resource
-{
-
-   /**
-    * Get the default name for this resource, can be overriden by the user.
-    * 
-    * @return A name for this Resource
-    */
-   String getDefaultName();
-
-   /**
-    * Get a open stream for the resource content.
-    * The caller is responsible for closing the stream. 
-    * 
-    * @return A new open inputstream for each call.
-    */
-   InputStream getStream();
-}
