geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r769289 - in /geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint: context/Instanciator.java convert/ConversionServiceImpl.java
Date Tue, 28 Apr 2009 08:29:04 GMT
Author: gnodet
Date: Tue Apr 28 08:29:04 2009
New Revision: 769289

URL: http://svn.apache.org/viewvc?rev=769289&view=rev
Log:
Fix conversion service and avoid dependency on metadata implementation

Modified:
    geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/Instanciator.java
    geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/convert/ConversionServiceImpl.java

Modified: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/Instanciator.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/Instanciator.java?rev=769289&r1=769288&r2=769289&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/Instanciator.java
(original)
+++ geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/Instanciator.java
Tue Apr 28 08:29:04 2009
@@ -18,7 +18,6 @@
  */
 package org.apache.geronimo.blueprint.context;
 
-import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Comparator;
@@ -29,12 +28,10 @@
 import java.util.Properties;
 
 import org.apache.geronimo.blueprint.ExtendedComponentDefinitionRegistry;
-import org.apache.geronimo.blueprint.reflect.MapMetadataImpl;
-import org.apache.geronimo.blueprint.reflect.ServiceMetadataImpl;
-import org.apache.geronimo.blueprint.utils.ReflectionUtils;
+import org.apache.geronimo.blueprint.mutable.MutableMapMetadata;
+import org.apache.geronimo.blueprint.reflect.MetadataUtil;
 import org.apache.xbean.recipe.ArrayRecipe;
 import org.apache.xbean.recipe.CollectionRecipe;
-import org.apache.xbean.recipe.ConstructionException;
 import org.apache.xbean.recipe.MapRecipe;
 import org.apache.xbean.recipe.ObjectRecipe;
 import org.apache.xbean.recipe.Option;
@@ -181,11 +178,12 @@
             recipe.setProperty("service", getValue(serviceExport.getServiceComponent(), null));
         }
         recipe.setProperty("metadata", serviceExport);
-        if (serviceExport instanceof ServiceMetadataImpl) {
-            ServiceMetadataImpl impl = (ServiceMetadataImpl) serviceExport;
-            if (impl.getServiceProperties() != null) {
-                recipe.setProperty("serviceProperties", getValue(new MapMetadataImpl(null,
null, impl.getServiceProperties()), null));
+        if (serviceExport.getServiceProperties() != null) {
+            MutableMapMetadata map = MetadataUtil.createMetadata(MutableMapMetadata.class);
+            for (MapEntry e : serviceExport.getServiceProperties()) {
+                map.addEntry(e);
             }
+            recipe.setProperty("serviceProperties", getValue(map, null));
         }
         if (serviceExport.getRegistrationListeners() != null) {
             CollectionRecipe listenersRecipe = new CollectionRecipe(ArrayList.class);

Modified: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/convert/ConversionServiceImpl.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/convert/ConversionServiceImpl.java?rev=769289&r1=769288&r2=769289&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/convert/ConversionServiceImpl.java
(original)
+++ geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/convert/ConversionServiceImpl.java
Tue Apr 28 08:29:04 2009
@@ -67,7 +67,7 @@
     }
     
     public Object convert(Object fromValue, Class toType) throws Exception {
-        if (Object.class == toType) {
+        if (toType.isInstance(fromValue)) {
             return fromValue;
         }
         Object value = doConvert(fromValue, toType);        



Mime
View raw message