[jboss-svn-commits] JBL Code SVN: r31075 - in labs/jbossrules/trunk: drools-api/src/main/java/org/drools and 7 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Wed Jan 13 22:13:03 EST 2010
Author: mark.proctor at jboss.com
Date: 2010-01-13 22:13:02 -0500 (Wed, 13 Jan 2010)
New Revision: 31075
Added:
labs/jbossrules/trunk/drools-api/src/main/java/org/drools/util/internal/
labs/jbossrules/trunk/drools-api/src/main/java/org/drools/util/internal/ChainedProperties.java
labs/jbossrules/trunk/drools-api/src/main/java/org/drools/util/internal/ClassLoaderUtil.java
labs/jbossrules/trunk/drools-api/src/main/java/org/drools/util/internal/CompositeClassLoader.java
labs/jbossrules/trunk/drools-api/src/main/java/org/drools/util/internal/OSGiLocator.java
labs/jbossrules/trunk/drools-api/src/main/java/org/drools/util/internal/serviceLocatorImpl.java
Removed:
labs/jbossrules/trunk/drools-api/src/main/java/org/drools/util/ChainedProperties.java
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-api/src/main/java/org/drools/util/OSGiLocator.java
labs/jbossrules/trunk/drools-api/src/main/java/org/drools/util/ProviderLocator.java
Modified:
labs/jbossrules/trunk/drools-api/META-INF/MANIFEST.MF
labs/jbossrules/trunk/drools-api/src/main/java/org/drools/KnowledgeBaseFactory.java
labs/jbossrules/trunk/drools-api/src/main/java/org/drools/persistence/jpa/JPAKnowledgeService.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/compiler/PackageBuilderConfiguration.java
labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/compiler/PackageBuilderConfigurationTest.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/RuleBaseConfiguration.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/SessionConfiguration.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/io/impl/ClassPathResource.java
Log:
JBRULES-2351 OSGi Ready
-Making the static FactoryServices injectable
Modified: labs/jbossrules/trunk/drools-api/META-INF/MANIFEST.MF
===================================================================
--- labs/jbossrules/trunk/drools-api/META-INF/MANIFEST.MF 2010-01-13 23:37:36 UTC (rev 31074)
+++ labs/jbossrules/trunk/drools-api/META-INF/MANIFEST.MF 2010-01-14 03:13:02 UTC (rev 31075)
@@ -1,77 +1,119 @@
Manifest-Version: 1.0
Created-By: 1.5.0_16 (Sun Microsystems Inc.)
Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
-Import-Package: com.sun.tools.xjc;resolution:=optional;version="2.1",c
- om.thoughtworks.xstream;resolution:=optional;version="1.3",javax.mana
- gement;resolution:=optional,javax.xml.bind;resolution:=optional;versi
- on="2.1",net.sf.jxls.reader;resolution:=optional,org.drools;version="
- 5.1",org.drools.agent;version="5.1",org.drools.builder;version="5.1",
- org.drools.builder.conf;version="5.1",org.drools.builder.help;version
- ="5.1",org.drools.command;version="5.1",org.drools.command.impl;versi
- on="5.1",org.drools.conf;version="5.1",org.drools.definition;version=
- "5.1",org.drools.definition.process;version="5.1",org.drools.definiti
- on.rule;version="5.1",org.drools.definition.type;version="5.1",org.dr
- ools.event;version="5.1",org.drools.event.io;version="5.1",org.drools
- .event.knowledgebase;version="5.1",org.drools.event.process;version="
- 5.1",org.drools.event.rule;version="5.1",org.drools.io;version="5.1",
- org.drools.logger;version="5.1",org.drools.management;version="5.1",o
- rg.drools.marshalling;version="5.1",org.drools.persistence.jpa;versio
- n="5.1",org.drools.runtime;version="5.1",org.drools.runtime.conf;vers
- ion="5.1",org.drools.runtime.help;version="5.1",org.drools.runtime.pi
- peline;version="5.1",org.drools.runtime.process;version="5.1",org.dro
- ols.runtime.rule;version="5.1",org.drools.task.service;version="5.1",
- org.drools.time;version="5.1",org.drools.util;version="5.1",org.drool
- s.vsm;version="5.1",org.milyn;resolution:=optional,org.quartz;resolut
- ion:=optional;version="1.6"
+Import-Package: com.sun.tools.xjc;version="2.1";resolution:=optional,
+ com.thoughtworks.xstream;version="1.3";resolution:=optional,
+ javax.management;resolution:=optional,
+ javax.xml.bind;version="2.1";resolution:=optional,
+ net.sf.jxls.reader;resolution:=optional,
+ org.drools;version="5.1",
+ org.drools.agent;version="5.1",
+ org.drools.builder;version="5.1",
+ org.drools.builder.conf;version="5.1",
+ org.drools.builder.help;version="5.1",
+ org.drools.command;version="5.1",
+ org.drools.command.impl;version="5.1",
+ org.drools.conf;version="5.1",
+ org.drools.definition;version="5.1",
+ org.drools.definition.process;version="5.1",
+ org.drools.definition.rule;version="5.1",
+ org.drools.definition.type;version="5.1",
+ org.drools.event;version="5.1",
+ org.drools.event.io;version="5.1",
+ org.drools.event.knowledgebase;version="5.1",
+ org.drools.event.process;version="5.1",
+ org.drools.event.rule;version="5.1",
+ org.drools.io;version="5.1",
+ org.drools.logger;version="5.1",
+ org.drools.management;version="5.1",
+ org.drools.marshalling;version="5.1",
+ org.drools.persistence.jpa;version="5.1",
+ org.drools.runtime;version="5.1",
+ org.drools.runtime.conf;version="5.1",
+ org.drools.runtime.help;version="5.1",
+ org.drools.runtime.pipeline;version="5.1",
+ org.drools.runtime.process;version="5.1",
+ org.drools.runtime.rule;version="5.1",
+ org.drools.task.service;version="5.1",
+ org.drools.time;version="5.1",
+ org.drools.util.internal;version="5.1",
+ org.drools.vsm;version="5.1",
+ org.milyn;resolution:=optional,
+ org.quartz;version="1.6";resolution:=optional
Bnd-LastModified: 1263413779469
-Export-Package: org.drools.logger;uses:="org.drools.event,org.drools";
- version="5.1.0.SNAPSHOT",org.drools.runtime;uses:="org.drools.command
- ,org.drools.time,org.drools.event,org.drools,org.drools.runtime.proce
- ss,org.drools.runtime.rule,org.drools.runtime.conf";version="5.1.0.SN
- APSHOT",org.drools.task.service;version="5.1.0.SNAPSHOT",org.drools.m
- arshalling;uses:="org.drools.runtime,org.drools";version="5.1.0.SNAPS
- HOT",org.drools.runtime.rule;uses:="org.drools.definition.rule,org.dr
- ools.runtime";version="5.1.0.SNAPSHOT",org.drools.command;uses:="org.
- drools.runtime,org.drools,org.drools.runtime.rule";version="5.1.0.SNA
- PSHOT",org.drools.time;version="5.1.0.SNAPSHOT",org.drools.management
- ;uses:="javax.management";version="5.1.0.SNAPSHOT",org.drools.event.p
- rocess;uses:="org.drools.event,org.drools.runtime.process";version="5
- .1.0.SNAPSHOT",org.drools.event.io;uses:="org.drools";version="5.1.0.
- SNAPSHOT",org.drools.conf;uses:="org.drools.runtime.rule";version="5.
- 1.0.SNAPSHOT",org.drools;uses:="org.drools.io,org.drools.event.knowle
- dgebase,org.drools.runtime,org.drools.definition,org.drools.definitio
- n.rule,org.drools.definition.type,org.drools.definition.process,org.d
- rools.conf,org.drools.util";version="5.1.0.SNAPSHOT",org.drools.runti
- me.conf;uses:="org.drools.conf";version="5.1.0.SNAPSHOT",org.drools.r
- untime.process;uses:="org.drools.runtime";version="5.1.0.SNAPSHOT",or
- g.drools.event.rule;uses:="org.drools.event,org.drools.runtime.rule";
- version="5.1.0.SNAPSHOT",org.drools.builder.help;uses:="com.sun.tools
- .xjc,org.drools.builder,org.drools.io,org.drools,javax.xml.bind";vers
- ion="5.1.0.SNAPSHOT",org.drools.vsm;uses:="org.drools.command,org.dro
- ols.runtime,org.drools.persistence.jpa,org.drools.builder,org.drools,
- org.drools.agent";version="5.1.0.SNAPSHOT",org.drools.builder.conf;us
- es:="org.drools.runtime.rule,org.drools.conf";version="5.1.0.SNAPSHOT
- ",org.drools.definition;uses:="org.drools.definition.rule,org.drools.
- definition.process";version="5.1.0.SNAPSHOT",org.drools.definition.ru
- le;uses:="org.drools.definition";version="5.1.0.SNAPSHOT",org.drools.
- runtime.pipeline;uses:="org.drools.runtime,javax.xml.bind,net.sf.jxls
- .reader,org.milyn,org.drools,com.thoughtworks.xstream";version="5.1.0
- .SNAPSHOT",org.drools.runtime.help;uses:="org.drools,com.thoughtworks
- .xstream,org.drools.time,org.quartz";version="5.1.0.SNAPSHOT",org.dro
- ols.event.knowledgebase;uses:="org.drools.definition.rule,org.drools.
- definition,org.drools";version="5.1.0.SNAPSHOT",org.drools.event;uses
- :="org.drools.runtime,org.drools.event.rule,org.drools.event.process"
- ;version="5.1.0.SNAPSHOT",org.drools.persistence.jpa;uses:="org.drool
- s.runtime,org.drools,org.drools.util";version="5.1.0.SNAPSHOT",org.dr
- ools.builder;uses:="org.drools.io,org.drools.definition,org.drools,or
- g.drools.builder.conf";version="5.1.0.SNAPSHOT",org.drools.io;uses:="
- org.drools,org.drools.event.io";version="5.1.0.SNAPSHOT",org.drools.u
- til;uses:="org.drools";version="5.1.0.SNAPSHOT",org.drools.command.im
- pl;uses:="org.drools.command";version="5.1.0.SNAPSHOT",org.drools.def
- inition.type;version="5.1.0.SNAPSHOT",org.drools.definition.process;u
- ses:="org.drools.definition";version="5.1.0.SNAPSHOT",org.drools.agen
- t;uses:="org.drools.runtime,org.drools,org.drools.io";version="5.1.0.
- SNAPSHOT"
+Export-Package: org.drools;version="5.1.0.SNAPSHOT";
+ uses:="org.drools.io,
+ org.drools.event.knowledgebase,
+ org.drools.runtime,
+ org.drools.definition,
+ org.drools.definition.rule,
+ org.drools.definition.type,
+ org.drools.definition.process,
+ org.drools.conf,
+ org.drools.util",
+ org.drools.agent;version="5.1.0.SNAPSHOT";uses:="org.drools.runtime,org.drools,org.drools.io",
+ org.drools.builder;version="5.1.0.SNAPSHOT";
+ uses:="org.drools.io,
+ org.drools.definition,
+ org.drools,
+ org.drools.builder.conf",
+ org.drools.builder.conf;version="5.1.0.SNAPSHOT";uses:="org.drools.runtime.rule,org.drools.conf",
+ org.drools.builder.help;version="5.1.0.SNAPSHOT";
+ uses:="com.sun.tools.xjc,
+ org.drools.builder,
+ org.drools.io,
+ org.drools,
+ javax.xml.bind",
+ org.drools.command;version="5.1.0.SNAPSHOT";uses:="org.drools.runtime,org.drools,org.drools.runtime.rule",
+ org.drools.command.impl;version="5.1.0.SNAPSHOT";uses:="org.drools.command",
+ org.drools.conf;version="5.1.0.SNAPSHOT";uses:="org.drools.runtime.rule",
+ org.drools.definition;version="5.1.0.SNAPSHOT";uses:="org.drools.definition.rule,org.drools.definition.process",
+ org.drools.definition.process;version="5.1.0.SNAPSHOT";uses:="org.drools.definition",
+ org.drools.definition.rule;version="5.1.0.SNAPSHOT";uses:="org.drools.definition",
+ org.drools.definition.type;version="5.1.0.SNAPSHOT",
+ org.drools.event;version="5.1.0.SNAPSHOT";uses:="org.drools.runtime,org.drools.event.rule,org.drools.event.process",
+ org.drools.event.io;version="5.1.0.SNAPSHOT";uses:="org.drools",
+ org.drools.event.knowledgebase;version="5.1.0.SNAPSHOT";uses:="org.drools.definition.rule,org.drools.definition,org.drools",
+ org.drools.event.process;version="5.1.0.SNAPSHOT";uses:="org.drools.event,org.drools.runtime.process",
+ org.drools.event.rule;version="5.1.0.SNAPSHOT";uses:="org.drools.event,org.drools.runtime.rule",
+ org.drools.io;version="5.1.0.SNAPSHOT";uses:="org.drools,org.drools.event.io",
+ org.drools.logger;version="5.1.0.SNAPSHOT";uses:="org.drools.event,org.drools",
+ org.drools.management;version="5.1.0.SNAPSHOT";uses:="javax.management",
+ org.drools.marshalling;version="5.1.0.SNAPSHOT";uses:="org.drools.runtime,org.drools",
+ org.drools.persistence.jpa;version="5.1.0.SNAPSHOT";uses:="org.drools.runtime,org.drools,org.drools.util",
+ org.drools.runtime;version="5.1.0.SNAPSHOT";
+ uses:="org.drools.command,
+ org.drools.time,
+ org.drools.event,
+ org.drools,
+ org.drools.runtime.process,
+ org.drools.runtime.rule,
+ org.drools.runtime.conf",
+ org.drools.runtime.conf;version="5.1.0.SNAPSHOT";uses:="org.drools.conf",
+ org.drools.runtime.help;version="5.1.0.SNAPSHOT";
+ uses:="org.drools,
+ com.thoughtworks.xstream,
+ org.drools.time,
+ org.quartz",
+ org.drools.runtime.pipeline;version="5.1.0.SNAPSHOT";
+ uses:="org.drools.runtime,
+ javax.xml.bind,
+ net.sf.jxls.reader,
+ org.milyn,
+ org.drools,
+ com.thoughtworks.xstream",
+ org.drools.runtime.process;version="5.1.0.SNAPSHOT";uses:="org.drools.runtime",
+ org.drools.runtime.rule;version="5.1.0.SNAPSHOT";uses:="org.drools.definition.rule,org.drools.runtime",
+ org.drools.task.service;version="5.1.0.SNAPSHOT",
+ org.drools.time;version="5.1.0.SNAPSHOT",
+ org.drools.util.internal;version="5.1.0.SNAPSHOT";uses:="org.drools",
+ org.drools.vsm;version="5.1.0.SNAPSHOT";
+ uses:="org.drools.command,
+ org.drools.runtime,
+ org.drools.persistence.jpa,
+ org.drools.builder,
+ org.drools,
+ org.drools.agent"
Bundle-Version: 5.1.0.SNAPSHOT
Bundle-Name: Drools :: API
Bundle-Description: A rule production system
Modified: labs/jbossrules/trunk/drools-api/src/main/java/org/drools/KnowledgeBaseFactory.java
===================================================================
--- labs/jbossrules/trunk/drools-api/src/main/java/org/drools/KnowledgeBaseFactory.java 2010-01-13 23:37:36 UTC (rev 31074)
+++ labs/jbossrules/trunk/drools-api/src/main/java/org/drools/KnowledgeBaseFactory.java 2010-01-14 03:13:02 UTC (rev 31075)
@@ -4,7 +4,7 @@
import org.drools.runtime.Environment;
import org.drools.runtime.KnowledgeSessionConfiguration;
-import org.drools.util.ProviderLocator;
+import org.drools.util.internal.ServiceLocatorImpl;
/**
* <p>
@@ -34,7 +34,7 @@
*
* @see org.drools.KnowledgeBase
*/
-public class KnowledgeBaseFactory extends ProviderLocator {
+public class KnowledgeBaseFactory {
private static KnowledgeBaseProvider provider;
/**
Modified: labs/jbossrules/trunk/drools-api/src/main/java/org/drools/persistence/jpa/JPAKnowledgeService.java
===================================================================
--- labs/jbossrules/trunk/drools-api/src/main/java/org/drools/persistence/jpa/JPAKnowledgeService.java 2010-01-13 23:37:36 UTC (rev 31074)
+++ labs/jbossrules/trunk/drools-api/src/main/java/org/drools/persistence/jpa/JPAKnowledgeService.java 2010-01-14 03:13:02 UTC (rev 31075)
@@ -5,7 +5,7 @@
import org.drools.runtime.Environment;
import org.drools.runtime.KnowledgeSessionConfiguration;
import org.drools.runtime.StatefulKnowledgeSession;
-import org.drools.util.ProviderLocator;
+import org.drools.util.internal.ServiceLocatorImpl;
/**
* <p>
@@ -84,7 +84,7 @@
* java.naming.factory.initial=bitronix.tm.jndi.BitronixInitialContextFactory
* </pre>
*/
-public class JPAKnowledgeService extends ProviderLocator {
+public class JPAKnowledgeService {
private static JPAKnowledgeServiceProvider provider;
public static StatefulKnowledgeSession newStatefulKnowledgeSession(KnowledgeBase kbase,
Deleted: labs/jbossrules/trunk/drools-api/src/main/java/org/drools/util/ChainedProperties.java
===================================================================
--- labs/jbossrules/trunk/drools-api/src/main/java/org/drools/util/ChainedProperties.java 2010-01-13 23:37:36 UTC (rev 31074)
+++ labs/jbossrules/trunk/drools-api/src/main/java/org/drools/util/ChainedProperties.java 2010-01-14 03:13:02 UTC (rev 31075)
@@ -1,246 +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.List;
-import java.util.Map;
-import java.util.Properties;
-
-/**
- * Priority
- *
- * System properties, home directory, working directory, META-INF/ of optionally provided classLoader
- * META-INF/ of Thread.currentThread().getContextClassLoader() and META-INF/ of ClassLoader.getSystemClassLoader()
- * @author mproctor
- *
- */
-public class ChainedProperties
- implements
- Externalizable {
-
- private List<Properties> props;
- private List<Properties> defaultProps;
-
- public ChainedProperties() {
- }
-
- public ChainedProperties(String confFileName, ClassLoader classLoader) {
- this( confFileName,
- classLoader,
- true );
- }
-
- public ChainedProperties(String confFileName,
- ClassLoader classLoader,
- boolean populateDefaults) {
-
- this.props = new ArrayList<Properties>();
- this.defaultProps = new ArrayList<Properties>();
-
- // 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 );
-
-// if ( classLoader == null ) {
-// classLoader = Thread.currentThread().getContextClassLoader();
-// if ( classLoader == null ) {
-// classLoader = cls.getClassLoader();
-// }
-// }
-
- // check META-INF directories for all known ClassLoaders
- ClassLoader confClassLoader = classLoader;
- loadProperties( getResources( "META-INF/drools." + confFileName,
- confClassLoader ),
- this.props );
- 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 );
- loadProperties( getResources( "/META-INF/drools." + confFileName,
- confClassLoader ),
- this.props );
- }
-
- if ( !populateDefaults ) {
- return;
- }
-
- // load defaults
- confClassLoader = classLoader;
- loadProperties( getResources( "META-INF/drools.default." + confFileName,
- confClassLoader ),
- this.defaultProps );
- 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 );
- loadProperties( getResources( "/META-INF/drools.default." + confFileName,
- confClassLoader ),
- this.defaultProps );
- }
- }
-
- @SuppressWarnings("unchecked")
- public void readExternal(ObjectInput in) throws IOException,
- ClassNotFoundException {
- props = (List<Properties>) in.readObject();
- defaultProps = (List<Properties>) in.readObject();
- }
-
- public void writeExternal(ObjectOutput out) throws IOException {
- out.writeObject( props );
- out.writeObject( defaultProps );
- }
-
- private Enumeration<URL> getResources(String name,
- ClassLoader classLoader) {
- Enumeration<URL> 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 ( Properties props : this.props ) {
- value = props.getProperty( key );
- if ( value != null ) {
- break;
- }
- }
- if ( value == null ) {
- for ( Properties props : this.defaultProps ) {
- value = props.getProperty( key );
- if ( value != null ) {
- break;
- }
- }
- }
- return (value != null) ? value : defaultValue;
- }
-
- public void mapStartsWith(Map<String, String> map,
- String startsWith,
- boolean includeSubProperties) {
- for ( Properties props : this.props ) {
- mapStartsWith( map,
- props,
- startsWith,
- includeSubProperties );
- }
-
- for ( Properties props : this.defaultProps ) {
- mapStartsWith( map,
- props,
- startsWith,
- includeSubProperties );
- }
- }
-
- private void mapStartsWith(Map<String, String> 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<URL> enumeration,
- List<Properties> chain) {
- if ( enumeration == null ) {
- return;
- }
-
- while ( enumeration.hasMoreElements() ) {
- URL url = (URL) enumeration.nextElement();
- loadProperties( url,
- chain );
- }
- }
-
- private void loadProperties(String fileName,
- List<Properties> 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 " + fileName + " properties value '" + file + "'" );
- }
- } else {
- //throw new IllegalArgumentException( fileName + " is specified but cannot be found '" + file + "'" );
- }
- }
- }
-
- private void loadProperties(URL confURL,
- List<Properties> chain) {
- if ( confURL == null ) {
- return;
- }
- Properties properties = new Properties();
- try {
- java.io.InputStream is = confURL.openStream();
- properties.load( is );
- is.close();
- chain.add( properties );
- } catch ( IOException e ) {
- //throw new IllegalArgumentException( "Invalid URL to properties file '" + confURL.toExternalForm() + "'" );
- }
- }
-}
\ No newline at end of file
Deleted: 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 2010-01-13 23:37:36 UTC (rev 31074)
+++ labs/jbossrules/trunk/drools-api/src/main/java/org/drools/util/ClassLoaderUtil.java 2010-01-14 03:13:02 UTC (rev 31075)
@@ -1,35 +0,0 @@
-package org.drools.util;
-
-import java.util.ArrayList;
-import java.util.IdentityHashMap;
-import java.util.List;
-import java.util.Map.Entry;
-
-public class ClassLoaderUtil {
- public static ClassLoader getClassLoader(final ClassLoader classLoader, Class cls) {
- ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
- ClassLoader currentClassLoader = ( cls != null ) ? cls.getClassLoader() : ClassLoaderUtil.class.getClassLoader();
- ClassLoader systemClassLoader = Class.class.getClassLoader().getSystemClassLoader();
-
- IdentityHashMap<ClassLoader, Object> map = new IdentityHashMap<ClassLoader, Object>();
- map.put( classLoader, null );
- map.put( contextClassLoader, null );
- map.put( currentClassLoader, null );
- map.put( systemClassLoader, null );
-
- if ( map.size() > 0 ) {
- CompositeClassLoader cl = new CompositeClassLoader( null );
- for ( ClassLoader entry : map.keySet() ) {
- if ( entry != null ) {
- cl.addClassLoader( entry );
- }
- }
-
- return cl;
-
- } else {
- return map.keySet().iterator().next();
- }
-
- }
-}
Deleted: 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 2010-01-13 23:37:36 UTC (rev 31074)
+++ labs/jbossrules/trunk/drools-api/src/main/java/org/drools/util/CompositeClassLoader.java 2010-01-14 03:13:02 UTC (rev 31075)
@@ -1,169 +0,0 @@
-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-api/src/main/java/org/drools/util/OSGiLocator.java
===================================================================
--- labs/jbossrules/trunk/drools-api/src/main/java/org/drools/util/OSGiLocator.java 2010-01-13 23:37:36 UTC (rev 31074)
+++ labs/jbossrules/trunk/drools-api/src/main/java/org/drools/util/OSGiLocator.java 2010-01-14 03:13:02 UTC (rev 31075)
@@ -1,169 +0,0 @@
-/*
- * 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.drools.util;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.Callable;
-
-/**
- * Maintains a mapping of service names to an ordered set of service
- * providers when running in an OSGi container.
- * <p/>
- * It is expected that a bundle using Drools will populate this map
- * with properties from its own ClassLoader.
- * <p/>
- * This is an adaptation of the technique described by Guillaume Nodet
- * in his article<i>
- * <a href='http://gnodet.blogspot.com/2008/05/jee-specs-in-osgi.html'>
- * Java EE specs in OSGi</a></i>. The main changes were to add comments.
- *
- * @author Guillaume Nodet
- * @author Faron Dutton
- * @see {@linkplain http://gnodet.blogspot.com/2008/05/jee-specs-in-osgi.html}
- */
-public final class OSGiLocator {
-
- /**
- * Maps a service name (the fully qualified name of the interface)
- * to an ordered set of factories. Each factory instantiating
- * a specific service provider (implementation).
- */
- private static Map<String, List<Callable<Class< ? >>>> factories;
-
- /**
- * Private constructor used to prevent instantiation of this
- * utility class (i.e., Utility Pattern).
- */
- private OSGiLocator() {
- super();
- }
-
- /**
- * Removes the given service provider factory from the set of
- * providers for the service.
- *
- * @param serviceName
- * The fully qualified name of the service interface.
- * @param factory
- * A factory for creating a specific type of service
- * provider. May be <tt>null</tt> in which case this
- * method does nothing.
- * @throws IllegalArgumentException if serviceName is <tt>null</tt>
- */
- public static synchronized void unregister(final String serviceName,
- final Callable<Class< ? >> factory) {
- if ( serviceName == null ) {
- throw new IllegalArgumentException( "serviceName cannot be null" );
- }
- if ( factories != null ) {
- List<Callable<Class< ? >>> l = factories.get( serviceName );
- if ( l != null ) {
- l.remove( factory );
- }
- }
- }
-
- /**
- * Adds the given service provider factory to the set of
- * providers for the service.
- *
- * @param serviceName
- * The fully qualified name of the service interface.
- * @param factory
- * A factory for creating a specific type of service
- * provider. May be <tt>null</tt> in which case this
- * method does nothing.
- * @throws IllegalArgumentException if serviceName is <tt>null</tt>
- */
- public static synchronized void register(final String serviceName,
- final Callable<Class< ? >> factory) {
- if ( serviceName == null ) {
- throw new IllegalArgumentException( "serviceName cannot be null" );
- }
- if ( factory != null ) {
- if ( factories == null ) {
- factories = new HashMap<String, List<Callable<Class< ? >>>>();
- }
- List<Callable<Class< ? >>> l = factories.get( serviceName );
- if ( l == null ) {
- l = new ArrayList<Callable<Class< ? >>>();
- factories.put( serviceName,
- l );
- }
- l.add( factory );
- }
- }
-
- /**
- * Finds the preferred provider for the given service. The preferred
- * provider is the last one added to the set of providers.
- *
- * @param serviceName
- * The fully qualified name of the service interface.
- * @return
- * The last provider added for the service if any exists.
- * Otherwise, it returns <tt>null</tt>.
- * @throws IllegalArgumentException if serviceName is <tt>null</tt>
- */
- public static synchronized Class< ? > locate(final String serviceName) {
- if ( serviceName == null ) {
- throw new IllegalArgumentException( "serviceName cannot be null" );
- }
- if ( factories != null ) {
- List<Callable<Class< ? >>> l = factories.get( serviceName );
- if ( l != null && !l.isEmpty() ) {
- Callable<Class< ? >> c = l.get( l.size() - 1 );
- try {
- return c.call();
- } catch ( Exception e ) {
- }
- }
- }
- return null;
- }
-
- /**
- * Finds all providers for the given service.
- *
- * @param serviceName
- * The fully qualified name of the service interface.
- * @return
- * The ordered set of providers for the service if any exists.
- * Otherwise, it returns an empty list.
- * @throws IllegalArgumentException if serviceName is <tt>null</tt>
- */
- public static synchronized List<Class< ? >> locateAll(final String serviceName) {
- if ( serviceName == null ) {
- throw new IllegalArgumentException( "serviceName cannot be null" );
- }
- List<Class< ? >> classes = new ArrayList<Class< ? >>();
- if ( factories != null ) {
- List<Callable<Class< ? >>> l = factories.get( serviceName );
- if ( l != null ) {
- for ( Callable<Class< ? >> c : l ) {
- try {
- classes.add( c.call() );
- } catch ( Exception e ) {
- }
- }
- }
- }
- return classes;
- }
-
-}
\ No newline at end of file
Deleted: labs/jbossrules/trunk/drools-api/src/main/java/org/drools/util/ProviderLocator.java
===================================================================
--- labs/jbossrules/trunk/drools-api/src/main/java/org/drools/util/ProviderLocator.java 2010-01-13 23:37:36 UTC (rev 31074)
+++ labs/jbossrules/trunk/drools-api/src/main/java/org/drools/util/ProviderLocator.java 2010-01-14 03:13:02 UTC (rev 31075)
@@ -1,307 +0,0 @@
-/*
- * 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.drools.util;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.drools.ProviderInitializationException;
-
-/**
- * Provides mechanisms for loading service providers dynamically.
- * <p/>
- * Provider factories may extend this class to provide a consistent
- * lookup mechanism. For example, KnowledgeBaseFactory creates
- * a KonwledgeBase using a service provider that implements the
- * KnowlwdgeProvider interface.
- * <pre>
- * public class KnowledgeBaseFactory extends ProviderLocator {
- * private static KnowledgeBaseProvider provider;
- *
- * public static KnowledgeBase newKnowledgeBase() {
- * return getKnowledgeBaseProvider().newKnowledgeBase();
- * }
- *
- * private static synchronized KnowledgeBaseProvider getKnowledgeBaseProvider() {
- * if ( provider == null ) {
- * provider = newProviderFor( KnowledgeBaseProvider.class );
- * }
- * return provider;
- * }
- * }
- * </pre>
- * <tt>getKnowledgeBaseProvider()</tt> simply calls a method on this class
- * to instantiate a provider for <tt>KnowledgeBaseProvider</tt>.
- * <p/>
- * This is an adaptation of the technique described by Guillaume Nodet
- * in his article<i>
- * <a href='http://gnodet.blogspot.com/2008/05/jee-specs-in-osgi.html'>
- * Java EE specs in OSGi</a></i>, which is an adaptation of the
- * FactoryLocator class in <a href='http://stax.codehaus.org/'>StAX</a>.
- * The main changes were to use the existing Drools's lookup strategy
- * for properties, add comments and error handling, and properly
- * parse a Service Configuration File.
- *
- * @author Guillaume Nodet
- * @author Faron Dutton
- * @see {@linkplain http://gnodet.blogspot.com/2008/05/jee-specs-in-osgi.html}
- * @see {@linkplain http://svn.apache.org/repos/asf/servicemix/smx4/specs/trunk/stax-api-1.0/src/main/java/javax/xml/stream/FactoryLocator.java}
- */
-public abstract class ProviderLocator {
-
- // TODO: May need to change the name of the properties file.
- private static final String CONFIG_FILE = "services.conf";
-
- /**
- * Locates and instantiates a new provider for the given service.
- * <p/>
- * This is a convenience method equivalent to calling
- * {@link #newProviderFor(Class, ClassLoader) newProviderFor(serviceClass, null)}.
- *
- * @param <T>
- * Either an interface or a (usually abstract) class
- * defining a service as described in the JAR File
- * Specification.
- * @param serviceClass
- * The Class for <tt>T</tt>. Used to cast the new object
- * to <tt>T</tt>. It is important that this Class be
- * visible from the given ClassLoader (if provided).
- * @return A new instance of the service provider.
- * @throws ProviderInitializationException
- * If a provider cannot be found, cannot be instantiated,
- * is not accessible, or does not implement (extend) the
- * interface (class) <tt>T</tt>.
- * @see {@linkplain http://java.sun.com/j2se/1.4.2/docs/guide/jar/jar.html#Service%20Provider}
- */
- protected static final <T> T newProviderFor(final Class<T> serviceClass) throws ProviderInitializationException {
- return newProviderFor( serviceClass,
- (ClassLoader) null );
- }
-
- /**
- * Locates and instantiates a new provider for the given service.
- * <p/>
- * This method uses the following strategy to locate a provider:
- * <ol>
- * <li>If running in an OSGi container then use the provider from the client bundle</li>
- * <li>Use the strategy from {@link org.drools.util.ChainedProperties ChainedProperties}</li>
- * <li>Use the Service API from the JAR File Specification</li>
- * </ol>
- *
- * @param <T>
- * Either an interface or a (usually abstract) class
- * defining a service as described in the JAR File
- * Specification.
- * @param serviceClass
- * The Class for <tt>T</tt>. Used to cast the new object
- * to <tt>T</tt>. It is important that this Class be
- * visible from the given ClassLoader (if provided).
- * @param classLoader
- * An optional ClassLoader used to load and instantiate
- * the service provider. May be <tt>null</tt>.
- * @return A new instance of the service provider.
- * @throws ProviderInitializationException
- * If a provider cannot be found, cannot be instantiated,
- * is not accessible, or does not implement (extend) the
- * interface (class) <tt>T</tt>.
- * @see {@linkplain http://java.sun.com/j2se/1.4.2/docs/guide/jar/jar.html#Service%20Provider}
- */
- protected static final <T> T newProviderFor(final Class<T> serviceClass,
- final ClassLoader classLoader) throws ProviderInitializationException {
- // If we are deployed into an OSGi environment, leverage it
- Class< ? > providerClass = OSGiLocator.locate( serviceClass.getName() );
- if ( providerClass != null ) {
- return newInstance( serviceClass,
- providerClass );
- }
-
- // Look for a definition in the Drools config files.
- ChainedProperties props = new ChainedProperties( CONFIG_FILE,
- ClassLoaderUtil.getClassLoader( null, ProviderLocator.class ),
- true );
- String providerName = props.getProperty( serviceClass.getName(),
- null );
- if ( providerName != null ) {
- return newInstance( serviceClass,
- providerName,
- classLoader );
- }
-
- // Look for a service provider specified using the mechanism
- // described in the JAR File Specification.
- String serviceId = "META-INF/services/".concat( serviceClass.getName() );
- InputStream providerConfigFile = (classLoader != null) ? classLoader.getResourceAsStream( serviceId ) : ClassLoader.getSystemResourceAsStream( serviceId );
- if ( providerConfigFile != null ) {
- try {
- List<String> results = readProvidersFrom( providerConfigFile );
- if ( !results.isEmpty() ) {
- return newInstance( serviceClass,
- results.get( 0 ),
- classLoader );
- }
- } catch ( IOException e ) {
- final String msg = MessageFormat.format( ERR_FILE_READ,
- serviceClass.getName() );
- throw new ProviderInitializationException( msg,
- e );
- } finally {
- try {
- providerConfigFile.close();
- } catch ( IOException e ) {
- // FIXME: This should use the Drools logging mechanism.
- e.printStackTrace();
- }
- }
- }
-
- // did not find an implementation anywhere
- final String msg = MessageFormat.format( ERR_NOT_FOUND,
- serviceClass.getName() );
- throw new ProviderInitializationException( msg );
- }
-
- /**
- * Parses a Provider-Configuration File as described in the JAR
- * File Specification.
- *
- * @param stream
- * An open byte stream encoded using UTF-8.
- * @return
- * A list of all the service providers identified in the
- * given stream.
- * @throws IOException If an I/O error occurs
- */
- protected static final List<String> readProvidersFrom(final InputStream stream) throws IOException {
- final Set<String> results = new LinkedHashSet<String>();
-
- if ( stream != null ) {
- BufferedReader reader = new BufferedReader( new InputStreamReader( stream,
- "UTF-8" ) );
- String line;
- while ( (line = reader.readLine()) != null ) {
- int pos = line.indexOf( '#' );
- if ( pos >= 0 ) {
- line = line.substring( 0,
- pos );
- }
- line = line.trim();
- if ( line.length() != 0 ) {
- results.add( line );
- }
- }
- }
-
- return new ArrayList<String>( results );
- }
-
- /**
- * Instantiates a new object implementing the interface <tt>T</tt>.
- *
- * @param <T>
- * Either an interface or a (usually abstract) class
- * defining a service as described in the JAR File
- * Specification.
- * @param serviceClass
- * The Class for <tt>T</tt>. Used to cast the new object
- * to <tt>T</tt>. It is important that this Class be
- * visible from the given ClassLoader (if provided).
- * @param providerName
- * A fully qualified name of a class implementing the
- * service.
- * @param classLoader
- * An optional ClassLoader used to load and instantiate
- * the service provider. May be <tt>null</tt>.
- * @return A new instance of the service provider.
- * @throws ProviderInitializationException
- * If the class specified by providerName cannot be found,
- * cannot be instantiated, is not accessible, or does not
- * implement (extend) the interface (class) <tt>T</tt>.
- * @see {@linkplain http://java.sun.com/j2se/1.4.2/docs/guide/jar/jar.html#Service%20Provider}
- */
- private static <T> T newInstance(final Class<T> serviceClass,
- final String providerName,
- final ClassLoader classLoader) throws ProviderInitializationException {
- try {
- Class< ? > providerClass = classLoader == null ? Class.forName( providerName ) : classLoader.loadClass( providerName );
- return newInstance( serviceClass,
- providerClass );
- } catch ( ClassNotFoundException e ) {
- final String msg = MessageFormat.format( ERR_NOT_FOUND,
- serviceClass.getName() );
- throw new ProviderInitializationException( msg,
- e );
- }
- }
-
- /**
- * Instantiates a new object implementing the interface <tt>T</tt>.
- *
- * @param <T>
- * Either an interface or a (usually abstract) class
- * defining a service as described in the JAR File
- * Specification.
- * @param serviceClass
- * The Class for <tt>T</tt>. Used to cast the new object
- * to <tt>T</tt>. It is important that this Class be
- * visible from the given ClassLoader (if provided).
- * @param providerClass
- * A class implementing the interface <tt>T</tt>.
- * @return A new instance of the service provider.
- * @throws ProviderInitializationException
- * If the class cannot be instantiated, is not accessible,
- * or does not implement (extend) the interface (class)
- * <tt>T</tt>.
- * @see {@linkplain http://java.sun.com/j2se/1.4.2/docs/guide/jar/jar.html#Service%20Provider}
- */
- private static <T> T newInstance(final Class<T> serviceClass,
- final Class< ? > providerClass) throws ProviderInitializationException {
- try {
- Object provider = providerClass.newInstance();
- return serviceClass.cast( provider );
- } catch ( InstantiationException e ) {
- final String msg = MessageFormat.format( ERR_NOT_CONCRETE,
- providerClass.getName() );
- throw new ProviderInitializationException( msg,
- e );
- } catch ( IllegalAccessException e ) {
- final String msg = MessageFormat.format( ERR_NOT_ACCESSIBLE,
- providerClass.getName() );
- throw new ProviderInitializationException( msg,
- e );
- } catch ( ClassCastException e ) {
- final String pattern = serviceClass.isInterface() ? ERR_IMPLEMENTS : ERR_EXTENDS;
- final String msg = MessageFormat.format( pattern,
- providerClass.getName(),
- serviceClass.getName() );
- throw new ProviderInitializationException( msg,
- e );
- }
- }
-
- // Localized messages -- move to resource bundle.
- private static final String ERR_FILE_READ = "Unable to read the Provider-Configuration File for {0}.";
- private static final String ERR_EXTENDS = "Provider {0} does not extend {2}.";
- private static final String ERR_IMPLEMENTS = "Provider {0} does not implement {2}.";
- private static final String ERR_NOT_ACCESSIBLE = "Provider {0} is not accessible.";
- private static final String ERR_NOT_CONCRETE = "Provider {0} cannot be instantiated.";
- private static final String ERR_NOT_FOUND = "Provider for {0} could not be found.";
-}
Copied: labs/jbossrules/trunk/drools-api/src/main/java/org/drools/util/internal/ChainedProperties.java (from rev 31071, labs/jbossrules/trunk/drools-api/src/main/java/org/drools/util/ChainedProperties.java)
===================================================================
--- labs/jbossrules/trunk/drools-api/src/main/java/org/drools/util/internal/ChainedProperties.java (rev 0)
+++ labs/jbossrules/trunk/drools-api/src/main/java/org/drools/util/internal/ChainedProperties.java 2010-01-14 03:13:02 UTC (rev 31075)
@@ -0,0 +1,246 @@
+package org.drools.util.internal;
+
+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.List;
+import java.util.Map;
+import java.util.Properties;
+
+/**
+ * Priority
+ *
+ * System properties, home directory, working directory, META-INF/ of optionally provided classLoader
+ * META-INF/ of Thread.currentThread().getContextClassLoader() and META-INF/ of ClassLoader.getSystemClassLoader()
+ * @author mproctor
+ *
+ */
+public class ChainedProperties
+ implements
+ Externalizable {
+
+ private List<Properties> props;
+ private List<Properties> defaultProps;
+
+ public ChainedProperties() {
+ }
+
+ public ChainedProperties(String confFileName, ClassLoader classLoader) {
+ this( confFileName,
+ classLoader,
+ true );
+ }
+
+ public ChainedProperties(String confFileName,
+ ClassLoader classLoader,
+ boolean populateDefaults) {
+
+ this.props = new ArrayList<Properties>();
+ this.defaultProps = new ArrayList<Properties>();
+
+ // 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 );
+
+// if ( classLoader == null ) {
+// classLoader = Thread.currentThread().getContextClassLoader();
+// if ( classLoader == null ) {
+// classLoader = cls.getClassLoader();
+// }
+// }
+
+ // check META-INF directories for all known ClassLoaders
+ ClassLoader confClassLoader = classLoader;
+ loadProperties( getResources( "META-INF/drools." + confFileName,
+ confClassLoader ),
+ this.props );
+ 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 );
+ loadProperties( getResources( "/META-INF/drools." + confFileName,
+ confClassLoader ),
+ this.props );
+ }
+
+ if ( !populateDefaults ) {
+ return;
+ }
+
+ // load defaults
+ confClassLoader = classLoader;
+ loadProperties( getResources( "META-INF/drools.default." + confFileName,
+ confClassLoader ),
+ this.defaultProps );
+ 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 );
+ loadProperties( getResources( "/META-INF/drools.default." + confFileName,
+ confClassLoader ),
+ this.defaultProps );
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ public void readExternal(ObjectInput in) throws IOException,
+ ClassNotFoundException {
+ props = (List<Properties>) in.readObject();
+ defaultProps = (List<Properties>) in.readObject();
+ }
+
+ public void writeExternal(ObjectOutput out) throws IOException {
+ out.writeObject( props );
+ out.writeObject( defaultProps );
+ }
+
+ private Enumeration<URL> getResources(String name,
+ ClassLoader classLoader) {
+ Enumeration<URL> 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 ( Properties props : this.props ) {
+ value = props.getProperty( key );
+ if ( value != null ) {
+ break;
+ }
+ }
+ if ( value == null ) {
+ for ( Properties props : this.defaultProps ) {
+ value = props.getProperty( key );
+ if ( value != null ) {
+ break;
+ }
+ }
+ }
+ return (value != null) ? value : defaultValue;
+ }
+
+ public void mapStartsWith(Map<String, String> map,
+ String startsWith,
+ boolean includeSubProperties) {
+ for ( Properties props : this.props ) {
+ mapStartsWith( map,
+ props,
+ startsWith,
+ includeSubProperties );
+ }
+
+ for ( Properties props : this.defaultProps ) {
+ mapStartsWith( map,
+ props,
+ startsWith,
+ includeSubProperties );
+ }
+ }
+
+ private void mapStartsWith(Map<String, String> 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<URL> enumeration,
+ List<Properties> chain) {
+ if ( enumeration == null ) {
+ return;
+ }
+
+ while ( enumeration.hasMoreElements() ) {
+ URL url = (URL) enumeration.nextElement();
+ loadProperties( url,
+ chain );
+ }
+ }
+
+ private void loadProperties(String fileName,
+ List<Properties> 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 " + fileName + " properties value '" + file + "'" );
+ }
+ } else {
+ //throw new IllegalArgumentException( fileName + " is specified but cannot be found '" + file + "'" );
+ }
+ }
+ }
+
+ private void loadProperties(URL confURL,
+ List<Properties> chain) {
+ if ( confURL == null ) {
+ return;
+ }
+ Properties properties = new Properties();
+ try {
+ java.io.InputStream is = confURL.openStream();
+ properties.load( is );
+ is.close();
+ chain.add( properties );
+ } catch ( IOException e ) {
+ //throw new IllegalArgumentException( "Invalid URL to properties file '" + confURL.toExternalForm() + "'" );
+ }
+ }
+}
\ No newline at end of file
Copied: labs/jbossrules/trunk/drools-api/src/main/java/org/drools/util/internal/ClassLoaderUtil.java (from rev 31071, labs/jbossrules/trunk/drools-api/src/main/java/org/drools/util/ClassLoaderUtil.java)
===================================================================
--- labs/jbossrules/trunk/drools-api/src/main/java/org/drools/util/internal/ClassLoaderUtil.java (rev 0)
+++ labs/jbossrules/trunk/drools-api/src/main/java/org/drools/util/internal/ClassLoaderUtil.java 2010-01-14 03:13:02 UTC (rev 31075)
@@ -0,0 +1,35 @@
+package org.drools.util.internal;
+
+import java.util.ArrayList;
+import java.util.IdentityHashMap;
+import java.util.List;
+import java.util.Map.Entry;
+
+public class ClassLoaderUtil {
+ public static ClassLoader getClassLoader(final ClassLoader classLoader, Class cls) {
+ ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
+ ClassLoader currentClassLoader = ( cls != null ) ? cls.getClassLoader() : ClassLoaderUtil.class.getClassLoader();
+ ClassLoader systemClassLoader = Class.class.getClassLoader().getSystemClassLoader();
+
+ IdentityHashMap<ClassLoader, Object> map = new IdentityHashMap<ClassLoader, Object>();
+ map.put( classLoader, null );
+ map.put( contextClassLoader, null );
+ map.put( currentClassLoader, null );
+ map.put( systemClassLoader, null );
+
+ if ( map.size() > 0 ) {
+ CompositeClassLoader cl = new CompositeClassLoader( null );
+ for ( ClassLoader entry : map.keySet() ) {
+ if ( entry != null ) {
+ cl.addClassLoader( entry );
+ }
+ }
+
+ return cl;
+
+ } else {
+ return map.keySet().iterator().next();
+ }
+
+ }
+}
Copied: labs/jbossrules/trunk/drools-api/src/main/java/org/drools/util/internal/CompositeClassLoader.java (from rev 31071, labs/jbossrules/trunk/drools-api/src/main/java/org/drools/util/CompositeClassLoader.java)
===================================================================
--- labs/jbossrules/trunk/drools-api/src/main/java/org/drools/util/internal/CompositeClassLoader.java (rev 0)
+++ labs/jbossrules/trunk/drools-api/src/main/java/org/drools/util/internal/CompositeClassLoader.java 2010-01-14 03:13:02 UTC (rev 31075)
@@ -0,0 +1,169 @@
+package org.drools.util.internal;
+
+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();
+ }
+ }
+}
Copied: labs/jbossrules/trunk/drools-api/src/main/java/org/drools/util/internal/OSGiLocator.java (from rev 31071, labs/jbossrules/trunk/drools-api/src/main/java/org/drools/util/OSGiLocator.java)
===================================================================
--- labs/jbossrules/trunk/drools-api/src/main/java/org/drools/util/internal/OSGiLocator.java (rev 0)
+++ labs/jbossrules/trunk/drools-api/src/main/java/org/drools/util/internal/OSGiLocator.java 2010-01-14 03:13:02 UTC (rev 31075)
@@ -0,0 +1,169 @@
+/*
+ * 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.drools.util.internal;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.Callable;
+
+/**
+ * Maintains a mapping of service names to an ordered set of service
+ * providers when running in an OSGi container.
+ * <p/>
+ * It is expected that a bundle using Drools will populate this map
+ * with properties from its own ClassLoader.
+ * <p/>
+ * This is an adaptation of the technique described by Guillaume Nodet
+ * in his article<i>
+ * <a href='http://gnodet.blogspot.com/2008/05/jee-specs-in-osgi.html'>
+ * Java EE specs in OSGi</a></i>. The main changes were to add comments.
+ *
+ * @author Guillaume Nodet
+ * @author Faron Dutton
+ * @see {@linkplain http://gnodet.blogspot.com/2008/05/jee-specs-in-osgi.html}
+ */
+public final class OSGiLocator {
+
+ /**
+ * Maps a service name (the fully qualified name of the interface)
+ * to an ordered set of factories. Each factory instantiating
+ * a specific service provider (implementation).
+ */
+ private static Map<String, List<Callable<Class< ? >>>> factories;
+
+ /**
+ * Private constructor used to prevent instantiation of this
+ * utility class (i.e., Utility Pattern).
+ */
+ private OSGiLocator() {
+ super();
+ }
+
+ /**
+ * Removes the given service provider factory from the set of
+ * providers for the service.
+ *
+ * @param serviceName
+ * The fully qualified name of the service interface.
+ * @param factory
+ * A factory for creating a specific type of service
+ * provider. May be <tt>null</tt> in which case this
+ * method does nothing.
+ * @throws IllegalArgumentException if serviceName is <tt>null</tt>
+ */
+ public static synchronized void unregister(final String serviceName,
+ final Callable<Class< ? >> factory) {
+ if ( serviceName == null ) {
+ throw new IllegalArgumentException( "serviceName cannot be null" );
+ }
+ if ( factories != null ) {
+ List<Callable<Class< ? >>> l = factories.get( serviceName );
+ if ( l != null ) {
+ l.remove( factory );
+ }
+ }
+ }
+
+ /**
+ * Adds the given service provider factory to the set of
+ * providers for the service.
+ *
+ * @param serviceName
+ * The fully qualified name of the service interface.
+ * @param factory
+ * A factory for creating a specific type of service
+ * provider. May be <tt>null</tt> in which case this
+ * method does nothing.
+ * @throws IllegalArgumentException if serviceName is <tt>null</tt>
+ */
+ public static synchronized void register(final String serviceName,
+ final Callable<Class< ? >> factory) {
+ if ( serviceName == null ) {
+ throw new IllegalArgumentException( "serviceName cannot be null" );
+ }
+ if ( factory != null ) {
+ if ( factories == null ) {
+ factories = new HashMap<String, List<Callable<Class< ? >>>>();
+ }
+ List<Callable<Class< ? >>> l = factories.get( serviceName );
+ if ( l == null ) {
+ l = new ArrayList<Callable<Class< ? >>>();
+ factories.put( serviceName,
+ l );
+ }
+ l.add( factory );
+ }
+ }
+
+ /**
+ * Finds the preferred provider for the given service. The preferred
+ * provider is the last one added to the set of providers.
+ *
+ * @param serviceName
+ * The fully qualified name of the service interface.
+ * @return
+ * The last provider added for the service if any exists.
+ * Otherwise, it returns <tt>null</tt>.
+ * @throws IllegalArgumentException if serviceName is <tt>null</tt>
+ */
+ public static synchronized Class< ? > locate(final String serviceName) {
+ if ( serviceName == null ) {
+ throw new IllegalArgumentException( "serviceName cannot be null" );
+ }
+ if ( factories != null ) {
+ List<Callable<Class< ? >>> l = factories.get( serviceName );
+ if ( l != null && !l.isEmpty() ) {
+ Callable<Class< ? >> c = l.get( l.size() - 1 );
+ try {
+ return c.call();
+ } catch ( Exception e ) {
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Finds all providers for the given service.
+ *
+ * @param serviceName
+ * The fully qualified name of the service interface.
+ * @return
+ * The ordered set of providers for the service if any exists.
+ * Otherwise, it returns an empty list.
+ * @throws IllegalArgumentException if serviceName is <tt>null</tt>
+ */
+ public static synchronized List<Class< ? >> locateAll(final String serviceName) {
+ if ( serviceName == null ) {
+ throw new IllegalArgumentException( "serviceName cannot be null" );
+ }
+ List<Class< ? >> classes = new ArrayList<Class< ? >>();
+ if ( factories != null ) {
+ List<Callable<Class< ? >>> l = factories.get( serviceName );
+ if ( l != null ) {
+ for ( Callable<Class< ? >> c : l ) {
+ try {
+ classes.add( c.call() );
+ } catch ( Exception e ) {
+ }
+ }
+ }
+ }
+ return classes;
+ }
+
+}
\ No newline at end of file
Copied: labs/jbossrules/trunk/drools-api/src/main/java/org/drools/util/internal/serviceLocatorImpl.java (from rev 31071, labs/jbossrules/trunk/drools-api/src/main/java/org/drools/util/ProviderLocator.java)
===================================================================
--- labs/jbossrules/trunk/drools-api/src/main/java/org/drools/util/internal/serviceLocatorImpl.java (rev 0)
+++ labs/jbossrules/trunk/drools-api/src/main/java/org/drools/util/internal/serviceLocatorImpl.java 2010-01-14 03:13:02 UTC (rev 31075)
@@ -0,0 +1,71 @@
+/*
+ * 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.drools.util.internal;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.drools.KnowledgeBaseProvider;
+import org.drools.builder.KnowledgeBuilderProvider;
+import org.drools.io.ResourceProvider;
+
+/**
+ * This is an internal class, not for public consumption.
+ *
+ */
+public class serviceLocatorImpl {
+ private static serviceLocatorImpl instance = new serviceLocatorImpl();
+
+ private Map<String, Callable<Class< ? >>> serviceFactories = new HashMap<String, Callable<Class< ? >>>();
+
+ public static serviceLocatorImpl getInstance() {
+ return serviceLocatorImpl.instance;
+ }
+
+ public synchronized void registerLocator(String name, Callable<Class< ? >> cal) {
+ this.serviceFactories.put( name, cal );
+ }
+
+ public synchronized void unregisterLocator(String name) {
+ this.serviceFactories.remove( name );
+ }
+
+ public synchronized <T> T locate(Class<T> cls) {
+
+ Callable<Class< ? >> cal = this.serviceFactories.get( cls.getName() );
+ if ( cal != null ) {
+ try {
+ return cls.cast( cal.call() );
+ } catch ( Exception e ) {
+ throw new IllegalArgumentException( "Unable to instantiate service for Class '" + (cls != null ? cls.getName() : null) + "'",
+ e );
+ }
+ } else {
+ throw new IllegalArgumentException( "Unable to locate a service for Class '" + (cls != null ? cls.getName() : null) + "'" );
+ }
+ }
+
+ private void init() {
+ serviceFactories.put( KnowledgeBuilderProvider.class.getName(),
+ null );
+ serviceFactories.put( KnowledgeBaseProvider.class.getName(),
+ null );
+ serviceFactories.put( ResourceProvider.class.getName(),
+ null );
+ }
+
+}
Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/compiler/PackageBuilderConfiguration.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/compiler/PackageBuilderConfiguration.java 2010-01-13 23:37:36 UTC (rev 31074)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/compiler/PackageBuilderConfiguration.java 2010-01-14 03:13:02 UTC (rev 31075)
@@ -42,12 +42,12 @@
import org.drools.process.builder.ProcessNodeBuilderRegistry;
import org.drools.rule.Package;
import org.drools.runtime.rule.AccumulateFunction;
-import org.drools.util.ChainedProperties;
-import org.drools.util.ClassLoaderUtil;
import org.drools.util.ClassUtils;
-import org.drools.util.CompositeClassLoader;
import org.drools.util.ConfFileUtils;
import org.drools.util.StringUtils;
+import org.drools.util.internal.ChainedProperties;
+import org.drools.util.internal.ClassLoaderUtil;
+import org.drools.util.internal.CompositeClassLoader;
import org.drools.workflow.core.Node;
import org.drools.xml.ChangeSetSemanticModule;
import org.drools.xml.DefaultSemanticModule;
Modified: labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/compiler/PackageBuilderConfigurationTest.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/compiler/PackageBuilderConfigurationTest.java 2010-01-13 23:37:36 UTC (rev 31074)
+++ labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/compiler/PackageBuilderConfigurationTest.java 2010-01-14 03:13:02 UTC (rev 31075)
@@ -44,7 +44,7 @@
import org.drools.rule.builder.RuleConditionBuilder;
import org.drools.rule.builder.SalienceBuilder;
import org.drools.rule.builder.dialect.java.JavaDialectConfiguration;
-import org.drools.util.ChainedProperties;
+import org.drools.util.internal.ChainedProperties;
public class PackageBuilderConfigurationTest extends TestCase {
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/RuleBaseConfiguration.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/RuleBaseConfiguration.java 2010-01-13 23:37:36 UTC (rev 31074)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/RuleBaseConfiguration.java 2010-01-14 03:13:02 UTC (rev 31075)
@@ -67,11 +67,11 @@
import org.drools.runtime.rule.ConsequenceExceptionHandler;
import org.drools.runtime.rule.impl.DefaultConsequenceExceptionHandler;
import org.drools.spi.ConflictResolver;
-import org.drools.util.ChainedProperties;
-import org.drools.util.ClassLoaderUtil;
-import org.drools.util.CompositeClassLoader;
import org.drools.util.ConfFileUtils;
import org.drools.util.StringUtils;
+import org.drools.util.internal.ChainedProperties;
+import org.drools.util.internal.ClassLoaderUtil;
+import org.drools.util.internal.CompositeClassLoader;
import org.drools.workflow.core.Node;
import org.drools.workflow.instance.impl.NodeInstanceFactory;
import org.drools.workflow.instance.impl.NodeInstanceFactoryRegistry;
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/SessionConfiguration.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/SessionConfiguration.java 2010-01-13 23:37:36 UTC (rev 31074)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/SessionConfiguration.java 2010-01-14 03:13:02 UTC (rev 31075)
@@ -35,10 +35,10 @@
import org.drools.runtime.conf.MultiValueKnowledgeSessionOption;
import org.drools.runtime.conf.SingleValueKnowledgeSessionOption;
import org.drools.runtime.process.WorkItemHandler;
-import org.drools.util.ChainedProperties;
-import org.drools.util.ClassLoaderUtil;
import org.drools.util.ConfFileUtils;
import org.drools.util.StringUtils;
+import org.drools.util.internal.ChainedProperties;
+import org.drools.util.internal.ClassLoaderUtil;
import org.mvel2.MVEL;
/**
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/io/impl/ClassPathResource.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/io/impl/ClassPathResource.java 2010-01-13 23:37:36 UTC (rev 31074)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/io/impl/ClassPathResource.java 2010-01-14 03:13:02 UTC (rev 31075)
@@ -19,9 +19,9 @@
import org.drools.io.Resource;
import org.drools.io.internal.InternalResource;
-import org.drools.util.ClassLoaderUtil;
import org.drools.util.ClassUtils;
import org.drools.util.StringUtils;
+import org.drools.util.internal.ClassLoaderUtil;
/**
* Borrowed gratuitously from Spring under ASL2.0.
More information about the jboss-svn-commits
mailing list