geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r678534 - /geronimo/server/trunk/plugins/connector/geronimo-connector-builder/src/main/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilder.java
Date Mon, 21 Jul 2008 19:22:05 GMT
Author: gawor
Date: Mon Jul 21 12:22:05 2008
New Revision: 678534

URL: http://svn.apache.org/viewvc?rev=678534&view=rev
Log:
handle config properties starting with either lower or upper case letter (GERONIMO-4131)

Modified:
    geronimo/server/trunk/plugins/connector/geronimo-connector-builder/src/main/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilder.java

Modified: geronimo/server/trunk/plugins/connector/geronimo-connector-builder/src/main/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/connector/geronimo-connector-builder/src/main/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilder.java?rev=678534&r1=678533&r2=678534&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/connector/geronimo-connector-builder/src/main/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilder.java
(original)
+++ geronimo/server/trunk/plugins/connector/geronimo-connector-builder/src/main/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilder.java
Mon Jul 21 12:22:05 2008
@@ -670,16 +670,20 @@
         }
     }
     
-    private static String capitalize(String name) {
+    private static String switchCase(String name) {
         if (name == null || name.length() == 0) {
             return name;
         }
         if (Character.isUpperCase(name.charAt(0))) {
-            return name;
-        } else {
+            char chars[] = name.toCharArray();
+            chars[0] = Character.toLowerCase(chars[0]);
+            return new String(chars);
+        } else if (Character.isLowerCase(name.charAt(0))) {
             char chars[] = name.toCharArray();
             chars[0] = Character.toUpperCase(chars[0]);
             return new String(chars);
+        } else{ 
+            return name;
         }
     }
 
@@ -729,25 +733,34 @@
         GBeanData gbeanData = new GBeanData(gbeanInfo);
         for (ConfigPropertyType configProperty : configProperties) {
             if (configProperty.isSetConfigPropertyValue()) {
-                gbeanData.setAttribute(configProperty.getConfigPropertyName().getStringValue(),
-                        getValue(configProperty.getConfigPropertyType().getStringValue(),
-                                configProperty.getConfigPropertyValue().getStringValue(),
-                                cl));
+                String name = configProperty.getConfigPropertyName().getStringValue();
+                if (gbeanInfo.getAttribute(name) == null) {
+                    String originalName = name;
+                    name = switchCase(name);
+                    if (gbeanInfo.getAttribute(name) == null) {
+                        log.warn("Unsupported config-property: " + originalName);
+                        continue;
+                    }
+                }
+                String type = configProperty.getConfigPropertyType().getStringValue();
+                String value = configProperty.getConfigPropertyValue().getStringValue();
+                gbeanData.setAttribute(name, getValue(type, value, cl));
             }
         }
         return gbeanData;
     }
-
+    
     private void setDynamicGBeanDataAttributes(GBeanData gbeanData, GerConfigPropertySettingType[]
configProperties, ClassLoader cl) throws DeploymentException {
         List<String> unknownNames = new ArrayList<String>();
         for (GerConfigPropertySettingType configProperty : configProperties) {
             String name = configProperty.getName();
             GAttributeInfo attributeInfo = gbeanData.getGBeanInfo().getAttribute(name);
             if (attributeInfo == null) {
-                name = capitalize(name);
+                String originalName = name;
+                name = switchCase(name);
                 attributeInfo = gbeanData.getGBeanInfo().getAttribute(name);
                 if (attributeInfo == null) {
-                    unknownNames.add(name);
+                    unknownNames.add(originalName);
                     continue;
                 }
             }



Mime
View raw message