You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltaspike.apache.org by gp...@apache.org on 2014/03/03 09:20:18 UTC

git commit: DELTASPIKE-399 simplified usage of ExternalResourceProvider

Repository: deltaspike
Updated Branches:
  refs/heads/master f050f5520 -> 1b40518a7


DELTASPIKE-399 simplified usage of ExternalResourceProvider


Project: http://git-wip-us.apache.org/repos/asf/deltaspike/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltaspike/commit/1b40518a
Tree: http://git-wip-us.apache.org/repos/asf/deltaspike/tree/1b40518a
Diff: http://git-wip-us.apache.org/repos/asf/deltaspike/diff/1b40518a

Branch: refs/heads/master
Commit: 1b40518a753f2757548565a65012f9fb9d4f349e
Parents: f050f55
Author: gpetracek <gp...@apache.org>
Authored: Mon Mar 3 09:14:24 2014 +0100
Committer: gpetracek <gp...@apache.org>
Committed: Mon Mar 3 09:14:24 2014 +0100

----------------------------------------------------------------------
 .../api/literal/ExternalResourceLiteral.java    |  19 ++-
 .../resourceloader/BaseResourceProvider.java    |  97 +++++++++++++
 .../ClasspathResourceProvider.java              | 138 ++++++++++++++++++
 .../api/resourceloader/ClasspathStorage.java    |  26 ----
 .../api/resourceloader/ExternalResource.java    |   2 +-
 .../ExternalResourceProducer.java               | 112 +++++++++++++++
 .../ExternalResourceProvider.java               |  38 +++++
 .../resourceloader/ExternalResourceStorage.java |  26 ----
 .../resourceloader/FileResourceProvider.java    |  62 ++++++++
 .../api/resourceloader/FileSystemStorage.java   |  26 ----
 .../core/spi/literal/StorageTypeLiteral.java    |  40 ------
 .../ExternalResourceProvider.java               |  40 ------
 .../core/spi/resourceloader/StorageType.java    |  46 ------
 .../resourceloader/BaseResourceProvider.java    | 100 -------------
 .../ClasspathResourceProvider.java              | 142 -------------------
 .../ExternalResourceProducer.java               | 122 ----------------
 .../resourceloader/FileResourceProvider.java    |  67 ---------
 .../resourceloader/ResourceLoaderExtension.java |   4 +
 .../resourceloader/ClasspathResourceTest.java   |  11 +-
 .../resourceloader/ClasspathWebProfileTest.java |  11 +-
 .../impl/resourceloader/FileResourceTest.java   |   6 +-
 .../api/resourceloader/WebResourceProvider.java |  56 ++++++++
 .../servlet/api/resourceloader/WebStorage.java  |  28 ----
 .../resourceloader/WebResourceProvider.java     |  63 --------
 .../resourceloader/WebResourceProviderTest.java |  10 +-
 25 files changed, 533 insertions(+), 759 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltaspike/blob/1b40518a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/literal/ExternalResourceLiteral.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/literal/ExternalResourceLiteral.java b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/literal/ExternalResourceLiteral.java
index fa9b1d7..806824c 100644
--- a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/literal/ExternalResourceLiteral.java
+++ b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/literal/ExternalResourceLiteral.java
@@ -19,24 +19,23 @@
 package org.apache.deltaspike.core.api.literal;
 
 import org.apache.deltaspike.core.api.resourceloader.ExternalResource;
-import org.apache.deltaspike.core.api.resourceloader.ExternalResourceStorage;
+import org.apache.deltaspike.core.api.resourceloader.ExternalResourceProvider;
 
 import javax.enterprise.util.AnnotationLiteral;
 
-/**
- *
- */
 public class ExternalResourceLiteral extends AnnotationLiteral<ExternalResource> implements ExternalResource
 {
     private static final long serialVersionUID = 1705986508118055892L;
 
-    private Class<? extends ExternalResourceStorage> storage;
-    private String location;
-    public ExternalResourceLiteral(final Class<? extends ExternalResourceStorage> storage, final String location)
+    private final Class<? extends ExternalResourceProvider> resourceProvider;
+    private final String location;
+
+    public ExternalResourceLiteral(Class<? extends ExternalResourceProvider> resourceProvider, String location)
     {
-        this.storage = storage;
+        this.resourceProvider = resourceProvider;
         this.location = location;
     }
+
     @Override
     public String location()
     {
@@ -44,8 +43,8 @@ public class ExternalResourceLiteral extends AnnotationLiteral<ExternalResource>
     }
 
     @Override
-    public Class<? extends ExternalResourceStorage> storage()
+    public Class<? extends ExternalResourceProvider> resourceProvider()
     {
-        return this.storage;
+        return this.resourceProvider;
     }
 }

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/1b40518a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/resourceloader/BaseResourceProvider.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/resourceloader/BaseResourceProvider.java b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/resourceloader/BaseResourceProvider.java
new file mode 100644
index 0000000..fc8be90
--- /dev/null
+++ b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/resourceloader/BaseResourceProvider.java
@@ -0,0 +1,97 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.deltaspike.core.api.resourceloader;
+
+import javax.enterprise.inject.Any;
+import javax.enterprise.inject.Instance;
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.inject.Inject;
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.annotation.Annotation;
+import java.util.Collections;
+import java.util.List;
+import java.util.Properties;
+import java.util.Set;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * An abstract ExternalResourceProvider implementation with some basic utility functionality.
+ */
+public abstract class BaseResourceProvider implements ExternalResourceProvider
+{
+    private static final Logger logger = Logger.getLogger(BaseResourceProvider.class.getName());
+
+    @Inject
+    @Any
+    private Instance<InjectionPoint> injectionPoint;
+
+    protected boolean isXml(String fileName)
+    {
+        return fileName.endsWith(".xml");
+    }
+
+    protected InjectionPoint getInjectionPoint()
+    {
+        return this.injectionPoint.get();
+    }
+
+    protected Set<Annotation> getAnnotations()
+    {
+        return this.getInjectionPoint().getAnnotated().getAnnotations();
+    }
+
+    protected void loadInputStreamToProperties(InputStream inputStream, Properties properties, String name)
+    {
+        boolean isXml = this.isXml(name);
+        try
+        {
+            if (isXml)
+            {
+                properties.loadFromXML(inputStream);
+            }
+            else
+            {
+                properties.load(inputStream);
+            }
+        }
+        catch (IOException e)
+        {
+            logger.log(Level.WARNING,"Unable to read resource " + name,e);
+
+        }
+    }
+
+    @Override
+    public Properties readProperties(ExternalResource externalResource)
+    {
+        final Properties properties = new Properties();
+        final String name = externalResource.location();
+        final InputStream inputStream = this.readStream(externalResource);
+        this.loadInputStreamToProperties(inputStream, properties, name);
+        return properties;
+    }
+
+    @Override
+    public List<InputStream> readStreams(ExternalResource externalResource)
+    {
+        return Collections.singletonList(this.readStream(externalResource));
+    }
+}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/1b40518a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/resourceloader/ClasspathResourceProvider.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/resourceloader/ClasspathResourceProvider.java b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/resourceloader/ClasspathResourceProvider.java
new file mode 100644
index 0000000..9c31127
--- /dev/null
+++ b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/resourceloader/ClasspathResourceProvider.java
@@ -0,0 +1,138 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.deltaspike.core.api.resourceloader;
+
+import org.apache.deltaspike.core.util.ClassUtils;
+
+import javax.enterprise.context.ApplicationScoped;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * A classpath based resource provider
+ */
+@ApplicationScoped
+public class ClasspathResourceProvider extends BaseResourceProvider
+{
+    private static final Logger logger = Logger.getLogger(ClasspathResourceProvider.class.getName());
+
+    @Override
+    public InputStream readStream(final ExternalResource externalResource)
+    {
+        try
+        {
+            List<InputStream> matchedStreams = this.readClassPath(externalResource.location(),true);
+            return matchedStreams.get(0);
+        }
+        catch (IOException e)
+        {
+            if (logger.isLoggable(Level.FINE))
+            {
+                logger.log(Level.FINE, "Problem reading resource.", e);
+            }
+            return null;
+        }
+    }
+
+    @Override
+    public List<InputStream> readStreams(ExternalResource externalResource)
+    {
+        try
+        {
+            return readClassPath(externalResource.location(),false);
+        }
+        catch (IOException e)
+        {
+            throw new IllegalStateException("Error while trying to load resources from classpath ",e);
+        }
+    }
+
+    /**
+     * Reads all possibly matching classpath entries for the given name.
+     *
+     * If requireUnique is true, then validates that 1 element is present before returning
+     *
+     * @param name
+     * @param requireUnique
+     * @return
+     * @throws IOException
+     * @throws IllegalStateException
+     */
+    private List<InputStream> readClassPath(final String name, final boolean requireUnique)
+        throws IllegalStateException,IOException
+    {
+        Enumeration<URL> urls = ClassUtils.getClassLoader(null).getResources(name);
+        List<URL> urlList = new ArrayList<URL>();
+        List<InputStream> results = new ArrayList<InputStream>();
+        while (urls.hasMoreElements())
+        {
+            URL url = urls.nextElement();
+            InputStream is = url.openStream();
+            if (is != null)
+            {
+                results.add(is);
+                urlList.add(url);
+            }
+        }
+        if (requireUnique && results.size() != 1)
+        {
+            String msg = urlsToString(urlList,name);
+            for (InputStream is : results)
+            {
+                try
+                {
+                    is.close();
+                }
+                catch (IOException e)
+                {
+                    if (logger.isLoggable(Level.FINE))
+                    {
+                        logger.log(Level.FINE,"Unable to close stream",e);
+                    }
+                }
+            }
+            throw new IllegalStateException(msg);
+        }
+        return results;
+    }
+
+    private String urlsToString(List<URL> urls, String name)
+    {
+        if (urls.size() == 0)
+        {
+            return String.format("No resources found for '%s'",name);
+        }
+        else
+        {
+            StringBuilder sb = new StringBuilder();
+            sb.append(String.format("multiple resources found for '%s'",name));
+            for (URL u : urls)
+            {
+                sb.append(" Match : ").append(u.toExternalForm());
+            }
+            return sb.toString();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/1b40518a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/resourceloader/ClasspathStorage.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/resourceloader/ClasspathStorage.java b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/resourceloader/ClasspathStorage.java
deleted file mode 100644
index 00e61df..0000000
--- a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/resourceloader/ClasspathStorage.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.apache.deltaspike.core.api.resourceloader;
-
-/**
- * Represents storage found on the classpath
- */
-public interface ClasspathStorage extends ExternalResourceStorage
-{
-}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/1b40518a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/resourceloader/ExternalResource.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/resourceloader/ExternalResource.java b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/resourceloader/ExternalResource.java
index dbbe4c1..9b76bec 100644
--- a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/resourceloader/ExternalResource.java
+++ b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/resourceloader/ExternalResource.java
@@ -37,7 +37,7 @@ import static java.lang.annotation.ElementType.METHOD;
 public @interface ExternalResource
 {
     @Nonbinding
-    Class<? extends ExternalResourceStorage> storage() default ClasspathStorage.class;
+    Class<? extends ExternalResourceProvider> resourceProvider() default ClasspathResourceProvider.class;
 
     @Nonbinding
     String location() default "";

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/1b40518a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/resourceloader/ExternalResourceProducer.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/resourceloader/ExternalResourceProducer.java b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/resourceloader/ExternalResourceProducer.java
new file mode 100644
index 0000000..bad0966
--- /dev/null
+++ b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/resourceloader/ExternalResourceProducer.java
@@ -0,0 +1,112 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.deltaspike.core.api.resourceloader;
+
+import org.apache.deltaspike.core.api.provider.BeanProvider;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.Any;
+import javax.enterprise.inject.Disposes;
+import javax.enterprise.inject.Instance;
+import javax.enterprise.inject.Produces;
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.inject.Inject;
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.annotation.Annotation;
+import java.util.List;
+import java.util.Properties;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * Handles the creation/loading of external resources.
+ *
+ */
+@ApplicationScoped
+public class ExternalResourceProducer
+{
+    private static final Logger logger = Logger.getLogger(ExternalResourceProducer.class.getName());
+
+    @Inject
+    @Any
+    private Instance<ExternalResourceProvider> resourceProviders;
+
+    @Produces
+    @ExternalResource(resourceProvider = ExternalResourceProvider.class,location = "")
+    public InputStream getInputStream(final InjectionPoint injectionPoint)
+    {
+        ExternalResource externalResource = getAnnotation(injectionPoint);
+        ExternalResourceProvider provider = BeanProvider.getContextualReference(externalResource.resourceProvider());
+        final InputStream is = provider.readStream(externalResource);
+        return is;
+    }
+
+    @Produces
+    @ExternalResource(resourceProvider = ExternalResourceProvider.class,location = "")
+    public List<InputStream> getInputStreams(final InjectionPoint injectionPoint)
+    {
+        ExternalResource externalResource = getAnnotation(injectionPoint);
+        ExternalResourceProvider provider = BeanProvider.getContextualReference(externalResource.resourceProvider());
+        return provider.readStreams(externalResource);
+    }
+
+    @Produces
+    @ExternalResource(resourceProvider = ExternalResourceProvider.class,location = "")
+    public Properties getProperties(final InjectionPoint injectionPoint) throws IOException
+    {
+        ExternalResource externalResource = getAnnotation(injectionPoint);
+        ExternalResourceProvider provider = BeanProvider.getContextualReference(externalResource.resourceProvider());
+        final Properties properties = provider.readProperties(externalResource);
+        return properties;
+    }
+
+    public void closeInputStream(@Disposes
+                                 @ExternalResource(resourceProvider = ExternalResourceProvider.class, location = "")
+                                 InputStream inputStream)
+    {
+        if (inputStream != null)
+        {
+            try
+            {
+                inputStream.close();
+            }
+            catch (IOException e)
+            {
+                if (logger.isLoggable(Level.FINE))
+                {
+                    logger.log(Level.FINE,"Unable to close input stream ",e);
+                }
+            }
+        }
+    }
+
+    private ExternalResource getAnnotation(final InjectionPoint injectionPoint)
+    {
+        for (Annotation annotation : injectionPoint.getQualifiers())
+        {
+            if (annotation instanceof ExternalResource)
+            {
+                return (ExternalResource)annotation;
+            }
+        }
+        return null;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/1b40518a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/resourceloader/ExternalResourceProvider.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/resourceloader/ExternalResourceProvider.java b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/resourceloader/ExternalResourceProvider.java
new file mode 100644
index 0000000..ac451c0
--- /dev/null
+++ b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/resourceloader/ExternalResourceProvider.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.deltaspike.core.api.resourceloader;
+
+import java.io.InputStream;
+import java.util.List;
+import java.util.Properties;
+
+/**
+ * Provides lookup capability to find a resource.
+ *
+ */
+public interface ExternalResourceProvider
+{
+
+    InputStream readStream(final ExternalResource externalResource);
+
+    List<InputStream> readStreams(final ExternalResource externalResource);
+
+    Properties readProperties(final ExternalResource externalResource);
+
+}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/1b40518a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/resourceloader/ExternalResourceStorage.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/resourceloader/ExternalResourceStorage.java b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/resourceloader/ExternalResourceStorage.java
deleted file mode 100644
index c9db85d..0000000
--- a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/resourceloader/ExternalResourceStorage.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.apache.deltaspike.core.api.resourceloader;
-
-/**
- * A marker interface for types of external resource storage.
- */
-public interface ExternalResourceStorage
-{
-}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/1b40518a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/resourceloader/FileResourceProvider.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/resourceloader/FileResourceProvider.java b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/resourceloader/FileResourceProvider.java
new file mode 100644
index 0000000..729250b
--- /dev/null
+++ b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/resourceloader/FileResourceProvider.java
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.deltaspike.core.api.resourceloader;
+
+import javax.enterprise.context.ApplicationScoped;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.InputStream;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * A file based resource provider, looking for a file based on the name.
+ */
+@ApplicationScoped
+public class FileResourceProvider extends BaseResourceProvider
+{
+    private static final Logger logger = Logger.getLogger(FileResourceProvider.class.getName());
+    InputStream readFile(final String name)
+    {
+        File f = new File(name);
+        if (f.exists() && f.canRead() && f.isFile())
+        {
+            try
+            {
+                return new FileInputStream(f);
+            }
+            catch (FileNotFoundException e)
+            {
+                logger.log(Level.SEVERE, "Problem reading resource.", e);
+                return null;
+            }
+        }
+        else
+        {
+            return null;
+        }
+    }
+
+    @Override
+    public InputStream readStream(ExternalResource externalResource)
+    {
+        return readFile(externalResource.location());
+    }
+}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/1b40518a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/resourceloader/FileSystemStorage.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/resourceloader/FileSystemStorage.java b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/resourceloader/FileSystemStorage.java
deleted file mode 100644
index d3e23b0..0000000
--- a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/resourceloader/FileSystemStorage.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.apache.deltaspike.core.api.resourceloader;
-
-/**
- * A File System marker for external resources.
- */
-public interface FileSystemStorage extends ExternalResourceStorage
-{
-}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/1b40518a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/spi/literal/StorageTypeLiteral.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/spi/literal/StorageTypeLiteral.java b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/spi/literal/StorageTypeLiteral.java
deleted file mode 100644
index 4b585b1..0000000
--- a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/spi/literal/StorageTypeLiteral.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.apache.deltaspike.core.spi.literal;
-
-import org.apache.deltaspike.core.api.resourceloader.ExternalResourceStorage;
-import org.apache.deltaspike.core.spi.resourceloader.StorageType;
-
-import javax.enterprise.util.AnnotationLiteral;
-
-public class StorageTypeLiteral extends AnnotationLiteral<StorageType> implements StorageType
-{
-    private static final long serialVersionUID = 9066640252429716441L;
-
-    private Class<? extends ExternalResourceStorage> value;
-    public StorageTypeLiteral(Class<? extends ExternalResourceStorage> value)
-    {
-        this.value = value;
-    }
-    @Override
-    public Class<? extends ExternalResourceStorage> value()
-    {
-        return this.value;
-    }
-}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/1b40518a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/spi/resourceloader/ExternalResourceProvider.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/spi/resourceloader/ExternalResourceProvider.java b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/spi/resourceloader/ExternalResourceProvider.java
deleted file mode 100644
index 824e4d7..0000000
--- a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/spi/resourceloader/ExternalResourceProvider.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.apache.deltaspike.core.spi.resourceloader;
-
-import org.apache.deltaspike.core.api.resourceloader.ExternalResource;
-
-import java.io.InputStream;
-import java.util.List;
-import java.util.Properties;
-
-/**
- * Provides lookup capability to find a resource.
- *
- */
-public interface ExternalResourceProvider
-{
-
-    InputStream readStream(final ExternalResource externalResource);
-
-    List<InputStream> readStreams(final ExternalResource externalResource);
-
-    Properties readProperties(final ExternalResource externalResource);
-
-}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/1b40518a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/spi/resourceloader/StorageType.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/spi/resourceloader/StorageType.java b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/spi/resourceloader/StorageType.java
deleted file mode 100644
index d7f8c54..0000000
--- a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/spi/resourceloader/StorageType.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.apache.deltaspike.core.spi.resourceloader;
-
-import org.apache.deltaspike.core.api.resourceloader.ExternalResourceStorage;
-
-import javax.inject.Qualifier;
-import java.lang.annotation.Documented;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-import static java.lang.annotation.ElementType.TYPE;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.ElementType.FIELD;
-
-/**
- * Represents the type of storage that the given ExternalResourceProvider handles.
- *
- */
-@Target( { TYPE, METHOD, PARAMETER, FIELD })
-@Retention(value = RetentionPolicy.RUNTIME)
-@Documented
-@Qualifier
-//TODO re-visit it (not needed, if we merge ExternalResourceStorage with ExternalResourceProvider - see DELTASPIKE-399)
-public @interface StorageType
-{
-    Class<? extends ExternalResourceStorage> value();
-}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/1b40518a/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/resourceloader/BaseResourceProvider.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/resourceloader/BaseResourceProvider.java b/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/resourceloader/BaseResourceProvider.java
deleted file mode 100644
index 7319213..0000000
--- a/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/resourceloader/BaseResourceProvider.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.apache.deltaspike.core.impl.resourceloader;
-
-import org.apache.deltaspike.core.api.resourceloader.ExternalResource;
-import org.apache.deltaspike.core.spi.resourceloader.ExternalResourceProvider;
-
-import javax.enterprise.inject.Any;
-import javax.enterprise.inject.Instance;
-import javax.enterprise.inject.spi.InjectionPoint;
-import javax.inject.Inject;
-import java.io.IOException;
-import java.io.InputStream;
-import java.lang.annotation.Annotation;
-import java.util.Collections;
-import java.util.List;
-import java.util.Properties;
-import java.util.Set;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * An abstract ExternalResourceProvider implementation with some basic utility functionality.
- */
-public abstract class BaseResourceProvider implements ExternalResourceProvider
-{
-    private static final Logger logger = Logger.getLogger(BaseResourceProvider.class.getName());
-
-    @Inject
-    @Any
-    private Instance<InjectionPoint> injectionPoint;
-
-    protected boolean isXml(String fileName)
-    {
-        return fileName.endsWith(".xml");
-    }
-
-    protected InjectionPoint getInjectionPoint()
-    {
-        return this.injectionPoint.get();
-    }
-
-    protected Set<Annotation> getAnnotations()
-    {
-        return this.getInjectionPoint().getAnnotated().getAnnotations();
-    }
-
-    protected void loadInputStreamToProperties(InputStream inputStream, Properties properties, String name)
-    {
-        boolean isXml = this.isXml(name);
-        try
-        {
-            if (isXml)
-            {
-                properties.loadFromXML(inputStream);
-            }
-            else
-            {
-                properties.load(inputStream);
-            }
-        }
-        catch (IOException e)
-        {
-            logger.log(Level.WARNING,"Unable to read resource " + name,e);
-
-        }
-    }
-
-    @Override
-    public Properties readProperties(ExternalResource externalResource)
-    {
-        final Properties properties = new Properties();
-        final String name = externalResource.location();
-        final InputStream inputStream = this.readStream(externalResource);
-        this.loadInputStreamToProperties(inputStream, properties, name);
-        return properties;
-    }
-
-    @Override
-    public List<InputStream> readStreams(ExternalResource externalResource)
-    {
-        return Collections.singletonList(this.readStream(externalResource));
-    }
-}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/1b40518a/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/resourceloader/ClasspathResourceProvider.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/resourceloader/ClasspathResourceProvider.java b/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/resourceloader/ClasspathResourceProvider.java
deleted file mode 100644
index a2cf0d7..0000000
--- a/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/resourceloader/ClasspathResourceProvider.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.apache.deltaspike.core.impl.resourceloader;
-
-import org.apache.deltaspike.core.api.resourceloader.ClasspathStorage;
-import org.apache.deltaspike.core.api.resourceloader.ExternalResource;
-import org.apache.deltaspike.core.spi.resourceloader.StorageType;
-import org.apache.deltaspike.core.util.ClassUtils;
-
-import javax.enterprise.context.ApplicationScoped;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.List;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * A classpath based resource provider
- */
-@ApplicationScoped
-@StorageType(ClasspathStorage.class)
-public class ClasspathResourceProvider extends BaseResourceProvider
-{
-    private static final Logger logger = Logger.getLogger(ClasspathResourceProvider.class.getName());
-
-    @Override
-    public InputStream readStream(final ExternalResource externalResource)
-    {
-        try
-        {
-            List<InputStream> matchedStreams = this.readClassPath(externalResource.location(),true);
-            return matchedStreams.get(0);
-        }
-        catch (IOException e)
-        {
-            if (logger.isLoggable(Level.FINE))
-            {
-                logger.log(Level.FINE, "Problem reading resource.", e);
-            }
-            return null;
-        }
-    }
-
-    @Override
-    public List<InputStream> readStreams(ExternalResource externalResource)
-    {
-        try
-        {
-            return readClassPath(externalResource.location(),false);
-        }
-        catch (IOException e)
-        {
-            throw new IllegalStateException("Error while trying to load resources from classpath ",e);
-        }
-    }
-
-    /**
-     * Reads all possibly matching classpath entries for the given name.
-     *
-     * If requireUnique is true, then validates that 1 element is present before returning
-     *
-     * @param name
-     * @param requireUnique
-     * @return
-     * @throws IOException
-     * @throws IllegalStateException
-     */
-    private List<InputStream> readClassPath(final String name, final boolean requireUnique)
-        throws IllegalStateException,IOException
-    {
-        Enumeration<URL> urls = ClassUtils.getClassLoader(null).getResources(name);
-        List<URL> urlList = new ArrayList<URL>();
-        List<InputStream> results = new ArrayList<InputStream>();
-        while (urls.hasMoreElements())
-        {
-            URL url = urls.nextElement();
-            InputStream is = url.openStream();
-            if (is != null)
-            {
-                results.add(is);
-                urlList.add(url);
-            }
-        }
-        if (requireUnique && results.size() != 1)
-        {
-            String msg = urlsToString(urlList,name);
-            for (InputStream is : results)
-            {
-                try
-                {
-                    is.close();
-                }
-                catch (IOException e)
-                {
-                    if (logger.isLoggable(Level.FINE))
-                    {
-                        logger.log(Level.FINE,"Unable to close stream",e);
-                    }
-                }
-            }
-            throw new IllegalStateException(msg);
-        }
-        return results;
-    }
-
-    private String urlsToString(List<URL> urls, String name)
-    {
-        if (urls.size() == 0)
-        {
-            return String.format("No resources found for '%s'",name);
-        }
-        else
-        {
-            StringBuilder sb = new StringBuilder();
-            sb.append(String.format("multiple resources found for '%s'",name));
-            for (URL u : urls)
-            {
-                sb.append(" Match : ").append(u.toExternalForm());
-            }
-            return sb.toString();
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/1b40518a/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/resourceloader/ExternalResourceProducer.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/resourceloader/ExternalResourceProducer.java b/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/resourceloader/ExternalResourceProducer.java
deleted file mode 100644
index 019b42a..0000000
--- a/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/resourceloader/ExternalResourceProducer.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.apache.deltaspike.core.impl.resourceloader;
-
-import org.apache.deltaspike.core.api.resourceloader.ExternalResource;
-import org.apache.deltaspike.core.api.resourceloader.ExternalResourceStorage;
-import org.apache.deltaspike.core.spi.literal.StorageTypeLiteral;
-import org.apache.deltaspike.core.spi.resourceloader.ExternalResourceProvider;
-import org.apache.deltaspike.core.spi.resourceloader.StorageType;
-
-import javax.enterprise.context.ApplicationScoped;
-import javax.enterprise.inject.Any;
-import javax.enterprise.inject.Disposes;
-import javax.enterprise.inject.Instance;
-import javax.enterprise.inject.Produces;
-import javax.enterprise.inject.spi.InjectionPoint;
-import javax.inject.Inject;
-import java.io.IOException;
-import java.io.InputStream;
-import java.lang.annotation.Annotation;
-import java.util.List;
-import java.util.Properties;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * Handles the creation/loading of external resources.
- *
- */
-@ApplicationScoped
-public class ExternalResourceProducer
-{
-    private static final Logger logger = Logger.getLogger(ExternalResourceProducer.class.getName());
-
-    @Inject
-    @Any
-    private Instance<ExternalResourceProvider> resourceProviders;
-
-    private ExternalResourceProvider getProvider(Class<? extends ExternalResourceStorage> storageTypeClass)
-    {
-        StorageType storageType = new StorageTypeLiteral(storageTypeClass);
-        ExternalResourceProvider provider = resourceProviders.select(storageType).get();
-        return provider;
-    }
-
-    @Produces
-    @ExternalResource(storage = ExternalResourceStorage.class,location = "")
-    public InputStream getInputStream(final InjectionPoint injectionPoint)
-    {
-        ExternalResource externalResource = getAnnotation(injectionPoint);
-        ExternalResourceProvider provider = getProvider(externalResource.storage());
-        final InputStream is = provider.readStream(externalResource);
-        return is;
-    }
-
-    @Produces
-    @ExternalResource(storage = ExternalResourceStorage.class,location = "")
-    public List<InputStream> getInputStreams(final InjectionPoint injectionPoint)
-    {
-        ExternalResource externalResource = getAnnotation(injectionPoint);
-        ExternalResourceProvider provider = getProvider(externalResource.storage());
-        return provider.readStreams(externalResource);
-    }
-
-    @Produces
-    @ExternalResource(storage = ExternalResourceStorage.class,location = "")
-    public Properties getProperties(final InjectionPoint injectionPoint) throws IOException
-    {
-        ExternalResource externalResource = getAnnotation(injectionPoint);
-        ExternalResourceProvider provider = getProvider(externalResource.storage());
-        final Properties properties = provider.readProperties(externalResource);
-        return properties;
-    }
-
-    public void closeInputStream(@Disposes @ExternalResource(storage = ExternalResourceStorage.class,location = "")
-                                 InputStream inputStream)
-    {
-        if (inputStream != null)
-        {
-            try
-            {
-                inputStream.close();
-            }
-            catch (IOException e)
-            {
-                if (logger.isLoggable(Level.FINE))
-                {
-                    logger.log(Level.FINE,"Unable to close input stream ",e);
-                }
-            }
-        }
-    }
-
-    private ExternalResource getAnnotation(final InjectionPoint injectionPoint)
-    {
-        for (Annotation annotation : injectionPoint.getQualifiers())
-        {
-            if (annotation instanceof ExternalResource)
-            {
-                return (ExternalResource)annotation;
-            }
-        }
-        return null;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/1b40518a/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/resourceloader/FileResourceProvider.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/resourceloader/FileResourceProvider.java b/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/resourceloader/FileResourceProvider.java
deleted file mode 100644
index 26dfd45..0000000
--- a/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/resourceloader/FileResourceProvider.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.apache.deltaspike.core.impl.resourceloader;
-
-import org.apache.deltaspike.core.api.resourceloader.ExternalResource;
-import org.apache.deltaspike.core.api.resourceloader.FileSystemStorage;
-import org.apache.deltaspike.core.spi.resourceloader.StorageType;
-
-import javax.enterprise.context.ApplicationScoped;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.InputStream;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * A file based resource provider, looking for a file based on the name.
- */
-@ApplicationScoped
-@StorageType(FileSystemStorage.class)
-public class FileResourceProvider extends BaseResourceProvider
-{
-    private static final Logger logger = Logger.getLogger(FileResourceProvider.class.getName());
-    InputStream readFile(final String name)
-    {
-        File f = new File(name);
-        if (f.exists() && f.canRead() && f.isFile())
-        {
-            try
-            {
-                return new FileInputStream(f);
-            }
-            catch (FileNotFoundException e)
-            {
-                logger.log(Level.SEVERE, "Problem reading resource.", e);
-                return null;
-            }
-        }
-        else
-        {
-            return null;
-        }
-    }
-
-    @Override
-    public InputStream readStream(ExternalResource externalResource)
-    {
-        return readFile(externalResource.location());
-    }
-}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/1b40518a/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/resourceloader/ResourceLoaderExtension.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/resourceloader/ResourceLoaderExtension.java b/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/resourceloader/ResourceLoaderExtension.java
index 7d2a2e3..c1c2c7d 100644
--- a/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/resourceloader/ResourceLoaderExtension.java
+++ b/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/resourceloader/ResourceLoaderExtension.java
@@ -18,6 +18,10 @@
  */
 package org.apache.deltaspike.core.impl.resourceloader;
 
+import org.apache.deltaspike.core.api.resourceloader.ClasspathResourceProvider;
+import org.apache.deltaspike.core.api.resourceloader.ExternalResourceProducer;
+import org.apache.deltaspike.core.api.resourceloader.FileResourceProvider;
+
 import javax.enterprise.inject.spi.AnnotatedType;
 import javax.enterprise.inject.spi.BeanManager;
 import javax.enterprise.inject.spi.BeforeBeanDiscovery;

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/1b40518a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/resourceloader/ClasspathResourceTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/resourceloader/ClasspathResourceTest.java b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/resourceloader/ClasspathResourceTest.java
index b5f3eb2..7aba4c1 100644
--- a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/resourceloader/ClasspathResourceTest.java
+++ b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/resourceloader/ClasspathResourceTest.java
@@ -18,7 +18,6 @@
  */
 package org.apache.deltaspike.test.core.impl.resourceloader;
 
-import org.apache.deltaspike.core.api.resourceloader.ClasspathStorage;
 import org.apache.deltaspike.core.api.resourceloader.ExternalResource;
 import org.apache.deltaspike.test.category.SeCategory;
 import org.apache.deltaspike.test.util.ArchiveUtils;
@@ -53,11 +52,11 @@ public class ClasspathResourceTest
     }
 
     @Inject
-    @ExternalResource(storage = ClasspathStorage.class,location="myconfig.properties")
+    @ExternalResource(location="myconfig.properties")
     private InputStream inputStream;
 
     @Inject
-    @ExternalResource(storage = ClasspathStorage.class,location="myconfig.properties")
+    @ExternalResource(location="myconfig.properties")
     private Properties properties;
 
 
@@ -78,16 +77,14 @@ public class ClasspathResourceTest
     }
 
     @Test
-    public void testAmbiguousFileLookup(@ExternalResource(storage=ClasspathStorage.class,
-            location="META-INF/beans.xml") InputStream inputStream)
+    public void testAmbiguousFileLookup(@ExternalResource(location="META-INF/beans.xml") InputStream inputStream)
     {
         // for some reason, this works
         Assert.assertNull(inputStream);
     }
 
     @Test
-    public void testSuccessfulAmbiguousLookup(@ExternalResource(storage = ClasspathStorage.class,
-            location="META-INF/beans.xml") List<InputStream> inputStreams)
+    public void testSuccessfulAmbiguousLookup(@ExternalResource(location="META-INF/beans.xml") List<InputStream> inputStreams)
     {
         Assert.assertTrue(inputStreams.size() > 1); //the count is different on as7 compared to the standalone setup
     }

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/1b40518a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/resourceloader/ClasspathWebProfileTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/resourceloader/ClasspathWebProfileTest.java b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/resourceloader/ClasspathWebProfileTest.java
index e397bd1..9f89f2c 100644
--- a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/resourceloader/ClasspathWebProfileTest.java
+++ b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/resourceloader/ClasspathWebProfileTest.java
@@ -18,7 +18,6 @@
  */
 package org.apache.deltaspike.test.core.impl.resourceloader;
 
-import org.apache.deltaspike.core.api.resourceloader.ClasspathStorage;
 import org.apache.deltaspike.core.api.resourceloader.ExternalResource;
 import org.apache.deltaspike.test.category.WebProfileCategory;
 import org.apache.deltaspike.test.util.ArchiveUtils;
@@ -58,11 +57,11 @@ public class ClasspathWebProfileTest
     }
 
     @Inject
-    @ExternalResource(storage = ClasspathStorage.class,location="myconfig.properties")
+    @ExternalResource(location="myconfig.properties")
     private InputStream inputStream;
 
     @Inject
-    @ExternalResource(storage = ClasspathStorage.class,location="myconfig.properties")
+    @ExternalResource(location="myconfig.properties")
     private Properties properties;
 
     @Test
@@ -82,15 +81,13 @@ public class ClasspathWebProfileTest
     }
 
     @Test
-    public void testAmbiguousFileLookup(@ExternalResource(storage=ClasspathStorage.class,
-            location="META-INF/beans.xml") InputStream inputStream)
+    public void testAmbiguousFileLookup(@ExternalResource(location="META-INF/beans.xml") InputStream inputStream)
     {
         Assert.assertNull(inputStream); // for some reason, this works, exception no longer thrown.
     }
 
     @Test
-    public void testSuccessfulAmbiguousLookup(@ExternalResource(storage = ClasspathStorage.class,
-            location="META-INF/beans.xml") List<InputStream> inputStreams)
+    public void testSuccessfulAmbiguousLookup(@ExternalResource(location="META-INF/beans.xml") List<InputStream> inputStreams)
     {
         Assert.assertTrue(inputStreams.size() > 1); //the count is different on as7 compared to the standalone setup
     }

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/1b40518a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/resourceloader/FileResourceTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/resourceloader/FileResourceTest.java b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/resourceloader/FileResourceTest.java
index a40c1f8..e24bea4 100644
--- a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/resourceloader/FileResourceTest.java
+++ b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/resourceloader/FileResourceTest.java
@@ -19,7 +19,7 @@
 package org.apache.deltaspike.test.core.impl.resourceloader;
 
 import org.apache.deltaspike.core.api.resourceloader.ExternalResource;
-import org.apache.deltaspike.core.api.resourceloader.FileSystemStorage;
+import org.apache.deltaspike.core.api.resourceloader.FileResourceProvider;
 import org.apache.deltaspike.core.util.ExceptionUtils;
 import org.apache.deltaspike.test.category.SeCategory;
 import org.apache.deltaspike.test.util.ArchiveUtils;
@@ -81,7 +81,7 @@ public class FileResourceTest
     }
 
     @Test
-    public void testInputStream(@ExternalResource(storage=FileSystemStorage.class,
+    public void testInputStream(@ExternalResource(resourceProvider = FileResourceProvider.class,
             location="target/propsdsfileresource.properties")
             InputStream inputStream) throws IOException
     {
@@ -92,7 +92,7 @@ public class FileResourceTest
     }
 
     @Test
-    public void testProperties(@ExternalResource(storage=FileSystemStorage.class,
+    public void testProperties(@ExternalResource(resourceProvider = FileResourceProvider.class,
             location="target/propsdsfileresource.properties")
             Properties properties)
     {

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/1b40518a/deltaspike/modules/servlet/api/src/main/java/org/apache/deltaspike/servlet/api/resourceloader/WebResourceProvider.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/servlet/api/src/main/java/org/apache/deltaspike/servlet/api/resourceloader/WebResourceProvider.java b/deltaspike/modules/servlet/api/src/main/java/org/apache/deltaspike/servlet/api/resourceloader/WebResourceProvider.java
new file mode 100644
index 0000000..68da89b
--- /dev/null
+++ b/deltaspike/modules/servlet/api/src/main/java/org/apache/deltaspike/servlet/api/resourceloader/WebResourceProvider.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.deltaspike.servlet.api.resourceloader;
+
+import java.io.InputStream;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Inject;
+import javax.servlet.ServletContext;
+
+import org.apache.deltaspike.core.api.resourceloader.BaseResourceProvider;
+import org.apache.deltaspike.core.api.resourceloader.ExternalResource;
+import org.apache.deltaspike.servlet.api.Web;
+
+/**
+ * Loads resources using {@link ServletContext#getResource(String)}.
+ */
+@ApplicationScoped
+public class WebResourceProvider extends BaseResourceProvider
+{
+    @Inject
+    @Web
+    private ServletContext servletContext;
+
+    @Override
+    public InputStream readStream(ExternalResource externalResource)
+    {
+        /*
+         * ServletContext.getResourceAsStream() requires the path to start with "/". We add it here if it is missing
+         * because it is a common mistake to miss it.
+         */
+        String path = externalResource.location();
+        if (!path.startsWith("/"))
+        {
+            path = "/" + path;
+        }
+
+        return servletContext.getResourceAsStream(path);
+    }
+}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/1b40518a/deltaspike/modules/servlet/api/src/main/java/org/apache/deltaspike/servlet/api/resourceloader/WebStorage.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/servlet/api/src/main/java/org/apache/deltaspike/servlet/api/resourceloader/WebStorage.java b/deltaspike/modules/servlet/api/src/main/java/org/apache/deltaspike/servlet/api/resourceloader/WebStorage.java
deleted file mode 100644
index f9bf971..0000000
--- a/deltaspike/modules/servlet/api/src/main/java/org/apache/deltaspike/servlet/api/resourceloader/WebStorage.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.apache.deltaspike.servlet.api.resourceloader;
-
-import org.apache.deltaspike.core.api.resourceloader.ExternalResourceStorage;
-
-/**
- * Loads resources using <code>ServletContext.getResource()</code>
- */
-public interface WebStorage extends ExternalResourceStorage
-{
-}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/1b40518a/deltaspike/modules/servlet/impl/src/main/java/org/apache/deltaspike/servlet/impl/resourceloader/WebResourceProvider.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/servlet/impl/src/main/java/org/apache/deltaspike/servlet/impl/resourceloader/WebResourceProvider.java b/deltaspike/modules/servlet/impl/src/main/java/org/apache/deltaspike/servlet/impl/resourceloader/WebResourceProvider.java
deleted file mode 100644
index e32640a..0000000
--- a/deltaspike/modules/servlet/impl/src/main/java/org/apache/deltaspike/servlet/impl/resourceloader/WebResourceProvider.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.apache.deltaspike.servlet.impl.resourceloader;
-
-import java.io.InputStream;
-
-import javax.enterprise.context.ApplicationScoped;
-import javax.inject.Inject;
-import javax.servlet.ServletContext;
-
-import org.apache.deltaspike.core.api.resourceloader.ExternalResource;
-import org.apache.deltaspike.core.impl.resourceloader.BaseResourceProvider;
-import org.apache.deltaspike.core.spi.resourceloader.StorageType;
-import org.apache.deltaspike.servlet.api.Web;
-import org.apache.deltaspike.servlet.api.resourceloader.WebStorage;
-
-/**
- * Loads resources using {@link ServletContext#getResource(String)}.
- */
-@ApplicationScoped
-@StorageType(WebStorage.class)
-public class WebResourceProvider extends BaseResourceProvider
-{
-
-    @Inject
-    @Web
-    private ServletContext servletContext;
-
-    @Override
-    public InputStream readStream(ExternalResource externalResource)
-    {
-
-        /*
-         * ServletContext.getResourceAsStream() requires the path to start with "/". We add it here if it is missing
-         * because it is a common mistake to miss it.
-         */
-        String path = externalResource.location();
-        if (!path.startsWith("/"))
-        {
-            path = "/" + path;
-        }
-
-        return servletContext.getResourceAsStream(path);
-
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/1b40518a/deltaspike/modules/servlet/impl/src/test/java/org/apache/deltaspike/test/servlet/impl/resourceloader/WebResourceProviderTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/servlet/impl/src/test/java/org/apache/deltaspike/test/servlet/impl/resourceloader/WebResourceProviderTest.java b/deltaspike/modules/servlet/impl/src/test/java/org/apache/deltaspike/test/servlet/impl/resourceloader/WebResourceProviderTest.java
index f72998e..fc956d3 100644
--- a/deltaspike/modules/servlet/impl/src/test/java/org/apache/deltaspike/test/servlet/impl/resourceloader/WebResourceProviderTest.java
+++ b/deltaspike/modules/servlet/impl/src/test/java/org/apache/deltaspike/test/servlet/impl/resourceloader/WebResourceProviderTest.java
@@ -27,7 +27,7 @@ import java.util.Properties;
 import javax.inject.Inject;
 
 import org.apache.deltaspike.core.api.resourceloader.ExternalResource;
-import org.apache.deltaspike.servlet.api.resourceloader.WebStorage;
+import org.apache.deltaspike.servlet.api.resourceloader.WebResourceProvider;
 import org.apache.deltaspike.test.category.WebProfileCategory;
 import org.apache.deltaspike.test.servlet.impl.Deployments;
 import org.jboss.arquillian.container.test.api.Deployment;
@@ -58,19 +58,19 @@ public class WebResourceProviderTest
     }
 
     @Inject
-    @ExternalResource(location = "/foobar.txt", storage = WebStorage.class)
+    @ExternalResource(location = "/foobar.txt", resourceProvider = WebResourceProvider.class)
     private InputStream streamAbsolutePath;
 
     @Inject
-    @ExternalResource(location = "foobar.txt", storage = WebStorage.class)
+    @ExternalResource(location = "foobar.txt", resourceProvider = WebResourceProvider.class)
     private InputStream streamRelativePath;
 
     @Inject
-    @ExternalResource(location = "/foo/bar.txt", storage = WebStorage.class)
+    @ExternalResource(location = "/foo/bar.txt", resourceProvider = WebResourceProvider.class)
     private InputStream streamDirectory;
 
     @Inject
-    @ExternalResource(location = "/foobar.properties", storage = WebStorage.class)
+    @ExternalResource(location = "/foobar.properties", resourceProvider = WebResourceProvider.class)
     private Properties propertiesAbsolutePath;
 
     @Test