You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by db...@apache.org on 2006/05/16 04:45:46 UTC

svn commit: r406805 - in /geronimo/xbean/trunk/xbean-finder: ./ src/main/java/org/apache/xbean/finder/ src/test/java/org/acme/ src/test/java/org/apache/xbean/finder/ src/test/java/org/apache/xbean/finder/util/ src/test/resources/META-INF/ src/test/reso...

Author: dblevins
Date: Mon May 15 19:45:42 2006
New Revision: 406805

URL: http://svn.apache.org/viewcvs?rev=406805&view=rev
Log:
The most useful utility in the world.
Moved from openejb

Added:
    geronimo/xbean/trunk/xbean-finder/src/main/java/org/apache/xbean/finder/
    geronimo/xbean/trunk/xbean-finder/src/main/java/org/apache/xbean/finder/ResourceFinder.java
    geronimo/xbean/trunk/xbean-finder/src/test/java/org/acme/
    geronimo/xbean/trunk/xbean-finder/src/test/java/org/acme/BarUrlHandler.java
    geronimo/xbean/trunk/xbean-finder/src/test/java/org/acme/FooUrlHandler.java
    geronimo/xbean/trunk/xbean-finder/src/test/java/org/acme/One.java
    geronimo/xbean/trunk/xbean-finder/src/test/java/org/acme/Three.java
    geronimo/xbean/trunk/xbean-finder/src/test/java/org/acme/Two.java
    geronimo/xbean/trunk/xbean-finder/src/test/java/org/acme/javaURLContextFactory.java
    geronimo/xbean/trunk/xbean-finder/src/test/java/org/acme/kernelURLContextFactory.java
    geronimo/xbean/trunk/xbean-finder/src/test/java/org/acme/ldapURLContextFactory.java
    geronimo/xbean/trunk/xbean-finder/src/test/java/org/apache/xbean/finder/
    geronimo/xbean/trunk/xbean-finder/src/test/java/org/apache/xbean/finder/ResourceFinderTest.java
    geronimo/xbean/trunk/xbean-finder/src/test/java/org/apache/xbean/finder/util/
    geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/
    geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/externalizables/
    geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/externalizables/one
    geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/externalizables/three
    geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/externalizables/two
    geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/java.io.InputStream
    geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/java.io.OutputStream
    geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/java.io.Serializable
    geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/java.net.URLStreamHandler/
    geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/java.net.URLStreamHandler/bar
    geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/java.net.URLStreamHandler/baz
    geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/java.net.URLStreamHandler/foo
    geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/javax.naming.spi.ObjectFactory/
    geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/javax.naming.spi.ObjectFactory/java
    geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/javax.naming.spi.ObjectFactory/kernel
    geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/javax.naming.spi.ObjectFactory/ldap
    geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/movies/
    geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/movies/ishtar.properties
    geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/movies/kingkong.properties
    geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/movies/serentity.properties
    geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/serializables/
    geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/serializables/one
    geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/serializables/three
    geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/serializables/two
    geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/tvshows/
    geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/tvshows/familyguy.properties
    geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/tvshows/simpsons.properties
Modified:
    geronimo/xbean/trunk/xbean-finder/pom.xml

Modified: geronimo/xbean/trunk/xbean-finder/pom.xml
URL: http://svn.apache.org/viewcvs/geronimo/xbean/trunk/xbean-finder/pom.xml?rev=406805&r1=406804&r2=406805&view=diff
==============================================================================
--- geronimo/xbean/trunk/xbean-finder/pom.xml (original)
+++ geronimo/xbean/trunk/xbean-finder/pom.xml Mon May 15 19:45:42 2006
@@ -8,4 +8,15 @@
   <artifactId>xbean-finder</artifactId>
   <name>XBean :: Classpath Resource Finder</name>
   <version>2.4-SNAPSHOT</version>
+  <build>
+    <plugins>
+      <plugin>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <configuration>
+          <source>1.5</source>
+          <target>1.5</target>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
 </project>

Added: geronimo/xbean/trunk/xbean-finder/src/main/java/org/apache/xbean/finder/ResourceFinder.java
URL: http://svn.apache.org/viewcvs/geronimo/xbean/trunk/xbean-finder/src/main/java/org/apache/xbean/finder/ResourceFinder.java?rev=406805&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-finder/src/main/java/org/apache/xbean/finder/ResourceFinder.java (added)
+++ geronimo/xbean/trunk/xbean-finder/src/main/java/org/apache/xbean/finder/ResourceFinder.java Mon May 15 19:45:42 2006
@@ -0,0 +1,453 @@
+package org.apache.xbean.finder;
+
+import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.JarURLConnection;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Iterator;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
+
+public class ResourceFinder {
+
+    private final String path;
+    private final ClassLoader classLoader;
+
+    public ResourceFinder(String path) {
+        this(path, Thread.currentThread().getContextClassLoader());
+    }
+
+    public ResourceFinder(String path, ClassLoader classLoader) {
+        this.path = path;
+        this.classLoader = classLoader;
+    }
+
+
+    // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+    //
+    //   Find String
+    //
+    // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+
+    public String findString(String key) throws IOException {
+        String uri = path + key;
+
+        URL resource = classLoader.getResource(uri);
+        if (resource == null) {
+            throw new IOException("Could not find command in : " + uri);
+        }
+
+        return readContents(resource);
+    }
+
+    public List<String> findAllStrings(String key) throws IOException {
+        String uri = path + key;
+
+        List<String> strings = new ArrayList<String>();
+
+        Enumeration<URL> resources = classLoader.getResources(uri);
+        while (resources.hasMoreElements()) {
+            URL url = resources.nextElement();
+            String string = readContents(url);
+            strings.add(string);
+        }
+        return strings;
+    }
+
+    public List<String> findAvailableStrings(String key) throws IOException {
+        String uri = path + key;
+
+        List<String> strings = new ArrayList<String>();
+
+        Enumeration<URL> resources = classLoader.getResources(uri);
+        while (resources.hasMoreElements()) {
+            try {
+                URL url = resources.nextElement();
+                String string = readContents(url);
+                strings.add(string);
+            } catch (Exception notAvailable) {
+            }
+        }
+        return strings;
+    }
+
+    public Map<String,String> mapAllStrings(String key) throws IOException {
+        Map<String,String> strings = new HashMap<String,String>();
+        Map<String, URL> resourcesMap = getResourcesMap(key);
+        for (Iterator iterator = resourcesMap.entrySet().iterator(); iterator.hasNext();) {
+            Map.Entry entry = (Map.Entry) iterator.next();
+            String name = (String) entry.getKey();
+            URL url = (URL) entry.getValue();
+            String value = readContents(url);
+            strings.put(name,value);
+        }
+        return strings;
+    }
+
+    public Map<String,String> mapAvailableStrings(String key) throws IOException {
+        Map<String,String> strings = new HashMap<String,String>();
+        Map<String, URL> resourcesMap = getResourcesMap(key);
+        for (Iterator iterator = resourcesMap.entrySet().iterator(); iterator.hasNext();) {
+            try {
+                Map.Entry entry = (Map.Entry) iterator.next();
+                String name = (String) entry.getKey();
+                URL url = (URL) entry.getValue();
+                String value = readContents(url);
+                strings.put(name,value);
+            } catch (Exception notAvailable) {
+            }
+        }
+        return strings;
+    }
+
+
+    // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+    //
+    //   Find Class
+    //
+    // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+
+    public Class findClass(String key) throws IOException, ClassNotFoundException {
+        String className = findString(key);
+        Class clazz = classLoader.loadClass(className);
+        return clazz;
+    }
+
+    public List<Class> findAllClasses(String key) throws IOException, ClassNotFoundException {
+        List<Class> classes = new ArrayList<Class>();
+        List<String> strings = findAllStrings(key);
+        for (String className : strings) {
+            Class clazz = classLoader.loadClass(className);
+            classes.add(clazz);
+        }
+        return classes;
+    }
+
+    public List<Class> findAvailableClasses(String key) throws IOException {
+        List<Class> classes = new ArrayList<Class>();
+        List<String> strings = findAvailableStrings(key);
+        for (String className : strings) {
+            try {
+                Class clazz = classLoader.loadClass(className);
+                classes.add(clazz);
+            } catch (Exception notAvailable) {
+            }
+        }
+        return classes;
+    }
+
+    public Map<String, Class> mapAllClasses(String key) throws IOException, ClassNotFoundException {
+        Map<String, Class> classes = new HashMap<String, Class>();
+        Map<String, String> map = mapAllStrings(key);
+        for (Iterator iterator = map.entrySet().iterator(); iterator.hasNext();) {
+            Map.Entry entry = (Map.Entry) iterator.next();
+            String string = (String) entry.getKey();
+            String className = (String) entry.getValue();
+            Class clazz = classLoader.loadClass(className);
+            classes.put(string, clazz);
+        }
+        return classes;
+    }
+
+    public Map<String, Class> mapAvailableClasses(String key) throws IOException {
+        Map<String, Class> classes = new HashMap<String, Class>();
+        Map<String, String> map = mapAvailableStrings(key);
+        for (Iterator iterator = map.entrySet().iterator(); iterator.hasNext();) {
+            try {
+                Map.Entry entry = (Map.Entry) iterator.next();
+                String string = (String) entry.getKey();
+                String className = (String) entry.getValue();
+                Class clazz = classLoader.loadClass(className);
+                classes.put(string, clazz);
+            } catch (Exception notAvailable) {
+            }
+        }
+        return classes;
+    }
+
+    // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+    //
+    //   Find Implementation
+    //
+    // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+
+    public Class findImplementation(Class interfase) throws IOException, ClassNotFoundException {
+        String className = findString(interfase.getName());
+        Class impl = classLoader.loadClass(className);
+        if (!interfase.isAssignableFrom(impl)) {
+            throw new ClassCastException("Class not of type: " + interfase.getName());
+        }
+        return impl;
+    }
+
+    public List<Class> findAllImplementations(Class interfase) throws IOException, ClassNotFoundException {
+        List<Class> implementations = new ArrayList<Class>();
+        List<String> strings = findAllStrings(interfase.getName());
+        for (String className : strings) {
+            Class impl = classLoader.loadClass(className);
+            if (!interfase.isAssignableFrom(impl)) {
+                throw new ClassCastException("Class not of type: " + interfase.getName());
+            }
+            implementations.add(impl);
+        }
+        return implementations;
+    }
+
+    public List<Class> findAvailableImplementations(Class interfase) throws IOException {
+        List<Class> implementations = new ArrayList<Class>();
+        List<String> strings = findAvailableStrings(interfase.getName());
+        for (String className : strings) {
+            try {
+                Class impl = classLoader.loadClass(className);
+                if (interfase.isAssignableFrom(impl)) {
+                    implementations.add(impl);
+                }
+            } catch (Exception notAvailable) {
+            }
+        }
+        return implementations;
+    }
+
+    public Map<String, Class> mapAllImplementations(Class interfase) throws IOException, ClassNotFoundException {
+        Map<String, Class> implementations = new HashMap<String, Class>();
+        Map<String, String> map = mapAllStrings(interfase.getName());
+        for (Iterator iterator = map.entrySet().iterator(); iterator.hasNext();) {
+            Map.Entry entry = (Map.Entry) iterator.next();
+            String string = (String) entry.getKey();
+            String className = (String) entry.getValue();
+            Class impl = classLoader.loadClass(className);
+            if (!interfase.isAssignableFrom(impl)) {
+                throw new ClassCastException("Class not of type: " + interfase.getName());
+            }
+            implementations.put(string, impl);
+        }
+        return implementations;
+    }
+
+    public Map<String, Class> mapAvailableImplementations(Class interfase) throws IOException {
+        Map<String, Class> implementations = new HashMap<String, Class>();
+        Map<String, String> map = mapAvailableStrings(interfase.getName());
+        for (Iterator iterator = map.entrySet().iterator(); iterator.hasNext();) {
+            try {
+                Map.Entry entry = (Map.Entry) iterator.next();
+                String string = (String) entry.getKey();
+                String className = (String) entry.getValue();
+                Class impl = classLoader.loadClass(className);
+                if (interfase.isAssignableFrom(impl)) {
+                    implementations.put(string, impl);
+                }
+            } catch (Exception notAvailable) {
+            }
+        }
+        return implementations;
+    }
+
+
+    // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+    //
+    //   Find Properties
+    //
+    // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+
+    public Properties findProperties(String key) throws IOException {
+        String uri = path + key;
+
+        URL resource = classLoader.getResource(uri);
+        if (resource == null) {
+            throw new IOException("Could not find command in : " + uri);
+        }
+
+        return loadProperties(resource);
+    }
+
+    public List<Properties> findAllProperties(String key) throws IOException {
+        String uri = path + key;
+
+        List<Properties> properties = new ArrayList<Properties>();
+
+        Enumeration<URL> resources = classLoader.getResources(uri);
+        while (resources.hasMoreElements()) {
+            URL url = resources.nextElement();
+            Properties props = loadProperties(url);
+            properties.add(props);
+        }
+        return properties;
+    }
+
+    public List<Properties> findAvailableProperties(String key) throws IOException {
+        String uri = path + key;
+
+        List<Properties> properties = new ArrayList<Properties>();
+
+        Enumeration<URL> resources = classLoader.getResources(uri);
+        while (resources.hasMoreElements()) {
+            try {
+                URL url = resources.nextElement();
+                Properties props = loadProperties(url);
+                properties.add(props);
+            } catch (Exception notAvailable) {
+            }
+        }
+        return properties;
+    }
+
+    public Map<String, Properties> mapAllProperties(String key) throws IOException {
+        Map<String, Properties> propertiesMap = new HashMap<String, Properties>();
+        Map<String, URL> map = getResourcesMap(key);
+        for (Iterator iterator = map.entrySet().iterator(); iterator.hasNext();) {
+            Map.Entry entry = (Map.Entry) iterator.next();
+            String string = (String) entry.getKey();
+            URL url = (URL) entry.getValue();
+            Properties properties = loadProperties(url);
+            propertiesMap.put(string, properties);
+        }
+        return propertiesMap;
+    }
+
+    public Map<String, Properties> mapAvailableProperties(String key) throws IOException {
+        Map<String, Properties> propertiesMap = new HashMap<String, Properties>();
+        Map<String, URL> map = getResourcesMap(key);
+        for (Iterator iterator = map.entrySet().iterator(); iterator.hasNext();) {
+            try {
+                Map.Entry entry = (Map.Entry) iterator.next();
+                String string = (String) entry.getKey();
+                URL url = (URL) entry.getValue();
+                Properties properties = loadProperties(url);
+                propertiesMap.put(string, properties);
+            } catch (Exception notAvailable) {
+            }
+        }
+        return propertiesMap;
+    }
+
+    // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+    //
+    //   Map Resources
+    //
+    // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+
+    public Map<String, URL> getResourcesMap(String key) throws IOException {
+        String basePath = path + key;
+
+        Map<String, URL> resources = new HashMap<String, URL>();
+        if (!basePath.endsWith("/")){
+            basePath += "/";
+        }
+        Enumeration<URL> urls = classLoader.getResources(basePath);
+
+        while (urls.hasMoreElements()) {
+            URL location = urls.nextElement();
+
+            try {
+                if (location.getProtocol().equals("jar")) {
+
+                    readJarEntries(location, basePath, resources);
+
+                } else if (location.getProtocol().equals("file")) {
+
+                    readDirectoryEntries(location, resources);
+
+                }
+            } catch (Exception e) {
+            }
+        }
+
+        return resources;
+    }
+
+    private static void readDirectoryEntries(URL location, Map<String, URL> resources) throws MalformedURLException {
+        File dir = new File(location.getPath());
+        if (dir.isDirectory()) {
+            File[] files = dir.listFiles();
+            for (File file : files) {
+                if (!file.isDirectory()){
+                    String name = file.getName();
+                    URL url = file.toURL();
+                    resources.put(name, url);
+                }
+            }
+        }
+    }
+
+    private static void readJarEntries(URL location, String basePath, Map<String, URL> resources) throws IOException {
+        JarURLConnection conn = (JarURLConnection) location.openConnection();
+        JarFile jarfile = conn.getJarFile();
+
+        Enumeration<JarEntry> entries = jarfile.entries();
+        while (entries != null && entries.hasMoreElements()) {
+            JarEntry entry = entries.nextElement();
+            String name = entry.getName();
+
+            if (entry.isDirectory() || !name.startsWith(basePath) || name.length() == basePath.length()) {
+                continue;
+            }
+
+            name = name.substring(basePath.length());
+
+            if (name.contains("/")) {
+                continue;
+            }
+
+            URL resource = new URL(location, name);
+            resources.put(name, resource);
+        }
+    }
+
+    private Properties loadProperties(URL resource) throws IOException {
+        InputStream in = resource.openStream();
+
+        BufferedInputStream reader = null;
+        try {
+            reader = new BufferedInputStream(in);
+            Properties properties = new Properties();
+            properties.load(reader);
+
+            return properties;
+        } finally {
+            try {
+                in.close();
+                reader.close();
+            } catch (Exception e) {
+            }
+        }
+    }
+
+    private String readContents(URL resource) throws IOException {
+        InputStream in = resource.openStream();
+        BufferedInputStream reader = null;
+        StringBuffer sb = new StringBuffer();
+
+        try {
+            reader = new BufferedInputStream(in);
+
+            int b = reader.read();
+            while (b != -1) {
+                sb.append((char) b);
+                b = reader.read();
+            }
+
+            return sb.toString().trim();
+        } finally {
+            try {
+                in.close();
+                reader.close();
+            } catch (Exception e) {
+            }
+        }
+    }
+
+
+    public Enumeration doFindCommands() throws IOException {
+        return Thread.currentThread().getContextClassLoader().getResources(path);
+    }
+
+}
\ No newline at end of file

Added: geronimo/xbean/trunk/xbean-finder/src/test/java/org/acme/BarUrlHandler.java
URL: http://svn.apache.org/viewcvs/geronimo/xbean/trunk/xbean-finder/src/test/java/org/acme/BarUrlHandler.java?rev=406805&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-finder/src/test/java/org/acme/BarUrlHandler.java (added)
+++ geronimo/xbean/trunk/xbean-finder/src/test/java/org/acme/BarUrlHandler.java Mon May 15 19:45:42 2006
@@ -0,0 +1,30 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation
+ *
+ *  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.acme;
+
+import java.net.URLConnection;
+import java.net.URL;
+import java.io.IOException;
+
+/**
+ * @version $Revision$ $Date$
+ */
+public class BarUrlHandler extends java.net.URLStreamHandler {
+    protected URLConnection openConnection(URL u) throws IOException {
+        throw new IOException("bar");
+    }
+}

Added: geronimo/xbean/trunk/xbean-finder/src/test/java/org/acme/FooUrlHandler.java
URL: http://svn.apache.org/viewcvs/geronimo/xbean/trunk/xbean-finder/src/test/java/org/acme/FooUrlHandler.java?rev=406805&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-finder/src/test/java/org/acme/FooUrlHandler.java (added)
+++ geronimo/xbean/trunk/xbean-finder/src/test/java/org/acme/FooUrlHandler.java Mon May 15 19:45:42 2006
@@ -0,0 +1,30 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation
+ *
+ *  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.acme;
+
+import java.net.URLConnection;
+import java.net.URL;
+import java.io.IOException;
+
+/**
+ * @version $Revision$ $Date$
+ */
+public class FooUrlHandler extends java.net.URLStreamHandler {
+    protected URLConnection openConnection(URL u) throws IOException {
+        throw new IOException("foo");
+    }
+}

Added: geronimo/xbean/trunk/xbean-finder/src/test/java/org/acme/One.java
URL: http://svn.apache.org/viewcvs/geronimo/xbean/trunk/xbean-finder/src/test/java/org/acme/One.java?rev=406805&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-finder/src/test/java/org/acme/One.java (added)
+++ geronimo/xbean/trunk/xbean-finder/src/test/java/org/acme/One.java Mon May 15 19:45:42 2006
@@ -0,0 +1,37 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation
+ *
+ *  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.acme;
+
+import java.io.Externalizable;
+import java.io.ObjectOutput;
+import java.io.IOException;
+import java.io.ObjectInput;
+
+/**
+ * @version $Revision$ $Date$
+ */
+public class One implements Externalizable {
+    public void writeExternal(ObjectOutput out) throws IOException {
+    }
+
+    public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+    }
+
+    public String toString() {
+        return "one";
+    }
+}

Added: geronimo/xbean/trunk/xbean-finder/src/test/java/org/acme/Three.java
URL: http://svn.apache.org/viewcvs/geronimo/xbean/trunk/xbean-finder/src/test/java/org/acme/Three.java?rev=406805&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-finder/src/test/java/org/acme/Three.java (added)
+++ geronimo/xbean/trunk/xbean-finder/src/test/java/org/acme/Three.java Mon May 15 19:45:42 2006
@@ -0,0 +1,26 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation
+ *
+ *  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.acme;
+
+/**
+ * @version $Revision$ $Date$
+ */
+public class Three {
+    public String toString() {
+        return "three";
+    }
+}

Added: geronimo/xbean/trunk/xbean-finder/src/test/java/org/acme/Two.java
URL: http://svn.apache.org/viewcvs/geronimo/xbean/trunk/xbean-finder/src/test/java/org/acme/Two.java?rev=406805&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-finder/src/test/java/org/acme/Two.java (added)
+++ geronimo/xbean/trunk/xbean-finder/src/test/java/org/acme/Two.java Mon May 15 19:45:42 2006
@@ -0,0 +1,36 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation
+ *
+ *  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.acme;
+
+import java.io.Externalizable;
+import java.io.ObjectOutput;
+import java.io.IOException;
+import java.io.ObjectInput;
+
+/**
+ * @version $Revision$ $Date$
+ */
+public class Two implements Externalizable {
+    public void writeExternal(ObjectOutput out) throws IOException {
+    }
+    public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+    }
+
+    public String toString() {
+        return "two";
+    }
+}

Added: geronimo/xbean/trunk/xbean-finder/src/test/java/org/acme/javaURLContextFactory.java
URL: http://svn.apache.org/viewcvs/geronimo/xbean/trunk/xbean-finder/src/test/java/org/acme/javaURLContextFactory.java?rev=406805&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-finder/src/test/java/org/acme/javaURLContextFactory.java (added)
+++ geronimo/xbean/trunk/xbean-finder/src/test/java/org/acme/javaURLContextFactory.java Mon May 15 19:45:42 2006
@@ -0,0 +1,31 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation
+ *
+ *  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.acme;
+
+import javax.naming.spi.ObjectFactory;
+import javax.naming.Name;
+import javax.naming.Context;
+import java.util.Hashtable;
+
+/**
+ * @version $Revision$ $Date$
+ */
+public class javaURLContextFactory implements ObjectFactory {
+    public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable environment) throws Exception {
+        return "java";
+    }
+}

Added: geronimo/xbean/trunk/xbean-finder/src/test/java/org/acme/kernelURLContextFactory.java
URL: http://svn.apache.org/viewcvs/geronimo/xbean/trunk/xbean-finder/src/test/java/org/acme/kernelURLContextFactory.java?rev=406805&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-finder/src/test/java/org/acme/kernelURLContextFactory.java (added)
+++ geronimo/xbean/trunk/xbean-finder/src/test/java/org/acme/kernelURLContextFactory.java Mon May 15 19:45:42 2006
@@ -0,0 +1,31 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation
+ *
+ *  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.acme;
+
+import javax.naming.spi.ObjectFactory;
+import javax.naming.Name;
+import javax.naming.Context;
+import java.util.Hashtable;
+
+/**
+ * @version $Revision$ $Date$
+ */
+public class kernelURLContextFactory implements ObjectFactory {
+    public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable environment) throws Exception {
+        return "kernel";
+    }
+}

Added: geronimo/xbean/trunk/xbean-finder/src/test/java/org/acme/ldapURLContextFactory.java
URL: http://svn.apache.org/viewcvs/geronimo/xbean/trunk/xbean-finder/src/test/java/org/acme/ldapURLContextFactory.java?rev=406805&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-finder/src/test/java/org/acme/ldapURLContextFactory.java (added)
+++ geronimo/xbean/trunk/xbean-finder/src/test/java/org/acme/ldapURLContextFactory.java Mon May 15 19:45:42 2006
@@ -0,0 +1,31 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation
+ *
+ *  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.acme;
+
+import javax.naming.spi.ObjectFactory;
+import javax.naming.Name;
+import javax.naming.Context;
+import java.util.Hashtable;
+
+/**
+ * @version $Revision$ $Date$
+ */
+public class ldapURLContextFactory implements ObjectFactory {
+    public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable environment) throws Exception {
+        return "ldap";
+    }
+}

Added: geronimo/xbean/trunk/xbean-finder/src/test/java/org/apache/xbean/finder/ResourceFinderTest.java
URL: http://svn.apache.org/viewcvs/geronimo/xbean/trunk/xbean-finder/src/test/java/org/apache/xbean/finder/ResourceFinderTest.java?rev=406805&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-finder/src/test/java/org/apache/xbean/finder/ResourceFinderTest.java (added)
+++ geronimo/xbean/trunk/xbean-finder/src/test/java/org/apache/xbean/finder/ResourceFinderTest.java Mon May 15 19:45:42 2006
@@ -0,0 +1,357 @@
+package org.apache.xbean.finder;
+/**
+ * @version $Revision$ $Date$
+ */
+
+import junit.framework.TestCase;
+import org.acme.BarUrlHandler;
+import org.acme.FooUrlHandler;
+import org.acme.One;
+import org.acme.Three;
+import org.acme.Two;
+import org.acme.javaURLContextFactory;
+import org.acme.kernelURLContextFactory;
+import org.acme.ldapURLContextFactory;
+
+import java.net.URL;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+
+public class ResourceFinderTest extends TestCase {
+    ResourceFinder resourceFinder = new ResourceFinder("META-INF/");
+
+    public void testGetResourcesMap1() throws Exception {
+        Map<String, URL> resourcesMap = resourceFinder.getResourcesMap("");
+        Set<Map.Entry<String, URL>> entries = resourcesMap.entrySet();
+        for (Map.Entry<String, URL> entry : entries) {
+            String key = entry.getKey();
+            URL value = entry.getValue();
+
+            assertTrue("key not a directory", !key.contains("/"));
+            assertTrue("contains META-INF/", value.getPath().contains("META-INF/"));
+            assertTrue("ends with META-INF/" + key, value.getPath().endsWith("META-INF/" + key));
+            assertTrue("value not a directory", !value.getPath().endsWith("/"));
+        }
+    }
+
+    public void testGetResourcesMap2() throws Exception {
+        String token = "tvshows";
+        Map<String, URL> resourcesMap = resourceFinder.getResourcesMap(token);
+        Set<Map.Entry<String, URL>> entries = resourcesMap.entrySet();
+        for (Map.Entry<String, URL> entry : entries) {
+            String key = entry.getKey();
+            URL value = entry.getValue();
+
+            assertTrue("key not a directory", !key.contains("/"));
+            assertTrue("contains META-INF/", value.getPath().contains("META-INF/"));
+            assertTrue("ends with META-INF/" + token + "/" + key, value.getPath().endsWith("META-INF/" + token + "/" + key));
+            assertTrue("value not a directory", !value.getPath().endsWith("/"));
+        }
+
+        assertTrue("map contains simpsons.properties", resourcesMap.containsKey("simpsons.properties"));
+        assertTrue("map contains familyguy.properties", resourcesMap.containsKey("familyguy.properties"));
+    }
+
+    // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+    //
+    //   Find String
+    //
+    // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+
+    public void testFindString() throws Exception {
+        String expected = One.class.getName();
+        String actual = resourceFinder.findString("java.io.Serializable");
+        assertEquals(expected, actual);
+    }
+
+    public void testFindAllStrings() throws Exception {
+        List<String> manifests = null;
+        try {
+            manifests = resourceFinder.findAllStrings("MANIFEST.MF");
+        } catch (Exception thisIsLegal) {
+            return;
+        }
+
+        assertTrue("manifests found", manifests.size() > 1);
+        for (String manifest : manifests) {
+            assertTrue("starts with 'Manifest-Version'", manifest.startsWith("Manifest-Version"));
+        }
+    }
+
+    public void testFindAvailableStrings() throws Exception {
+        List<String> manifests = resourceFinder.findAvailableStrings("MANIFEST.MF");
+
+        assertTrue("manifests found", manifests.size() > 1);
+        for (String manifest : manifests) {
+            assertTrue("starts with 'Manifest-Version'", manifest.startsWith("Manifest-Version"));
+        }
+    }
+
+    public void testMapAllStrings() throws Exception {
+        Map<String, String> resourcesMap = resourceFinder.mapAllStrings("serializables");
+
+        assertEquals("map size", 3, resourcesMap.size());
+        assertTrue("map contains key 'one'", resourcesMap.containsKey("one"));
+        assertEquals(One.class.getName(), resourcesMap.get("one"));
+
+        assertTrue("map contains key 'two'", resourcesMap.containsKey("two"));
+        assertEquals(Two.class.getName(), resourcesMap.get("two"));
+
+        assertTrue("map contains key 'three'", resourcesMap.containsKey("three"));
+        assertEquals(Three.class.getName(), resourcesMap.get("three"));
+    }
+
+    public void testMapAvailableStrings() throws Exception {
+        Map<String, String> resourcesMap = resourceFinder.mapAvailableStrings("serializables");
+
+        assertEquals("map size", 3, resourcesMap.size());
+        assertTrue("map contains key 'one'", resourcesMap.containsKey("one"));
+        assertEquals(One.class.getName(), resourcesMap.get("one"));
+
+        assertTrue("map contains key 'two'", resourcesMap.containsKey("two"));
+        assertEquals(Two.class.getName(), resourcesMap.get("two"));
+
+        assertTrue("map contains key 'three'", resourcesMap.containsKey("three"));
+        assertEquals(Three.class.getName(), resourcesMap.get("three"));
+    }
+
+    // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+    //
+    //   Find Class
+    //
+    // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+
+    public void testFindClass() throws Exception {
+        Class actual = resourceFinder.findClass("java.io.Serializable");
+        assertEquals(One.class, actual);
+
+        try {
+            resourceFinder.findClass("java.io.OutputStream");
+            fail("ClassNotFoundException should be thrown");
+        } catch (ClassNotFoundException success) {
+            // pass
+        } catch (Exception e) {
+            fail("Wrong exception type was thrown: " + e.getClass().getName());
+        }
+    }
+
+    public void testFindAllClasses() throws Exception {
+        List<Class> classes = resourceFinder.findAllClasses("java.io.Serializable");
+        assertEquals("size", 1, classes.size());
+        assertEquals(One.class, classes.get(0));
+
+        try {
+            resourceFinder.findAllClasses("java.io.OutputStream");
+            fail("ClassNotFoundException should be thrown");
+        } catch (ClassNotFoundException success) {
+            // pass
+        } catch (Exception e) {
+            fail("Wrong exception type was thrown: " + e.getClass().getName());
+        }
+    }
+
+    public void testFindAvailableClasses() throws Exception {
+        List<Class> classes = resourceFinder.findAvailableClasses("java.io.Serializable");
+        assertEquals("size", 1, classes.size());
+        assertEquals(One.class, classes.get(0));
+
+        classes = resourceFinder.findAvailableClasses("java.io.OutputStream");
+        assertEquals("size", 0, classes.size());
+    }
+
+    public void testMapAllClasses() throws Exception {
+        Map<String, Class> resourcesMap = resourceFinder.mapAllClasses("serializables");
+
+        assertEquals("map size", 3, resourcesMap.size());
+        assertTrue("map contains key 'one'", resourcesMap.containsKey("one"));
+        assertEquals(One.class, resourcesMap.get("one"));
+
+        assertTrue("map contains key 'two'", resourcesMap.containsKey("two"));
+        assertEquals(Two.class, resourcesMap.get("two"));
+
+        assertTrue("map contains key 'three'", resourcesMap.containsKey("three"));
+        assertEquals(Three.class, resourcesMap.get("three"));
+
+        try {
+            resourceFinder.mapAllClasses("externalizables");
+            fail("ClassNotFoundException should be thrown");
+        } catch (ClassNotFoundException success) {
+            // pass
+        } catch (Exception e) {
+            fail("Wrong exception type was thrown: " + e.getClass().getName());
+        }
+    }
+
+    public void testMapAvailableClasses() throws Exception {
+        Map<String, Class> resourcesMap = resourceFinder.mapAvailableClasses("externalizables");
+
+        assertEquals("map size", 2, resourcesMap.size());
+        assertTrue("map contains key 'one'", resourcesMap.containsKey("one"));
+        assertEquals(One.class, resourcesMap.get("one"));
+
+        assertTrue("map contains key 'two'", resourcesMap.containsKey("two"));
+        assertEquals(Two.class, resourcesMap.get("two"));
+    }
+
+    // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+    //
+    //   Find Implementation
+    //
+    // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+
+    public void testFindImplementation() throws Exception {
+        Class expected = One.class;
+        Class actual = resourceFinder.findImplementation(java.io.Serializable.class);
+        assertEquals(expected, actual);
+
+        try {
+            resourceFinder.findImplementation(java.io.InputStream.class);
+            fail("ClassCastException should be thrown");
+        } catch (ClassCastException success) {
+        } catch (Exception e) {
+            fail("Wrong exception type was thrown: " + e.getClass().getName());
+        }
+    }
+
+    public void testFindAllImplementations() throws Exception {
+        List<Class> classes = resourceFinder.findAllImplementations(java.io.Serializable.class);
+        assertEquals("size", 1, classes.size());
+        assertEquals(One.class, classes.get(0));
+
+        try {
+            resourceFinder.findAllImplementations(java.io.InputStream.class);
+            fail("ClassNotFoundException should be thrown");
+        } catch (ClassCastException success) {
+        } catch (Exception e) {
+            fail("Wrong exception type was thrown: " + e.getClass().getName());
+        }
+    }
+
+    public void testMapAllImplementations() throws Exception {
+        Map<String, Class> resourcesMap = resourceFinder.mapAllImplementations(javax.naming.spi.ObjectFactory.class);
+
+        assertEquals("map size", 3, resourcesMap.size());
+        assertTrue("map contains key 'java'", resourcesMap.containsKey("java"));
+        assertEquals(javaURLContextFactory.class, resourcesMap.get("java"));
+
+        assertTrue("map contains key 'kernel'", resourcesMap.containsKey("kernel"));
+        assertEquals(kernelURLContextFactory.class, resourcesMap.get("kernel"));
+
+        assertTrue("map contains key 'ldap'", resourcesMap.containsKey("ldap"));
+        assertEquals(ldapURLContextFactory.class, resourcesMap.get("ldap"));
+
+        try {
+            resourceFinder.mapAllImplementations(java.net.URLStreamHandler.class);
+            fail("ClassNotFoundException should be thrown");
+        } catch (ClassCastException success) {
+            // pass
+        } catch (Exception e) {
+            fail("Wrong exception type was thrown: " + e.getClass().getName());
+        }
+    }
+
+    public void testMapAvailableImplementations() throws Exception {
+        Map<String, Class> resourcesMap = resourceFinder.mapAvailableImplementations(java.net.URLStreamHandler.class);
+
+        assertEquals("map size", 2, resourcesMap.size());
+        assertTrue("map contains key 'bar'", resourcesMap.containsKey("bar"));
+        assertEquals(BarUrlHandler.class, resourcesMap.get("bar"));
+
+        assertTrue("map contains key 'foo'", resourcesMap.containsKey("foo"));
+        assertEquals(FooUrlHandler.class, resourcesMap.get("foo"));
+    }
+
+    // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+    //
+    //   Find Properties
+    //
+    // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+
+    public void testFindProperties() throws Exception {
+        Properties properties = resourceFinder.findProperties("tvshows/familyguy.properties");
+        assertNotNull("properties", properties);
+        validateFamilyGuy(properties);
+
+        properties = resourceFinder.findProperties("tvshows/simpsons.properties");
+        assertNotNull("properties", properties);
+        validateSimpsons(properties);
+    }
+
+    public void testFindAllProperties() throws Exception {
+        List<Properties> propertiesLists = resourceFinder.findAllProperties("tvshows/familyguy.properties");
+        assertNotNull("properties", propertiesLists);
+        assertEquals("list size", 1, propertiesLists.size());
+
+        Properties properties = propertiesLists.get(0);
+        validateFamilyGuy(properties);
+    }
+
+    public void testFindAvailableProperties() throws Exception {
+        List<Properties> propertiesLists = resourceFinder.findAvailableProperties("tvshows/familyguy.properties");
+        assertNotNull("properties", propertiesLists);
+        assertEquals("list size", 1, propertiesLists.size());
+
+        Properties properties = propertiesLists.get(0);
+        validateFamilyGuy(properties);
+    }
+
+    public void testMapAllProperties() throws Exception {
+        Map<String, Properties> propertiesMap = resourceFinder.mapAllProperties("tvshows");
+        assertNotNull("properties", propertiesMap);
+        assertEquals("map size", 2, propertiesMap.size());
+
+        assertTrue("contains 'familyguy.properties'", propertiesMap.containsKey("familyguy.properties"));
+        validateFamilyGuy(propertiesMap.get("familyguy.properties"));
+
+        assertTrue("contains 'simpsons.properties'", propertiesMap.containsKey("simpsons.properties"));
+        validateSimpsons(propertiesMap.get("simpsons.properties"));
+
+        try {
+            resourceFinder.mapAllProperties("movies");
+        } catch (Exception success) {
+        }
+
+    }
+
+    public void testMapAvailableProperties() throws Exception {
+        Map<String, Properties> propertiesMap = resourceFinder.mapAvailableProperties("movies");
+        assertNotNull("properties", propertiesMap);
+        assertEquals("map size", 2, propertiesMap.size());
+
+        assertTrue("contains 'serenity.properties'", propertiesMap.containsKey("serentity.properties"));
+        Properties properties = propertiesMap.get("serentity.properties");
+        assertEquals("director", "Joss Whedon", properties.getProperty("director"));
+        assertEquals("star", "Nathan Fillion", properties.getProperty("star"));
+        assertEquals("year", "2005", properties.getProperty("year"));
+
+        assertTrue("contains 'kingkong.properties'", propertiesMap.containsKey("kingkong.properties"));
+        properties = propertiesMap.get("kingkong.properties");
+        assertEquals("director", "Peter Jackson", properties.getProperty("director"));
+        assertEquals("star", "Naomi Watts", properties.getProperty("star"));
+        assertEquals("year", "2005", properties.getProperty("year"));
+    }
+
+    private void validateSimpsons(Properties properties) {
+        assertEquals("props size", 6, properties.size());
+        assertEquals("creator", "Matt Groening", properties.getProperty("creator"));
+        assertEquals("father", "Homer", properties.getProperty("father"));
+        assertEquals("mother", "Marge", properties.getProperty("mother"));
+        assertEquals("son", "Bart", properties.getProperty("son"));
+        assertEquals("daughter", "Lisa", properties.getProperty("daughter"));
+        assertEquals("baby", "Maggie", properties.getProperty("baby"));
+    }
+
+    private void validateFamilyGuy(Properties properties) {
+        assertEquals("props size", 6, properties.size());
+        assertEquals("creator", "Seth MacFarlane", properties.getProperty("creator"));
+        assertEquals("father", "Peter", properties.getProperty("father"));
+        assertEquals("mother", "Lois", properties.getProperty("mother"));
+        assertEquals("son", "Chris", properties.getProperty("son"));
+        assertEquals("daughter", "Meg", properties.getProperty("daughter"));
+        assertEquals("baby", "Stewie", properties.getProperty("baby"));
+    }
+
+
+}
\ No newline at end of file

Added: geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/externalizables/one
URL: http://svn.apache.org/viewcvs/geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/externalizables/one?rev=406805&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/externalizables/one (added)
+++ geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/externalizables/one Mon May 15 19:45:42 2006
@@ -0,0 +1 @@
+org.acme.One
\ No newline at end of file

Added: geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/externalizables/three
URL: http://svn.apache.org/viewcvs/geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/externalizables/three?rev=406805&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/externalizables/three (added)
+++ geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/externalizables/three Mon May 15 19:45:42 2006
@@ -0,0 +1 @@
+org.openejb.ClassThatDoesntExist
\ No newline at end of file

Added: geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/externalizables/two
URL: http://svn.apache.org/viewcvs/geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/externalizables/two?rev=406805&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/externalizables/two (added)
+++ geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/externalizables/two Mon May 15 19:45:42 2006
@@ -0,0 +1 @@
+org.acme.Two
\ No newline at end of file

Added: geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/java.io.InputStream
URL: http://svn.apache.org/viewcvs/geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/java.io.InputStream?rev=406805&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/java.io.InputStream (added)
+++ geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/java.io.InputStream Mon May 15 19:45:42 2006
@@ -0,0 +1 @@
+org.acme.One
\ No newline at end of file

Added: geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/java.io.OutputStream
URL: http://svn.apache.org/viewcvs/geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/java.io.OutputStream?rev=406805&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/java.io.OutputStream (added)
+++ geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/java.io.OutputStream Mon May 15 19:45:42 2006
@@ -0,0 +1 @@
+org.openejb.ClassThatDoesntExist
\ No newline at end of file

Added: geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/java.io.Serializable
URL: http://svn.apache.org/viewcvs/geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/java.io.Serializable?rev=406805&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/java.io.Serializable (added)
+++ geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/java.io.Serializable Mon May 15 19:45:42 2006
@@ -0,0 +1 @@
+org.acme.One
\ No newline at end of file

Added: geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/java.net.URLStreamHandler/bar
URL: http://svn.apache.org/viewcvs/geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/java.net.URLStreamHandler/bar?rev=406805&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/java.net.URLStreamHandler/bar (added)
+++ geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/java.net.URLStreamHandler/bar Mon May 15 19:45:42 2006
@@ -0,0 +1 @@
+org.acme.BarUrlHandler
\ No newline at end of file

Added: geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/java.net.URLStreamHandler/baz
URL: http://svn.apache.org/viewcvs/geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/java.net.URLStreamHandler/baz?rev=406805&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/java.net.URLStreamHandler/baz (added)
+++ geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/java.net.URLStreamHandler/baz Mon May 15 19:45:42 2006
@@ -0,0 +1 @@
+org.acme.Three
\ No newline at end of file

Added: geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/java.net.URLStreamHandler/foo
URL: http://svn.apache.org/viewcvs/geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/java.net.URLStreamHandler/foo?rev=406805&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/java.net.URLStreamHandler/foo (added)
+++ geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/java.net.URLStreamHandler/foo Mon May 15 19:45:42 2006
@@ -0,0 +1 @@
+org.acme.FooUrlHandler
\ No newline at end of file

Added: geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/javax.naming.spi.ObjectFactory/java
URL: http://svn.apache.org/viewcvs/geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/javax.naming.spi.ObjectFactory/java?rev=406805&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/javax.naming.spi.ObjectFactory/java (added)
+++ geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/javax.naming.spi.ObjectFactory/java Mon May 15 19:45:42 2006
@@ -0,0 +1 @@
+org.acme.javaURLContextFactory
\ No newline at end of file

Added: geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/javax.naming.spi.ObjectFactory/kernel
URL: http://svn.apache.org/viewcvs/geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/javax.naming.spi.ObjectFactory/kernel?rev=406805&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/javax.naming.spi.ObjectFactory/kernel (added)
+++ geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/javax.naming.spi.ObjectFactory/kernel Mon May 15 19:45:42 2006
@@ -0,0 +1 @@
+org.acme.kernelURLContextFactory
\ No newline at end of file

Added: geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/javax.naming.spi.ObjectFactory/ldap
URL: http://svn.apache.org/viewcvs/geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/javax.naming.spi.ObjectFactory/ldap?rev=406805&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/javax.naming.spi.ObjectFactory/ldap (added)
+++ geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/javax.naming.spi.ObjectFactory/ldap Mon May 15 19:45:42 2006
@@ -0,0 +1 @@
+org.acme.ldapURLContextFactory
\ No newline at end of file

Added: geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/movies/ishtar.properties
URL: http://svn.apache.org/viewcvs/geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/movies/ishtar.properties?rev=406805&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/movies/ishtar.properties (added)
+++ geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/movies/ishtar.properties Mon May 15 19:45:42 2006
@@ -0,0 +1,2 @@
+# Malformed \uxxxx encoding
+\u999
\ No newline at end of file

Added: geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/movies/kingkong.properties
URL: http://svn.apache.org/viewcvs/geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/movies/kingkong.properties?rev=406805&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/movies/kingkong.properties (added)
+++ geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/movies/kingkong.properties Mon May 15 19:45:42 2006
@@ -0,0 +1,3 @@
+director=Peter Jackson
+star=Naomi Watts
+year=2005

Added: geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/movies/serentity.properties
URL: http://svn.apache.org/viewcvs/geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/movies/serentity.properties?rev=406805&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/movies/serentity.properties (added)
+++ geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/movies/serentity.properties Mon May 15 19:45:42 2006
@@ -0,0 +1,3 @@
+director=Joss Whedon
+star=Nathan Fillion
+year=2005

Added: geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/serializables/one
URL: http://svn.apache.org/viewcvs/geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/serializables/one?rev=406805&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/serializables/one (added)
+++ geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/serializables/one Mon May 15 19:45:42 2006
@@ -0,0 +1 @@
+org.acme.One
\ No newline at end of file

Added: geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/serializables/three
URL: http://svn.apache.org/viewcvs/geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/serializables/three?rev=406805&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/serializables/three (added)
+++ geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/serializables/three Mon May 15 19:45:42 2006
@@ -0,0 +1 @@
+org.acme.Three
\ No newline at end of file

Added: geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/serializables/two
URL: http://svn.apache.org/viewcvs/geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/serializables/two?rev=406805&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/serializables/two (added)
+++ geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/serializables/two Mon May 15 19:45:42 2006
@@ -0,0 +1 @@
+org.acme.Two
\ No newline at end of file

Added: geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/tvshows/familyguy.properties
URL: http://svn.apache.org/viewcvs/geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/tvshows/familyguy.properties?rev=406805&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/tvshows/familyguy.properties (added)
+++ geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/tvshows/familyguy.properties Mon May 15 19:45:42 2006
@@ -0,0 +1,6 @@
+creator=Seth MacFarlane
+father=Peter
+mother=Lois
+son=Chris
+daughter=Meg
+baby=Stewie

Added: geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/tvshows/simpsons.properties
URL: http://svn.apache.org/viewcvs/geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/tvshows/simpsons.properties?rev=406805&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/tvshows/simpsons.properties (added)
+++ geronimo/xbean/trunk/xbean-finder/src/test/resources/META-INF/tvshows/simpsons.properties Mon May 15 19:45:42 2006
@@ -0,0 +1,6 @@
+creator=Matt Groening
+father=Homer
+mother=Marge
+son=Bart
+daughter=Lisa
+baby=Maggie