geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r777589 - in /geronimo/sandbox/blueprint/blueprint-cm/src/main/java/org/apache/geronimo/blueprint/compendium/cm: CmManagedServiceFactory.java CmNamespaceHandler.java
Date Fri, 22 May 2009 15:54:16 GMT
Author: gawor
Date: Fri May 22 15:54:15 2009
New Revision: 777589

URL: http://svn.apache.org/viewvc?rev=777589&view=rev
Log:
change factoryMetadata to register as a top level element to ensure destroy callback is called

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

Modified: geronimo/sandbox/blueprint/blueprint-cm/src/main/java/org/apache/geronimo/blueprint/compendium/cm/CmManagedServiceFactory.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-cm/src/main/java/org/apache/geronimo/blueprint/compendium/cm/CmManagedServiceFactory.java?rev=777589&r1=777588&r2=777589&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-cm/src/main/java/org/apache/geronimo/blueprint/compendium/cm/CmManagedServiceFactory.java
(original)
+++ geronimo/sandbox/blueprint/blueprint-cm/src/main/java/org/apache/geronimo/blueprint/compendium/cm/CmManagedServiceFactory.java
Fri May 22 15:54:15 2009
@@ -54,8 +54,7 @@
 public class CmManagedServiceFactory {
 
     private static final Logger LOGGER = LoggerFactory.getLogger(CmManagedServiceFactory.class);
-
-    private String id;
+    
     private BlueprintContainerImpl blueprintContainer;
     private ConfigurationAdmin configAdmin;
     private String factoryPid;
@@ -111,10 +110,6 @@
         return Collections.unmodifiableMap(services);
     }
 
-    public void setId(String id) {
-        this.id = id;
-    }
-
     public void setBlueprintContainer(BlueprintContainerImpl blueprintContainer) {
         this.blueprintContainer = blueprintContainer;
     }

Modified: geronimo/sandbox/blueprint/blueprint-cm/src/main/java/org/apache/geronimo/blueprint/compendium/cm/CmNamespaceHandler.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-cm/src/main/java/org/apache/geronimo/blueprint/compendium/cm/CmNamespaceHandler.java?rev=777589&r1=777588&r2=777589&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-cm/src/main/java/org/apache/geronimo/blueprint/compendium/cm/CmNamespaceHandler.java
(original)
+++ geronimo/sandbox/blueprint/blueprint-cm/src/main/java/org/apache/geronimo/blueprint/compendium/cm/CmNamespaceHandler.java
Fri May 22 15:54:15 2009
@@ -202,11 +202,11 @@
         String id = getName(element);
 
         MutableBeanMetadata factoryMetadata = context.createMetadata(MutableBeanMetadata.class);
+        generateIdIfNeeded(factoryMetadata);        
         factoryMetadata.setScope(BeanMetadata.SCOPE_SINGLETON);
         factoryMetadata.setRuntimeClass(CmManagedServiceFactory.class);
         factoryMetadata.setInitMethodName("init");
         factoryMetadata.setDestroyMethodName("destroy");
-        factoryMetadata.addProperty("id", createValue(context, id));
         factoryMetadata.addProperty("configAdmin", createRef(context, CONFIG_ADMIN_REFERENCE_NAME));
         factoryMetadata.addProperty("blueprintContainer", createRef(context, "blueprintContainer"));
         factoryMetadata.addProperty("factoryPid", createValue(context, element.getAttribute(FACTORY_PID_ATTRIBUTE)));
@@ -266,10 +266,12 @@
             }
         }
 
+        context.getComponentDefinitionRegistry().registerComponentDefinition(factoryMetadata);
+        
         MutableBeanMetadata mapMetadata = context.createMetadata(MutableBeanMetadata.class);
         mapMetadata.setScope(BeanMetadata.SCOPE_SINGLETON);
         mapMetadata.setId(id);
-        mapMetadata.setFactoryComponent(factoryMetadata);
+        mapMetadata.setFactoryComponent(createRef(context, factoryMetadata.getId()));
         mapMetadata.setFactoryMethodName("getServiceMap");
         return mapMetadata;
     }



Mime
View raw message