[jboss-svn-commits] JBL Code SVN: r31014 - in labs/jbossrules/trunk: drools-core/src/main/java/org/drools/rule and 1 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Mon Jan 11 10:24:38 EST 2010


Author: mark.proctor at jboss.com
Date: 2010-01-11 10:24:37 -0500 (Mon, 11 Jan 2010)
New Revision: 31014

Added:
   labs/jbossrules/trunk/drools-api/src/main/java/org/drools/util/ClassLoaderUtil.java
   labs/jbossrules/trunk/drools-api/src/main/java/org/drools/util/CompositeClassLoader.java
   labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/DroolsCompositeClassLoader.java
   labs/jbossrules/trunk/drools-core/src/main/java/org/drools/util/DroolsClassLoader.java
Removed:
   labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/CompositeClassLoader.java
   labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/DroolsClassLoader.java
   labs/jbossrules/trunk/drools-core/src/main/java/org/drools/util/ChainedProperties.java
Log:
JBRULES-2351 OSGi Ready
-Classloader reworking, to make sure it can always find the user classes as well as the drools classes.

Added: labs/jbossrules/trunk/drools-api/src/main/java/org/drools/util/ClassLoaderUtil.java
===================================================================
--- labs/jbossrules/trunk/drools-api/src/main/java/org/drools/util/ClassLoaderUtil.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-api/src/main/java/org/drools/util/ClassLoaderUtil.java	2010-01-11 15:24:37 UTC (rev 31014)
@@ -0,0 +1,36 @@
+package org.drools.util;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class ClassLoaderUtil {
+    public static ClassLoader getClassLoader(final ClassLoader classLoader, Class cls) {
+        ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
+        ClassLoader currentClassLoader = cls.getClassLoader();
+        List<ClassLoader> list = new ArrayList<ClassLoader>();
+        if ( classLoader != null) {
+            list.add( classLoader );
+        }
+        
+        if ( contextClassLoader != null && contextClassLoader != classLoader ) {
+            list.add( contextClassLoader );
+        }
+        
+        if ( currentClassLoader != null && ( currentClassLoader != classLoader || currentClassLoader != contextClassLoader ) ) {
+            list.add( currentClassLoader );
+        }
+        
+        if ( list.size() > 0 ) {
+            CompositeClassLoader cl = new CompositeClassLoader( null );
+            for ( ClassLoader entry : list ) {
+                cl.addClassLoader( entry );
+            }
+            
+            return cl;
+            
+        } else {
+            return list.get(0);
+        }
+               
+    } 
+}

Added: labs/jbossrules/trunk/drools-api/src/main/java/org/drools/util/CompositeClassLoader.java
===================================================================
--- labs/jbossrules/trunk/drools-api/src/main/java/org/drools/util/CompositeClassLoader.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-api/src/main/java/org/drools/util/CompositeClassLoader.java	2010-01-11 15:24:37 UTC (rev 31014)
@@ -0,0 +1,169 @@
+package org.drools.util;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.List;
+import java.util.NoSuchElementException;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+public class CompositeClassLoader extends ClassLoader {
+    /* Assumption: modifications are really rare, but iterations are frequent. */
+    private final List<ClassLoader> classLoaders = new CopyOnWriteArrayList<ClassLoader>();
+
+    public CompositeClassLoader(final ClassLoader parentClassLoader) {
+        super( null );
+    }
+
+    public synchronized void addClassLoader(final ClassLoader classLoader) {
+        /* NB: we need synchronized here even though we use a COW list:
+         *     two threads may try to add the same new class loader, so we need
+         *     to protect over a bigger area than just a single iteration.
+         */
+        // don't add duplicate ClassLoaders;
+        for ( final ClassLoader cl : this.classLoaders ) {
+            if ( cl == classLoader ) {
+                return;
+            }
+        }
+        this.classLoaders.add( classLoader );
+    }
+
+    public synchronized void removeClassLoader(final ClassLoader classLoader) {
+        /* synchronized to protect against concurrent runs of 
+         * addClassLoader(x) and removeClassLoader(x).
+         */
+        classLoaders.remove( classLoader );
+    }
+
+    /**
+     * This ClassLoader never has classes of it's own, so only search the child ClassLoaders
+     * and the parent ClassLoader if one is provided
+     */
+    public Class< ? > loadClass(final String name,
+                                final boolean resolve) throws ClassNotFoundException {
+        // search the child ClassLoaders
+        Class< ? > cls = null;
+
+        for ( final ClassLoader classLoader : this.classLoaders ) {
+            try {
+                cls = classLoader.loadClass( name );
+            } catch ( ClassNotFoundException e ) {
+                // swallow as we need to check more classLoaders
+            }
+            if ( cls != null ) {
+                break;
+            }
+        }
+
+        if ( resolve ) {
+            resolveClass( cls );
+        }
+
+        return cls;
+    }
+
+    /**
+     * This ClassLoader never has classes of it's own, so only search the child ClassLoaders
+     * and the parent ClassLoader if one is provided
+     */
+    public InputStream getResourceAsStream(final String name) {
+        for ( final ClassLoader classLoader : this.classLoaders ) {
+            InputStream stream = classLoader.getResourceAsStream( name );
+            if ( stream != null ) {
+                return stream;
+            }
+        }
+
+        return null;
+    }
+
+    @Override
+    public URL getResource(String name) {
+        for ( final ClassLoader classLoader : this.classLoaders ) {
+            URL url = classLoader.getResource( name );
+            if ( url != null ) {
+                return url;
+            }
+        }
+
+        return null;
+    }
+
+    @Override
+    public Enumeration<URL> getResources(String name) throws IOException {
+        CompositeEnumeration<URL> enumerations = new CompositeEnumeration<URL>();
+
+        for ( final ClassLoader classLoader : this.classLoaders ) {
+            Enumeration<URL> e = classLoader.getResources( name );
+            if ( e != null ) {
+                enumerations.addEnumeration( e );
+            }
+        }
+
+        if ( enumerations.size() == 0 ) {
+            return null;
+        } else {
+            return enumerations;
+        }
+    }
+
+    private static class CompositeEnumeration<URL>
+        implements
+        Enumeration<URL> {
+        private List<URL> list;
+        private Iterator<URL> it;
+
+        public void addEnumeration(Enumeration<URL> enumeration) {
+            if ( !enumeration.hasMoreElements() ) {
+                // don't add it, if it's empty
+                return;
+            }
+            
+            if ( this.it != null ) {
+                throw new IllegalStateException( "cannot add more enumerations while iterator" );
+            }
+            
+            if ( this.list == null ) {
+                this.list = new ArrayList<URL>();
+            }
+            
+            while ( enumeration.hasMoreElements() ) {
+                this.list.add( enumeration.nextElement() );
+            }
+        }
+
+        public int size() {
+            if ( this.list == null ) {
+                return 0;
+            } else {
+                return this.list.size();
+            }
+        }
+
+        public boolean hasMoreElements() {
+            if ( this.it == null ) {
+                if ( this.list == null ) {
+                    return false;
+                } else {
+                    this.it = this.list.iterator();
+                }
+            }
+            return it.hasNext();
+        }
+
+        public URL nextElement() {
+            if ( this.it == null ) {
+                if ( this.list == null ) {
+                    throw new NoSuchElementException();
+                } else {
+                    this.it = this.list.iterator();
+                }
+            }
+            return it.next();
+        }
+    }
+}

Deleted: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/CompositeClassLoader.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/CompositeClassLoader.java	2010-01-11 14:25:30 UTC (rev 31013)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/CompositeClassLoader.java	2010-01-11 15:24:37 UTC (rev 31014)
@@ -1,117 +0,0 @@
-package org.drools.rule;
-
-import java.io.InputStream;
-import java.util.List;
-import java.util.concurrent.CopyOnWriteArrayList;
-
-/**
- * A classloader that loads from a (dynamic) list of sub-classloaders.
- */
-public class CompositeClassLoader extends ClassLoader
-    implements
-    DroolsClassLoader {
-    
-
-    /* Assumption: modifications are really rare, but iterations are frequent. */
-    private final List<ClassLoader> classLoaders = new CopyOnWriteArrayList<ClassLoader>();
-    private boolean hasParent = false;
-    
-    public CompositeClassLoader(final ClassLoader parentClassLoader) {
-        super( parentClassLoader );
-        if ( parentClassLoader != null ) {
-            this.hasParent = true;
-        }
-    }
-
-    public synchronized void addClassLoader(final ClassLoader classLoader) {
-        /* NB: we need synchronized here even though we use a COW list:
-         *     two threads may try to add the same new class loader, so we need
-         *     to protect over a bigger area than just a single iteration.
-         */
-        // don't add duplicate ClassLoaders;
-        for ( final ClassLoader cl : this.classLoaders ) {
-            if ( cl == classLoader ) {
-                return;
-            }
-        }
-        this.classLoaders.add( classLoader );
-
-    }
-
-    public synchronized void removeClassLoader(final ClassLoader classLoader) {
-        /* synchronized to protect against concurrent runs of 
-         * addClassLoader(x) and removeClassLoader(x).
-         */
-        classLoaders.remove( classLoader );
-    }
-
-    /**
-     * Search the list of child ClassLoaders
-     */
-    public Class<?> fastFindClass(final String name) {
-        for ( final ClassLoader classLoader : this.classLoaders ) {
-            final Class<?> cls = ((DroolsClassLoader) classLoader).fastFindClass( name );
-            if ( cls != null ) {
-                return cls;
-            }
-        }
-        return null;
-    }
-
-    /**
-     * This ClassLoader never has classes of it's own, so only search the child ClassLoaders
-     * and the parent ClassLoader if one is provided
-     */ 
-    public Class<?> loadClass(final String name,
-                                        final boolean resolve) throws ClassNotFoundException {
-        // search the child ClassLoaders
-        Class<?> cls = fastFindClass( name );
-        
-        // still not found so search the parent ClassLoader
-        if ( this.hasParent && cls == null ) {
-            cls = Class.forName( name,
-                           true,
-                           getParent() );
-        }        
-
-        if ( resolve ) {
-            resolveClass( cls );
-        }
-
-        return cls;
-    }
-
-    /**
-     * This ClassLoader never has classes of it's own, so only search the child ClassLoaders
-     * and the parent ClassLoader if one is provided
-     */    
-    public InputStream getResourceAsStream(final String name) {        
-        for ( final ClassLoader classLoader : this.classLoaders ) {
-            InputStream stream = classLoader.getResourceAsStream( name );
-            if ( stream != null ) {
-                return stream;
-            }
-        }
-        
-        if ( this.hasParent ) {
-            return getParent().getResourceAsStream( name );            
-        }
-        
-        return null;
-
-    }
-    
-
-    /**
-     * This ClassLoader never has classes of it's own, so only search the child ClassLoaders
-     */    
-    protected Class<?> findClass(final String name) throws ClassNotFoundException {
-        final Class<?> cls = fastFindClass( name );
-        
-        if ( cls == null ) {
-            throw new ClassNotFoundException( name );
-        }
-        return cls;
-    }
-
-}

Deleted: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/DroolsClassLoader.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/DroolsClassLoader.java	2010-01-11 14:25:30 UTC (rev 31013)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/DroolsClassLoader.java	2010-01-11 15:24:37 UTC (rev 31014)
@@ -1,13 +0,0 @@
-package org.drools.rule;
-
-import java.io.InputStream;
-
-public interface DroolsClassLoader {
-
-    public InputStream getResourceAsStream(final String name);
-
-    public Class<?> fastFindClass(final String name);
-    
-    public Class<?> loadClass(final String name,
-                           final boolean resolve) throws ClassNotFoundException;
-}

Added: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/DroolsCompositeClassLoader.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/DroolsCompositeClassLoader.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/DroolsCompositeClassLoader.java	2010-01-11 15:24:37 UTC (rev 31014)
@@ -0,0 +1,122 @@
+package org.drools.rule;
+
+import java.io.InputStream;
+import java.util.List;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+import org.drools.util.DroolsClassLoader;
+
+/**
+ * A classloader that loads from a (dynamic) list of sub-classloaders.
+ */
+public class DroolsCompositeClassLoader extends ClassLoader
+    implements
+    DroolsClassLoader {
+    
+
+    /* Assumption: modifications are really rare, but iterations are frequent. */
+    private final List<ClassLoader> classLoaders = new CopyOnWriteArrayList<ClassLoader>();
+    private boolean hasParent = false;
+    
+    public DroolsCompositeClassLoader(final ClassLoader parentClassLoader) {
+        super( parentClassLoader );
+        if ( parentClassLoader != null ) {
+            this.hasParent = true;
+        }
+    }
+
+    public synchronized void addClassLoader(final ClassLoader classLoader) {
+        if ( classLoader == null ) {
+            return;
+        }
+        /* NB: we need synchronized here even though we use a COW list:
+         *     two threads may try to add the same new class loader, so we need
+         *     to protect over a bigger area than just a single iteration.
+         */
+        // don't add duplicate ClassLoaders;
+        for ( final ClassLoader cl : this.classLoaders ) {
+            if ( cl == classLoader ) {
+                return;
+            }
+        }
+        this.classLoaders.add( classLoader );
+
+    }
+
+    public synchronized void removeClassLoader(final ClassLoader classLoader) {
+        /* synchronized to protect against concurrent runs of 
+         * addClassLoader(x) and removeClassLoader(x).
+         */
+        classLoaders.remove( classLoader );
+    }
+
+    /**
+     * Search the list of child ClassLoaders
+     */
+    public Class<?> fastFindClass(final String name) {
+        for ( final ClassLoader classLoader : this.classLoaders ) {
+            final Class<?> cls = ((DroolsClassLoader) classLoader).fastFindClass( name );
+            if ( cls != null ) {
+                return cls;
+            }
+        }
+        return null;
+    }
+
+    /**
+     * This ClassLoader never has classes of it's own, so only search the child ClassLoaders
+     * and the parent ClassLoader if one is provided
+     */ 
+    public Class<?> loadClass(final String name,
+                                        final boolean resolve) throws ClassNotFoundException {
+        // search the child ClassLoaders
+        Class<?> cls = fastFindClass( name );
+        
+        // still not found so search the parent ClassLoader
+        if ( this.hasParent && cls == null ) {
+            cls = Class.forName( name,
+                           true,
+                           getParent() );
+        }        
+
+        if ( resolve ) {
+            resolveClass( cls );
+        }
+
+        return cls;
+    }
+
+    /**
+     * This ClassLoader never has classes of it's own, so only search the child ClassLoaders
+     * and the parent ClassLoader if one is provided
+     */    
+    public InputStream getResourceAsStream(final String name) {        
+        for ( final ClassLoader classLoader : this.classLoaders ) {
+            InputStream stream = classLoader.getResourceAsStream( name );
+            if ( stream != null ) {
+                return stream;
+            }
+        }
+        
+        if ( this.hasParent ) {
+            return getParent().getResourceAsStream( name );            
+        }
+        
+        return null;
+
+    }
+    
+
+    /**
+     * This ClassLoader never has classes of it's own, so only search the child ClassLoaders
+     */    
+    protected Class<?> findClass(final String name) throws ClassNotFoundException {
+        final Class<?> cls = fastFindClass( name );
+        
+        if ( cls == null ) {
+            throw new ClassNotFoundException( name );
+        }
+        return cls;
+    }
+
+}

Deleted: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/util/ChainedProperties.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/util/ChainedProperties.java	2010-01-11 14:25:30 UTC (rev 31013)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/util/ChainedProperties.java	2010-01-11 15:24:37 UTC (rev 31014)
@@ -1,267 +0,0 @@
-/**
- *
- */
-package org.drools.util;
-
-import java.io.Externalizable;
-import java.io.File;
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-
-public class ChainedProperties
-    implements
-    Externalizable {
-    private List props;
-    private List defaultProps;
-
-    public ChainedProperties() {
-
-    }
-
-    public ChainedProperties(String confFileName) {
-        this( null,
-              confFileName );
-    }
-
-    public ChainedProperties(ClassLoader classLoader,
-                             String confFileName) {
-        this( classLoader,
-              confFileName,
-              true );
-    }
-
-    public ChainedProperties(ClassLoader classLoader,
-                             String confFileName,
-                             boolean populateDefaults) {
-        if ( classLoader == null ) {
-            classLoader = Thread.currentThread().getContextClassLoader();
-            if ( classLoader == null ) {
-                classLoader = this.getClass().getClassLoader();
-            }
-        }
-
-        this.props = new ArrayList();
-        this.defaultProps = new ArrayList();
-
-        // Properties added in precedence order
-
-        // System defined properties always get precedence
-        addProperties( System.getProperties() );
-
-        // System property defined properties file
-        loadProperties( System.getProperty( "drools." + confFileName ),
-                        this.props );
-
-        // User home properties file
-        loadProperties( System.getProperty( "user.home" ) + "/drools." + confFileName,
-                        this.props );
-
-        // Working directory properties file
-        loadProperties( "drools." + confFileName,
-                        this.props );
-
-        // check META-INF directories for all known ClassLoaders
-        ClassLoader confClassLoader = classLoader;
-        if ( confClassLoader != null ) {
-            loadProperties( getResources( "META-INF/drools." + confFileName,
-                                          confClassLoader ),
-                            this.props );
-        }
-
-        confClassLoader = getClass().getClassLoader();
-        if ( confClassLoader != null && confClassLoader != classLoader ) {
-            loadProperties( getResources( "META-INF/drools." + confFileName,
-                                          confClassLoader ),
-                            this.props );
-        }
-
-        confClassLoader = Thread.currentThread().getContextClassLoader();
-        if ( confClassLoader != null && confClassLoader != classLoader ) {
-            loadProperties( getResources( "META-INF/drools." + confFileName,
-                                          confClassLoader ),
-                            this.props );
-        }
-
-        confClassLoader = ClassLoader.getSystemClassLoader();
-        if ( confClassLoader != null && confClassLoader != classLoader ) {
-            loadProperties( getResources( "META-INF/drools." + confFileName,
-                                          confClassLoader ),
-                            this.props );
-        }
-
-        if ( !populateDefaults ) {
-            return;
-        }
-
-        // load defaults
-        confClassLoader = classLoader;
-        if ( confClassLoader != null ) {
-            loadProperties( getResources( "META-INF/drools.default." + confFileName,
-                                          confClassLoader ),
-                            this.defaultProps );
-        }
-
-        confClassLoader = getClass().getClassLoader();
-        if ( confClassLoader != null && confClassLoader != classLoader ) {
-            loadProperties( getResources( "META-INF/drools.default." + confFileName,
-                                          confClassLoader ),
-                            this.defaultProps );
-        }
-
-        confClassLoader = Thread.currentThread().getContextClassLoader();
-        if ( confClassLoader != null && confClassLoader != classLoader ) {
-            loadProperties( getResources( "META-INF/drools.default." + confFileName,
-                                          confClassLoader ),
-                            this.defaultProps );
-        }
-
-        confClassLoader = ClassLoader.getSystemClassLoader();
-        if ( confClassLoader != null && confClassLoader != classLoader ) {
-            loadProperties( getResources( "META-INF/drools.default." + confFileName,
-                                          confClassLoader ),
-                            this.defaultProps );
-        }
-    }
-
-    public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
-        props   = (List)in.readObject();
-        defaultProps    = (List)in.readObject();
-    }
-
-    public void writeExternal(ObjectOutput out) throws IOException {
-        out.writeObject(props);
-        out.writeObject(defaultProps);
-    }
-
-    private Enumeration getResources(String name,
-                                     ClassLoader classLoader) {
-        Enumeration enumeration = null;
-        try {
-            enumeration = classLoader.getResources( name );
-        } catch ( IOException e ) {
-            e.printStackTrace();
-        }
-        return enumeration;
-    }
-
-    public void addProperties(Properties properties) {
-        this.props.add( properties );
-    }
-
-    public String getProperty(String key,
-                              String defaultValue) {
-        String value = null;
-        for ( Iterator it = this.props.iterator(); it.hasNext(); ) {
-            Properties props = (Properties) it.next();
-            value = props.getProperty( key );
-            if ( value != null ) {
-                break;
-            }
-        }
-        if ( value == null ) {
-            for ( Iterator it = this.defaultProps.iterator(); it.hasNext(); ) {
-                Properties props = (Properties) it.next();
-                value = props.getProperty( key );
-                if ( value != null ) {
-                    break;
-                }
-            }
-        }
-        return (value != null) ? value : defaultValue;
-    }
-
-    public void mapStartsWith(Map map,
-                              String startsWith,
-                              boolean includeSubProperties) {
-        for ( Iterator it = this.props.iterator(); it.hasNext(); ) {
-            Properties props = (Properties) it.next();
-            mapStartsWith( map,
-                           props,
-                           startsWith,
-                           includeSubProperties );
-        }
-
-        for ( Iterator it = this.defaultProps.iterator(); it.hasNext(); ) {
-            Properties props = (Properties) it.next();
-            mapStartsWith( map,
-                           props,
-                           startsWith,
-                           includeSubProperties );
-        }
-    }
-
-    private void mapStartsWith(Map map,
-                               Properties properties,
-                               String startsWith,
-                               boolean includeSubProperties) {
-        Enumeration enumeration = properties.propertyNames();
-        while ( enumeration.hasMoreElements() ) {
-            String key = (String) enumeration.nextElement();
-            if ( key.startsWith( startsWith ) ) {
-                if ( !includeSubProperties && key.substring( startsWith.length() + 1 ).indexOf( '.' ) > 0 ) {
-                    // +1 to the length, as we do allow the direct property, just not ones below it
-                    // This key has sub properties beyond the given startsWith, so skip
-                    continue;
-                }
-                if ( !map.containsKey( key ) ) {
-                    map.put( key,
-                             properties.getProperty( key ) );
-                }
-
-            }
-        }
-    }
-
-    private void loadProperties(Enumeration enumeration,
-                                List chain) {
-        if ( enumeration == null ) {
-            return;
-        }
-
-        while ( enumeration.hasMoreElements() ) {
-            URL url = (URL) enumeration.nextElement();
-            loadProperties( url,
-                            chain );
-        }
-    }
-
-    private void loadProperties(String fileName,
-                                List chain) {
-        if ( fileName != null ) {
-            File file = new File( fileName );
-            if ( file != null && file.exists() ) {
-                try {
-                    loadProperties( file.toURL(),
-                                    chain );
-                } catch ( MalformedURLException e ) {
-                    throw new IllegalArgumentException( "file.toURL() failed for drools.packagebuilder.conf properties value '" + file + "'" );
-                }
-            } else {
-                //throw new IllegalArgumentException( "drools.packagebuilder.conf is specified but cannot be found '" + file + "'" );
-            }
-        }
-    }
-
-    private void loadProperties(URL confURL,
-                                List chain) {
-        if ( confURL == null ) {
-            return;
-        }
-        Properties properties = new Properties();
-        try {
-            properties.load( confURL.openStream() );
-            chain.add( properties );
-        } catch ( IOException e ) {
-            //throw new IllegalArgumentException( "Invalid URL to properties file '" + confURL.toExternalForm() + "'" );
-        }
-    }
-}
\ No newline at end of file

Added: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/util/DroolsClassLoader.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/util/DroolsClassLoader.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/util/DroolsClassLoader.java	2010-01-11 15:24:37 UTC (rev 31014)
@@ -0,0 +1,13 @@
+package org.drools.util;
+
+import java.io.InputStream;
+
+public interface DroolsClassLoader {
+
+    public InputStream getResourceAsStream(final String name);
+
+    public Class<?> fastFindClass(final String name);
+    
+    public Class<?> loadClass(final String name,
+                           final boolean resolve) throws ClassNotFoundException;
+}



More information about the jboss-svn-commits mailing list