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

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Sat Jul 14 19:55:11 EDT 2007


Author: mark.proctor at jboss.com
Date: 2007-07-14 19:55:10 -0400 (Sat, 14 Jul 2007)
New Revision: 13516

Modified:
   labs/jbossrules/trunk/drools-core/src/main/java/org/drools/base/ClassTypeResolver.java
   labs/jbossrules/trunk/drools-core/src/main/java/org/drools/util/ChainedProperties.java
Log:
JBRULES-1010 pluggeable Dialect Configuration.

Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/base/ClassTypeResolver.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/base/ClassTypeResolver.java	2007-07-14 23:55:03 UTC (rev 13515)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/base/ClassTypeResolver.java	2007-07-14 23:55:10 UTC (rev 13516)
@@ -30,7 +30,7 @@
 public class ClassTypeResolver
     implements
     TypeResolver {
-    private List             imports;
+    private List             imports          = Collections.EMPTY_LIST;
 
     private ClassLoader      classLoader;
 
@@ -63,14 +63,14 @@
         if ( classLoader == null ) {
             throw new RuntimeDroolsException( "ClassTypeResolver cannot have a null parent ClassLoader" );
         }
-        
+
         this.classLoader = classLoader;
     }
 
     public void setClassLoader(ClassLoader classLoader) {
         this.classLoader = classLoader;
     }
-    
+
     /*
      * (non-Javadoc)
      * 

Modified: 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	2007-07-14 23:55:03 UTC (rev 13515)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/util/ChainedProperties.java	2007-07-14 23:55:10 UTC (rev 13516)
@@ -130,29 +130,38 @@
     }
 
     public void mapStartsWith(Map map,
-                              String startsWith) {
+                              String startsWith,
+                              boolean includeSubProperties) {
         for ( Iterator it = this.props.iterator(); it.hasNext(); ) {
             Properties props = (Properties) it.next();
             mapStartsWith( map,
                            props,
-                           startsWith );
+                           startsWith,
+                           includeSubProperties );
         }
         
         for ( Iterator it = this.defaultProps.iterator(); it.hasNext(); ) {
             Properties props = (Properties) it.next();
             mapStartsWith( map,
                            props,
-                           startsWith );
+                           startsWith,
+                           includeSubProperties );
         }        
     }
 
     private void mapStartsWith(Map map,
                                Properties properties,
-                               String startsWith) {
+                               String startsWith,
+                               boolean includeSubProperties) {
         Enumeration enumeration = properties.propertyNames();
         while ( enumeration.hasMoreElements() ) {
             String key = (String) enumeration.nextElement();
-            if ( key.startsWith( startsWith ) ) {
+            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 ) );




More information about the jboss-svn-commits mailing list