geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r776076 - /geronimo/sandbox/blueprint/blueprint-cm/src/main/java/org/apache/geronimo/blueprint/compendium/cm/CmPropertyPlaceholder.java
Date Mon, 18 May 2009 20:17:11 GMT
Author: gnodet
Date: Mon May 18 20:17:10 2009
New Revision: 776076

URL: http://svn.apache.org/viewvc?rev=776076&view=rev
Log:
Allow non string properties through the ConfigAdmin

Modified:
    geronimo/sandbox/blueprint/blueprint-cm/src/main/java/org/apache/geronimo/blueprint/compendium/cm/CmPropertyPlaceholder.java

Modified: geronimo/sandbox/blueprint/blueprint-cm/src/main/java/org/apache/geronimo/blueprint/compendium/cm/CmPropertyPlaceholder.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-cm/src/main/java/org/apache/geronimo/blueprint/compendium/cm/CmPropertyPlaceholder.java?rev=776076&r1=776075&r2=776076&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-cm/src/main/java/org/apache/geronimo/blueprint/compendium/cm/CmPropertyPlaceholder.java
(original)
+++ geronimo/sandbox/blueprint/blueprint-cm/src/main/java/org/apache/geronimo/blueprint/compendium/cm/CmPropertyPlaceholder.java
Mon May 18 20:17:10 2009
@@ -46,6 +46,8 @@
 import org.apache.geronimo.blueprint.ComponentDefinitionRegistryProcessor;
 import org.apache.geronimo.blueprint.beans.AbstractPropertyPlaceholder;
 import org.apache.geronimo.blueprint.mutable.MutableValueMetadata;
+import org.slf4j.LoggerFactory;
+import org.slf4j.Logger;
 
 /**
  * TODO: javadoc
@@ -55,6 +57,8 @@
  */
 public class CmPropertyPlaceholder extends AbstractPropertyPlaceholder {
 
+    private static final Logger LOGGER = LoggerFactory.getLogger(CmPropertyPlaceholder.class);
+
     private BlueprintContext blueprintContext;
     private ConfigurationAdmin configAdmin; 
     private String persistentId;
@@ -98,6 +102,7 @@
     }
 
     protected String getProperty(String val) {
+        LOGGER.debug("Retrieving property value {} from configuration with pid {}", val,
persistentId);
         Object v = null;
         try {
             Configuration config = configAdmin.getConfiguration(persistentId);
@@ -105,16 +110,27 @@
                 Dictionary props = config.getProperties();
                 if (props != null) {
                     v = props.get(val);
+                    if (v != null) {
+                        LOGGER.debug("Found property value {}", v);
+                    } else {
+                        LOGGER.debug("Property not found in configuration");
+                    }
+                } else {
+                    LOGGER.debug("No dictionary available from configuration");
                 }
+            } else {
+                LOGGER.debug("No configuration available");
             }
         } catch (Throwable t) {
-            t.printStackTrace();
-            // TODO: log ?
+            LOGGER.info("Unable to retrieve property value " + val + " from configuration
with pid " + persistentId, t);
         }
         if (v == null && defaultProperties != null && defaultProperties.containsKey(val))
{
             v = defaultProperties.get(val);
+            if (v != null) {
+                LOGGER.debug("Retrieved value from defaults {}", v);
+            }
         }
-        return v instanceof String ? (String) v : null;
+        return v != null ? v.toString() : null;
     }
 
     public class LateBindingValueMetadata implements MutableValueMetadata {



Mime
View raw message