tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dblev...@apache.org
Subject svn commit: r663668 - /openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/ConfigurationFactory.java
Date Thu, 05 Jun 2008 17:26:14 GMT
Author: dblevins
Date: Thu Jun  5 10:26:14 2008
New Revision: 663668

URL: http://svn.apache.org/viewvc?rev=663668&view=rev
Log:
OPENEJB-817: ID portion of property overriding no longer case sensitive

This now works as expected: 

properties.put("MyDB", "new://Resource?type=DataSource"); 
properties.put("myDb.JdbcDriver", "org.postgresql.Driver"); 
properties.put("mydb.JdbcUrl", "jdbc:postgresql://localhost/bla"); 
properties.put("Mydb.UserName", "bla"); 


Modified:
    openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/ConfigurationFactory.java

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/ConfigurationFactory.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/ConfigurationFactory.java?rev=663668&r1=663667&r2=663668&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/ConfigurationFactory.java
(original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/ConfigurationFactory.java
Thu Jun  5 10:26:14 2008
@@ -108,7 +108,7 @@
     public ConfigurationFactory(boolean offline) {
         this(offline, (DynamicDeployer) null);
     }
-    
+
     public ConfigurationFactory(boolean offline, DynamicDeployer preAutoConfigDeployer) {
         this.offline = offline;
         deploymentLoader = new DeploymentLoader();
@@ -146,7 +146,7 @@
             // must be after CmpJpaConversion since it adds new persistence-context-refs
             chain.add(new GeronimoMappedName());
         }
-        
+
         if (null != preAutoConfigDeployer) {
             chain.add(preAutoConfigDeployer);
         }
@@ -178,7 +178,7 @@
         this(offline, preAutoConfigDeployer);
         sys = configuration;
     }
-    
+
     public static List<HandlerChainInfo> toHandlerChainInfo(HandlerChains chains) {
         List<HandlerChainInfo> handlerChains = new ArrayList<HandlerChainInfo>();
         if (chains == null) return handlerChains;
@@ -669,23 +669,22 @@
         Properties sysProps = new Properties(System.getProperties());
         sysProps.putAll(SystemInstance.get().getProperties());
         for (Map.Entry<Object, Object> entry : sysProps.entrySet()) {
+
             String name = (String) entry.getKey();
-            Object value = entry.getValue();
-            if (value instanceof String) {
-                if (name.startsWith(fullPrefix)) {
-                    name = name.substring(fullPrefix.length());
-                    serviceProperties.setProperty(name, (String) value);
-                } else if (name.startsWith(fullPrefix2)) {
-                    name = name.substring(fullPrefix2.length());
-                    serviceProperties.setProperty(name, (String) value);
-                } else if (name.startsWith(shortPrefix)) {
-                    name = name.substring(shortPrefix.length());
-                    serviceProperties.setProperty(name, (String) value);
-                } else if (name.startsWith(shortPrefix2)) {
-                    name = name.substring(shortPrefix2.length());
-                    serviceProperties.setProperty(name, (String) value);
+
+            for (String prefix : Arrays.asList(fullPrefix, fullPrefix2, shortPrefix, shortPrefix2))
{
+                if (name.toLowerCase().startsWith(prefix.toLowerCase())){
+
+                    name = name.substring(prefix.length());
+
+                    // TODO: Maybe use xbean-reflect to get the string value
+                    String value = entry.getValue().toString();
+
+                    serviceProperties.setProperty(name, value);
+                    break;
                 }
             }
+
         }
         return serviceProperties;
     }



Mime
View raw message