geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r779313 - in /geronimo/sandbox/blueprint: blueprint-cm/src/main/java/org/apache/geronimo/blueprint/compendium/cm/ blueprint-core/src/main/java/org/apache/geronimo/blueprint/ blueprint-core/src/main/java/org/apache/geronimo/blueprint/contain...
Date Wed, 27 May 2009 21:21:04 GMT
Author: gawor
Date: Wed May 27 21:21:01 2009
New Revision: 779313

URL: http://svn.apache.org/viewvc?rev=779313&view=rev
Log:
initial support for cm-properties

Added:
    geronimo/sandbox/blueprint/blueprint-cm/src/main/java/org/apache/geronimo/blueprint/compendium/cm/CmProperties.java   (with props)
    geronimo/sandbox/blueprint/blueprint-cm/src/main/java/org/apache/geronimo/blueprint/compendium/cm/ManagedObject.java   (with props)
    geronimo/sandbox/blueprint/blueprint-cm/src/main/java/org/apache/geronimo/blueprint/compendium/cm/ManagedObjectManager.java   (contents, props changed)
      - copied, changed from r778724, geronimo/sandbox/blueprint/blueprint-cm/src/main/java/org/apache/geronimo/blueprint/compendium/cm/ManagedServiceManager.java
    geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/Processor.java   (with props)
    geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/ServiceProcessor.java   (with props)
    geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/utils/JavaUtils.java   (with props)
Removed:
    geronimo/sandbox/blueprint/blueprint-cm/src/main/java/org/apache/geronimo/blueprint/compendium/cm/ManagedServiceManager.java
Modified:
    geronimo/sandbox/blueprint/blueprint-cm/src/main/java/org/apache/geronimo/blueprint/compendium/cm/CmManagedProperties.java
    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
    geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/BeanProcessor.java
    geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/ExtendedBlueprintContainer.java
    geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/BeanRecipe.java
    geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/BlueprintContainerImpl.java
    geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/Parser.java
    geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/ParserContextImpl.java
    geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/ServiceRecipe.java

Modified: geronimo/sandbox/blueprint/blueprint-cm/src/main/java/org/apache/geronimo/blueprint/compendium/cm/CmManagedProperties.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-cm/src/main/java/org/apache/geronimo/blueprint/compendium/cm/CmManagedProperties.java?rev=779313&r1=779312&r2=779313&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-cm/src/main/java/org/apache/geronimo/blueprint/compendium/cm/CmManagedProperties.java (original)
+++ geronimo/sandbox/blueprint/blueprint-cm/src/main/java/org/apache/geronimo/blueprint/compendium/cm/CmManagedProperties.java Wed May 27 21:21:01 2009
@@ -48,7 +48,7 @@
  * @author <a href="mailto:dev@geronimo.apache.org">Apache Geronimo Project</a>
  * @version $Rev: 766508 $, $Date: 2009-04-19 22:09:27 +0200 (Sun, 19 Apr 2009) $
  */
-public class CmManagedProperties implements BeanProcessor {
+public class CmManagedProperties implements ManagedObject, BeanProcessor {
 
     private static final Logger LOGGER = LoggerFactory.getLogger(CmManagedProperties.class);
 
@@ -79,6 +79,10 @@
         this.configAdmin = configAdmin;
     }
 
+    public Bundle getBundle() {
+        return blueprintContainer.getBundleContext().getBundle();
+    }
+    
     public String getPersistentId() {
         return persistentId;
     }
@@ -110,7 +114,7 @@
     public void setBeanName(String beanName) {
         this.beanName = beanName;
     }
-
+    
     public void init() {
         LOGGER.debug("Initializing CmManagedProperties for bean={} / pid={}", beanName, persistentId);
         Properties props = new Properties();
@@ -119,7 +123,7 @@
         props.put(Constants.BUNDLE_SYMBOLICNAME, bundle.getSymbolicName());
         props.put(Constants.BUNDLE_VERSION, bundle.getHeaders().get(Constants.BUNDLE_VERSION));
         synchronized (lock) {
-            ManagedServiceManager.register(this, props);
+            ManagedObjectManager.register(this, props);
             try {
                 properties = configAdmin.getConfiguration(persistentId).getProperties();
             } catch (Exception e) {
@@ -129,10 +133,10 @@
     }
 
     public void destroy() {
-        ManagedServiceManager.unregister(this);
+        ManagedObjectManager.unregister(this);
     }
 
-    public void updated(Dictionary<String,Object> props) {
+    public void updated(Dictionary props) {
         LOGGER.debug("Configuration updated for bean={} / pid={}", beanName, persistentId);
         synchronized (lock) {
             this.properties = props;

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=779313&r1=779312&r2=779313&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 Wed May 27 21:21:01 2009
@@ -31,9 +31,12 @@
 
 import org.apache.geronimo.blueprint.BeanProcessor;
 import org.apache.geronimo.blueprint.ExtendedBlueprintContainer;
+import org.apache.geronimo.blueprint.ServiceProcessor;
+import org.apache.geronimo.blueprint.utils.JavaUtils;
 import org.apache.geronimo.blueprint.utils.ReflectionUtils;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.Constants;
+import org.osgi.framework.ServiceReference;
 import org.osgi.framework.ServiceRegistration;
 import org.osgi.service.blueprint.reflect.ServiceMetadata;
 import org.osgi.service.cm.Configuration;
@@ -60,6 +63,7 @@
     
     private ExtendedBlueprintContainer blueprintContainer;
     private ConfigurationAdmin configAdmin;
+    private String id;
     private String factoryPid;
     private List<String> interfaces;
     private int autoExport;
@@ -122,6 +126,10 @@
         this.configAdmin = configAdmin;
     }
 
+    public void setId(String id) {
+        this.id = id;
+    }
+    
     public void setFactoryPid(String factoryPid) {
         this.factoryPid = factoryPid;
     }
@@ -157,45 +165,79 @@
             updateComponentProperties(props);
 
             Object component = blueprintContainer.getComponentInstance(managedComponentName);
-            //  TODO: init instance, call listeners, etc...
-        
-            Hashtable regProps = new Hashtable();
-            if (serviceProperties != null) {
-                regProps.putAll(serviceProperties);
+            
+            //  TODO: call listeners, etc...
+                    
+            Hashtable regProps = getRegistrationProperties(pid);            
+            CmProperties cm = findServiceProcessor();
+            if (cm != null) {
+                if ("".equals(cm.getPersistentId())) {
+                    JavaUtils.copy(regProps, props);
+                }
+                cm.updateProperties(new PropertiesUpdater(pid), regProps);
             }
-            regProps.put(Constants.SERVICE_PID, pid);
-            regProps.put(Constants.SERVICE_RANKING, ranking);
+            
             Set<String> classes = getClasses(component);
             String[] classArray = classes.toArray(new String[classes.size()]);
             reg = blueprintContainer.getBundleContext().registerService(classArray, component, regProps);
+
             LOGGER.debug("Service {} registered with interfaces {} and properties {}", new Object [] { component, classes, regProps });
             
             services.put(reg, component);
             pids.put(pid, reg);
         } else {
             updateComponentProperties(props);
+            
+            CmProperties cm = findServiceProcessor();
+            if (cm != null && "".equals(cm.getPersistentId())) {
+                Dictionary regProps = getRegistrationProperties(pid);    
+                JavaUtils.copy(regProps, props);
+                cm.updated(regProps);
+            }
         }
     }
 
+    private Hashtable getRegistrationProperties(String pid) {
+        Hashtable regProps = new Hashtable();
+        if (serviceProperties != null) {
+            regProps.putAll(serviceProperties);
+        }
+        regProps.put(Constants.SERVICE_PID, pid);
+        regProps.put(Constants.SERVICE_RANKING, ranking);
+        return regProps;
+    }
+    
     private void updateComponentProperties(Dictionary props) {
-        CmManagedProperties cm = findManagedProperties();
+        CmManagedProperties cm = findBeanProcessor();
         if (cm != null) {
             cm.updated(props);
         }
     }
     
-    private CmManagedProperties findManagedProperties() {
-        for (BeanProcessor beanProcessor : blueprintContainer.getBeanProcessors()) {
+    private CmManagedProperties findBeanProcessor() {
+        for (BeanProcessor beanProcessor : blueprintContainer.getProcessors(BeanProcessor.class)) {
             if (beanProcessor instanceof CmManagedProperties) {
                 CmManagedProperties cm = (CmManagedProperties) beanProcessor;
-                if (managedComponentName.equals(cm.getBeanName())) {
+                if (managedComponentName.equals(cm.getBeanName()) && "".equals(cm.getPersistentId())) {
                     return cm;
                 }
             }
         }
         return null;
     }
-    
+        
+    private CmProperties findServiceProcessor() {
+        for (ServiceProcessor processor : blueprintContainer.getProcessors(ServiceProcessor.class)) {
+            if (processor instanceof CmProperties) {
+                CmProperties cm = (CmProperties) processor;
+                if (id.equals(cm.getServiceId())) {
+                    return cm;
+                }
+            }
+        }
+        return null;
+    }
+        
     private void destroyComponent(Object instance, int reason) {
         Method method = findDestroyMethod(instance.getClass());
         if (method != null) {
@@ -265,4 +307,29 @@
         }
     }
 
+    private class PropertiesUpdater implements ServiceProcessor.ServicePropertiesUpdater {
+
+        private String pid;
+        
+        public PropertiesUpdater(String pid) {
+            this.pid = pid;
+        }
+        
+        public String getId() {
+            return id;
+        }
+
+        public void updateProperties(Dictionary properties) {
+            ServiceRegistration reg = pids.get(pid);
+            if (reg != null) {
+                ServiceReference ref = reg.getReference();
+                if (ref != null) {
+                    Hashtable table = JavaUtils.getProperties(ref);
+                    JavaUtils.copy(table, properties);
+                    reg.setProperties(table);
+                }
+            }
+        }
+    }
+    
 }

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=779313&r1=779312&r2=779313&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 Wed May 27 21:21:01 2009
@@ -34,7 +34,9 @@
 import org.apache.geronimo.blueprint.ExtendedComponentDefinitionRegistry;
 import org.apache.geronimo.blueprint.ExtendedParserContext;
 import org.apache.geronimo.blueprint.container.Parser;
+import org.apache.geronimo.blueprint.container.ParserContextImpl;
 import org.apache.geronimo.blueprint.mutable.MutableBeanMetadata;
+import org.apache.geronimo.blueprint.mutable.MutableComponentMetadata;
 import org.apache.geronimo.blueprint.mutable.MutableMapMetadata;
 import org.apache.geronimo.blueprint.mutable.MutableValueMetadata;
 import org.apache.geronimo.blueprint.mutable.MutableRefMetadata;
@@ -47,6 +49,7 @@
 import org.osgi.service.blueprint.namespace.ParserContext;
 import org.osgi.service.blueprint.reflect.BeanProperty;
 import org.osgi.service.blueprint.reflect.ComponentMetadata;
+import org.osgi.service.blueprint.reflect.MapMetadata;
 import org.osgi.service.blueprint.reflect.Metadata;
 import org.osgi.service.blueprint.reflect.ReferenceMetadata;
 import org.osgi.service.blueprint.reflect.ValueMetadata;
@@ -91,6 +94,7 @@
     public static final String AUTO_EXPORT_ATTRIBUTE = "auto-export";
     public static final String RANKING_ATTRIBUTE = "ranking";
     public static final String INTERFACE_ATTRIBUTE = "interface";
+    public static final String UPDATE_ATTRIBUTE = "update";
 
     public static final String CONFIG_ADMIN_REFERENCE_NAME = "blueprint.configadmin";
 
@@ -104,7 +108,7 @@
     private static final Logger LOGGER = LoggerFactory.getLogger(CmNamespaceHandler.class);
 
     private int idCounter;
-
+    
     public URL getSchemaLocation(String namespace) {
         return getClass().getResource("blueprint-cm.xsd");
     }
@@ -205,6 +209,7 @@
 
         MutableBeanMetadata factoryMetadata = context.createMetadata(MutableBeanMetadata.class);
         generateIdIfNeeded(context, factoryMetadata);
+        factoryMetadata.addProperty("id", createValue(context, factoryMetadata.getId()));
         factoryMetadata.setScope(BeanMetadata.SCOPE_SINGLETON);
         factoryMetadata.setRuntimeClass(CmManagedServiceFactory.class);
         factoryMetadata.setInitMethodName("init");
@@ -234,6 +239,8 @@
             factoryMetadata.addProperty("interfaces", createList(context, interfaces));
         }
 
+        Parser parser = getParser(context);
+        
         // Parse elements
         NodeList nl = element.getChildNodes();
         for (int i = 0; i < nl.getLength(); i++) {
@@ -241,14 +248,14 @@
             if (node instanceof Element) {
                 Element e = (Element) node;
                 if (isBlueprintNamespace(e.getNamespaceURI())) {
-                    if (nodeNameEquals(e, INTERFACES_ELEMENT)) {
+                    if (nodeNameEquals(e, Parser.INTERFACES_ELEMENT)) {
                         if (interfaces != null) {
-                            throw new ComponentDefinitionException("Only one of " + INTERFACE_ATTRIBUTE + " attribute or " + INTERFACES_ELEMENT + " element must be used");
+                            throw new ComponentDefinitionException("Only one of " + Parser.INTERFACE_ATTRIBUTE + " attribute or " + INTERFACES_ELEMENT + " element must be used");
                         }
-                        interfaces = parseInterfaceNames(e);
+                        interfaces = parser.parseInterfaceNames(e);
                         factoryMetadata.addProperty("interfaces", createList(context, interfaces));                    
-                    } else if (nodeNameEquals(e, Parser.SERVICE_PROPERTIES_ELEMENT)) {                    
-                        MutableMapMetadata map = context.parseElement(MutableMapMetadata.class, null, e);
+                    } else if (nodeNameEquals(e, Parser.SERVICE_PROPERTIES_ELEMENT)) { 
+                        MapMetadata map = parser.parseServiceProperties(e, factoryMetadata);
                         factoryMetadata.addProperty("serviceProperties", map);
                     } else {
                         // TODO: parse listeners
@@ -283,11 +290,28 @@
     }
 
     private ComponentMetadata decorateCmProperties(ExtendedParserContext context, Element element, ComponentMetadata component) {
-        if (!(component instanceof ServiceMetadata)) {
-            throw new ComponentDefinitionException("Element " + CM_PROPERTIES_ELEMENT + " must be used inside a <bp:service> element");
+        generateIdIfNeeded(context, ((MutableComponentMetadata) component));
+        MutableBeanMetadata metadata = context.createMetadata(MutableBeanMetadata.class);
+        metadata.setProcessor(true);
+        metadata.setId(getId(context, element));
+        metadata.setRuntimeClass(CmProperties.class);
+        String persistentId = element.getAttribute(PERSISTENT_ID_ATTRIBUTE);
+        // if persistentId is "" the cm-properties element in nested in managed-service-factory
+        // and the configuration object will come from the factory. So we only really need to register
+        // ManagedService if the persistentId is not an empty string.
+        if (persistentId.length() > 0) {
+            metadata.setInitMethodName("init");
+            metadata.setDestroyMethodName("destroy");
         }
-        // TODO: implement cm-properties
-        throw new UnsupportedOperationException("Not implemented yet");
+        metadata.addProperty("blueprintContainer", createRef(context, "blueprintContainer"));
+        metadata.addProperty("configAdmin", createRef(context, CONFIG_ADMIN_REFERENCE_NAME));
+        metadata.addProperty("persistentId", createValue(context, persistentId));
+        if (element.hasAttribute(UPDATE_ATTRIBUTE)) {
+            metadata.addProperty("update", createValue(context, element.getAttribute(UPDATE_ATTRIBUTE)));
+        }
+        metadata.addProperty("serviceId", createIdRef(context, component.getId()));
+        context.getComponentDefinitionRegistry().registerComponentDefinition(metadata);
+        return component;
     }
 
     private ComponentMetadata decorateManagedProperties(ExtendedParserContext context, Element element, ComponentMetadata component) {
@@ -371,39 +395,6 @@
         return m;
     }
 
-    private List<String> parseInterfaceNames(Element element) {
-        List<String> interfaceNames = new ArrayList<String>();
-        NodeList nl = element.getChildNodes();
-        for (int i = 0; i < nl.getLength(); i++) {
-            Node node = nl.item(i);
-            if (node instanceof Element) {
-                Element e = (Element) node;
-                if (nodeNameEquals(e, VALUE_ELEMENT)) {
-                    String v = getTextValue(e).trim();
-                    if (interfaceNames.contains(v)) {
-                        throw new ComponentDefinitionException("The element " + INTERFACES_ELEMENT + " should not contain the same interface twice");
-                    }
-                    interfaceNames.add(getTextValue(e));
-                } else {
-                    throw new ComponentDefinitionException("Unsupported element " + e.getNodeName() + " inside an " + INTERFACES_ELEMENT + " element");
-                }
-            }
-        }
-        return interfaceNames;
-    }
-
-    private static String getTextValue(Element element) {
-        StringBuffer value = new StringBuffer();
-        NodeList nl = element.getChildNodes();
-        for (int i = 0; i < nl.getLength(); i++) {
-            Node item = nl.item(i);
-            if ((item instanceof CharacterData && !(item instanceof Comment)) || item instanceof EntityReference) {
-                value.append(item.getNodeValue());
-            }
-        }
-        return value.toString();
-    }
-
     private static boolean nodeNameEquals(Node node, String name) {
         return (name.equals(node.getNodeName()) || name.equals(node.getLocalName()));
     }
@@ -420,7 +411,7 @@
         }
     }
 
-    public void generateIdIfNeeded(ExtendedParserContext context, MutableBeanMetadata metadata) {
+    public void generateIdIfNeeded(ExtendedParserContext context, MutableComponentMetadata metadata) {
         if (metadata.getId() == null) {
             metadata.setId(generateId(context));
         }
@@ -433,5 +424,12 @@
         } while (context.getComponentDefinitionRegistry().containsComponentDefinition(id));
         return id;
     }
+    
+    private Parser getParser(ParserContext ctx) {
+        if (ctx instanceof ParserContextImpl) {
+            return ((ParserContextImpl) ctx).getParser();
+        }
+        throw new RuntimeException("Unable to get parser");
+    }
 
 }

Added: geronimo/sandbox/blueprint/blueprint-cm/src/main/java/org/apache/geronimo/blueprint/compendium/cm/CmProperties.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-cm/src/main/java/org/apache/geronimo/blueprint/compendium/cm/CmProperties.java?rev=779313&view=auto
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-cm/src/main/java/org/apache/geronimo/blueprint/compendium/cm/CmProperties.java (added)
+++ geronimo/sandbox/blueprint/blueprint-cm/src/main/java/org/apache/geronimo/blueprint/compendium/cm/CmProperties.java Wed May 27 21:21:01 2009
@@ -0,0 +1,149 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.geronimo.blueprint.compendium.cm;
+
+import java.util.Dictionary;
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.Properties;
+import java.util.Set;
+
+import org.apache.geronimo.blueprint.ExtendedBlueprintContainer;
+import org.apache.geronimo.blueprint.ServiceProcessor;
+import org.apache.geronimo.blueprint.utils.JavaUtils;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.Constants;
+import org.osgi.framework.ServiceRegistration;
+import org.osgi.service.cm.ConfigurationAdmin;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * @author <a href="mailto:dev@geronimo.apache.org">Apache Geronimo Project</a>
+ * @version $Rev$, $Date$
+ */
+public class CmProperties implements ManagedObject, ServiceProcessor {
+
+    private static final Logger LOGGER = LoggerFactory.getLogger(CmProperties.class);
+
+    private ExtendedBlueprintContainer blueprintContainer;
+    private ConfigurationAdmin configAdmin;
+    private String persistentId;
+    private boolean update;
+    private String serviceId;
+
+    private final Object lock = new Object();
+    private final Set<ServicePropertiesUpdater> services = new HashSet<ServicePropertiesUpdater>();
+    private Dictionary<String,Object> properties;
+
+    public ExtendedBlueprintContainer getBlueprintContainer() {
+        return blueprintContainer;
+    }
+
+    public void setBlueprintContainer(ExtendedBlueprintContainer blueprintContainer) {
+        this.blueprintContainer = blueprintContainer;
+    }
+
+    public ConfigurationAdmin getConfigAdmin() {
+        return configAdmin;
+    }
+
+    public void setConfigAdmin(ConfigurationAdmin configAdmin) {
+        this.configAdmin = configAdmin;
+    }
+
+    public Bundle getBundle() {
+        return blueprintContainer.getBundleContext().getBundle();
+    }
+    
+    public String getPersistentId() {
+        return persistentId;
+    }
+
+    public void setPersistentId(String persistentId) {
+        this.persistentId = persistentId;
+    }
+
+    public boolean getUpdate() {
+        return update;
+    }
+
+    public void setUpdate(boolean update) {
+        this.update = update;
+    }
+
+    public String getServiceId() {
+        return serviceId;
+    }
+
+    public void setServiceId(String serviceId) {
+        this.serviceId = serviceId;
+    }
+    
+    public void init() {
+        LOGGER.debug("Initializing CmProperties for service={} / pid={}", serviceId, persistentId);
+        Properties props = new Properties();
+        props.put(Constants.SERVICE_PID, persistentId);
+        Bundle bundle = blueprintContainer.getBundleContext().getBundle();
+        props.put(Constants.BUNDLE_SYMBOLICNAME, bundle.getSymbolicName());
+        props.put(Constants.BUNDLE_VERSION, bundle.getHeaders().get(Constants.BUNDLE_VERSION));
+        synchronized (lock) {
+            ManagedObjectManager.register(this, props);
+            try {
+                properties = configAdmin.getConfiguration(persistentId).getProperties();
+            } catch (Exception e) {
+                LOGGER.debug("Unable to retrieve initial configuration for service={} / pid={}", new Object [] { serviceId,  persistentId}, e);
+            }
+        }
+    }
+
+    public void destroy() {
+        ManagedObjectManager.unregister(this);
+    }
+
+    public void updated(Dictionary props) {
+        LOGGER.debug("Service properties updated for service={} / pid={}, {}", new Object[] {serviceId, persistentId, props});
+        
+        synchronized (lock) {
+            this.properties = props;
+            if (update) {
+                for (ServicePropertiesUpdater service : services) {
+                    service.updateProperties(props);
+                }
+            }
+        }
+    }
+
+    public void updateProperties(ServicePropertiesUpdater service, Dictionary props) {
+        if (!this.serviceId.equals(service.getId())) {
+            return;
+        }
+                
+        LOGGER.debug("Service properties initialized for service={} / pid={}, {}", new Object[] {serviceId, persistentId, props});
+        
+        services.add(service);
+        
+        synchronized (lock) {
+            if (properties != null) {
+                JavaUtils.copy(props, properties);
+            }
+        }
+    }
+
+}

Propchange: geronimo/sandbox/blueprint/blueprint-cm/src/main/java/org/apache/geronimo/blueprint/compendium/cm/CmProperties.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/blueprint/blueprint-cm/src/main/java/org/apache/geronimo/blueprint/compendium/cm/CmProperties.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/sandbox/blueprint/blueprint-cm/src/main/java/org/apache/geronimo/blueprint/compendium/cm/CmProperties.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/sandbox/blueprint/blueprint-cm/src/main/java/org/apache/geronimo/blueprint/compendium/cm/ManagedObject.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-cm/src/main/java/org/apache/geronimo/blueprint/compendium/cm/ManagedObject.java?rev=779313&view=auto
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-cm/src/main/java/org/apache/geronimo/blueprint/compendium/cm/ManagedObject.java (added)
+++ geronimo/sandbox/blueprint/blueprint-cm/src/main/java/org/apache/geronimo/blueprint/compendium/cm/ManagedObject.java Wed May 27 21:21:01 2009
@@ -0,0 +1,32 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.geronimo.blueprint.compendium.cm;
+
+import java.util.Dictionary;
+
+import org.osgi.framework.Bundle;
+
+public interface ManagedObject {
+
+    Bundle getBundle();
+    String getPersistentId();
+    
+    void updated(Dictionary props);
+          
+}

Propchange: geronimo/sandbox/blueprint/blueprint-cm/src/main/java/org/apache/geronimo/blueprint/compendium/cm/ManagedObject.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/blueprint/blueprint-cm/src/main/java/org/apache/geronimo/blueprint/compendium/cm/ManagedObject.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/sandbox/blueprint/blueprint-cm/src/main/java/org/apache/geronimo/blueprint/compendium/cm/ManagedObject.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Copied: geronimo/sandbox/blueprint/blueprint-cm/src/main/java/org/apache/geronimo/blueprint/compendium/cm/ManagedObjectManager.java (from r778724, geronimo/sandbox/blueprint/blueprint-cm/src/main/java/org/apache/geronimo/blueprint/compendium/cm/ManagedServiceManager.java)
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-cm/src/main/java/org/apache/geronimo/blueprint/compendium/cm/ManagedObjectManager.java?p2=geronimo/sandbox/blueprint/blueprint-cm/src/main/java/org/apache/geronimo/blueprint/compendium/cm/ManagedObjectManager.java&p1=geronimo/sandbox/blueprint/blueprint-cm/src/main/java/org/apache/geronimo/blueprint/compendium/cm/ManagedServiceManager.java&r1=778724&r2=779313&rev=779313&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-cm/src/main/java/org/apache/geronimo/blueprint/compendium/cm/ManagedServiceManager.java (original)
+++ geronimo/sandbox/blueprint/blueprint-cm/src/main/java/org/apache/geronimo/blueprint/compendium/cm/ManagedObjectManager.java Wed May 27 21:21:01 2009
@@ -35,25 +35,25 @@
  * Since persistence id can only be associated with one ManagedService in a bundle
  * this class ensures only one ManagedService is registered per persistence id.
  */
-public class ManagedServiceManager {
+public class ManagedObjectManager {
 
-    private static final Logger LOGGER = LoggerFactory.getLogger(ManagedServiceManager.class);
+    private static final Logger LOGGER = LoggerFactory.getLogger(ManagedObjectManager.class);
 
     private static HashMap<Key, ConfigurationWatcher> map = new HashMap<Key, ConfigurationWatcher>();
                
-    public static synchronized void register(CmManagedProperties cm, Properties props) {
+    public static synchronized void register(ManagedObject cm, Properties props) {
         Key key = new Key(cm);
         ConfigurationWatcher reg = map.get(key);
         if (reg == null) {
             reg = new ConfigurationWatcher(); 
-            ServiceRegistration registration = cm.getBlueprintContainer().getBundleContext().registerService(ManagedService.class.getName(), reg, props);
+            ServiceRegistration registration = cm.getBundle().getBundleContext().registerService(ManagedService.class.getName(), reg, props);
             reg.setRegistration(registration);            
             map.put(key, reg);
         }
         reg.add(cm);
     }
 
-    public static synchronized void unregister(CmManagedProperties cm) {
+    public static synchronized void unregister(ManagedObject cm) {
         Key key = new Key(cm);
         ConfigurationWatcher reg = map.get(key);
         if (reg != null) {
@@ -68,13 +68,13 @@
     private static class ConfigurationWatcher implements ManagedService {
 
         private ServiceRegistration registration;
-        private List<CmManagedProperties> list = new ArrayList<CmManagedProperties>();
+        private List<ManagedObject> list = new ArrayList<ManagedObject>();
         
         public ConfigurationWatcher() {
         }
         
         public void updated(Dictionary props) throws ConfigurationException {
-            for (CmManagedProperties cm : list) {
+            for (ManagedObject cm : list) {
                 cm.updated(props);
             }
         }
@@ -87,11 +87,11 @@
             return registration;
         }
         
-        private void add(CmManagedProperties cm) {
+        private void add(ManagedObject cm) {
             list.add(cm);
         }
         
-        private void remove(CmManagedProperties cm) {
+        private void remove(ManagedObject cm) {
             list.remove(cm);
         }
         
@@ -105,9 +105,9 @@
         private String persistanceId;
         private Bundle bundle;
         
-        public Key(CmManagedProperties cm) {
+        public Key(ManagedObject cm) {
             this.persistanceId = cm.getPersistentId();
-            this.bundle = cm.getBlueprintContainer().getBundleContext().getBundle();
+            this.bundle = cm.getBundle();
         }
 
         public int hashCode() {

Propchange: geronimo/sandbox/blueprint/blueprint-cm/src/main/java/org/apache/geronimo/blueprint/compendium/cm/ManagedObjectManager.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/blueprint/blueprint-cm/src/main/java/org/apache/geronimo/blueprint/compendium/cm/ManagedObjectManager.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/sandbox/blueprint/blueprint-cm/src/main/java/org/apache/geronimo/blueprint/compendium/cm/ManagedObjectManager.java
------------------------------------------------------------------------------
    svn:mergeinfo = 

Propchange: geronimo/sandbox/blueprint/blueprint-cm/src/main/java/org/apache/geronimo/blueprint/compendium/cm/ManagedObjectManager.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/BeanProcessor.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/BeanProcessor.java?rev=779313&r1=779312&r2=779313&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/BeanProcessor.java (original)
+++ geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/BeanProcessor.java Wed May 27 21:21:01 2009
@@ -33,7 +33,7 @@
  * @author <a href="mailto:dev@geronimo.apache.org">Apache Geronimo Project</a>
  * @version $Rev: 766508 $, $Date: 2009-04-19 22:09:27 +0200 (Sun, 19 Apr 2009) $
  */
-public interface BeanProcessor {
+public interface BeanProcessor extends Processor {
 
     Object beforeInit(Object bean, String beanName);
 

Modified: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/ExtendedBlueprintContainer.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/ExtendedBlueprintContainer.java?rev=779313&r1=779312&r2=779313&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/ExtendedBlueprintContainer.java (original)
+++ geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/ExtendedBlueprintContainer.java Wed May 27 21:21:01 2009
@@ -42,7 +42,7 @@
 
     ExtendedComponentDefinitionRegistry getComponentDefinitionRegistry();
 
-    List<BeanProcessor> getBeanProcessors();
+    <T extends Processor> List<T> getProcessors(Class<T> type);
 
     Repository getRepository();
 }

Added: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/Processor.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/Processor.java?rev=779313&view=auto
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/Processor.java (added)
+++ geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/Processor.java Wed May 27 21:21:01 2009
@@ -0,0 +1,25 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.geronimo.blueprint;
+
+/**
+ */
+public interface Processor {
+
+}

Propchange: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/Processor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/Processor.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/Processor.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/ServiceProcessor.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/ServiceProcessor.java?rev=779313&view=auto
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/ServiceProcessor.java (added)
+++ geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/ServiceProcessor.java Wed May 27 21:21:01 2009
@@ -0,0 +1,36 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.geronimo.blueprint;
+
+import java.util.Dictionary;
+
+/**
+ */
+public interface ServiceProcessor extends Processor {
+
+    void updateProperties(ServicePropertiesUpdater service, Dictionary properties);
+
+    interface ServicePropertiesUpdater {
+        
+        String getId();
+        
+        void updateProperties(Dictionary properties);
+        
+    }
+}

Propchange: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/ServiceProcessor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/ServiceProcessor.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/ServiceProcessor.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/BeanRecipe.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/BeanRecipe.java?rev=779313&r1=779312&r2=779313&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/BeanRecipe.java (original)
+++ geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/BeanRecipe.java Wed May 27 21:21:01 2009
@@ -490,7 +490,7 @@
         // inject properties
         setProperties(obj);
 
-        for (BeanProcessor processor : blueprintContainer.getBeanProcessors()) {
+        for (BeanProcessor processor : blueprintContainer.getProcessors(BeanProcessor.class)) {
             obj = processor.beforeInit(obj, getName());
         }
         
@@ -508,7 +508,7 @@
     }
     
     public void destroyInstance(Object obj) {
-        for (BeanProcessor processor : blueprintContainer.getBeanProcessors()) {
+        for (BeanProcessor processor : blueprintContainer.getProcessors(BeanProcessor.class)) {
             processor.beforeDestroy(obj, getName());
         }
         try {
@@ -519,7 +519,7 @@
         } catch (Exception e) {
             LOGGER.info("Error invoking destroy method", getRealCause(e));
         }
-        for (BeanProcessor processor : blueprintContainer.getBeanProcessors()) {
+        for (BeanProcessor processor : blueprintContainer.getProcessors(BeanProcessor.class)) {
             processor.afterDestroy(obj, getName());
         }
     }

Modified: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/BlueprintContainerImpl.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/BlueprintContainerImpl.java?rev=779313&r1=779312&r2=779313&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/BlueprintContainerImpl.java (original)
+++ geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/BlueprintContainerImpl.java Wed May 27 21:21:01 2009
@@ -42,6 +42,7 @@
 import org.apache.geronimo.blueprint.ExtendedBeanMetadata;
 import org.apache.geronimo.blueprint.ExtendedBlueprintContainer;
 import org.apache.geronimo.blueprint.NamespaceHandlerRegistry;
+import org.apache.geronimo.blueprint.Processor;
 import org.apache.geronimo.blueprint.di.DefaultExecutionContext;
 import org.apache.geronimo.blueprint.di.ExecutionContext;
 import org.apache.geronimo.blueprint.di.Recipe;
@@ -118,7 +119,7 @@
     private Parser parser;
     private BlueprintObjectInstantiator instantiator;
     private ServiceRegistration registration;
-    private List<BeanProcessor> beanProcessors;
+    private List<Processor> processors;
     private Map<String, List<SatisfiableRecipe>> satisfiables;
     private long timeout = 5 * 60 * 1000;
     private boolean waitForDependencies = true;
@@ -135,7 +136,7 @@
         this.converter = new AggregateConverter(this);
         this.componentDefinitionRegistry = new ComponentDefinitionRegistryImpl();
         this.executors = executors;
-        this.beanProcessors = new ArrayList<BeanProcessor>();
+        this.processors = new ArrayList<Processor>();
     }
 
     public Bundle getExtenderBundle() {
@@ -146,8 +147,14 @@
         return bundleContext.getBundle().loadClass(name);
     }
 
-    public List<BeanProcessor> getBeanProcessors() {
-        return beanProcessors;
+    public <T extends Processor> List<T> getProcessors(Class<T> clazz) {
+        List<T> p = new ArrayList<T>();
+        for (Processor processor : processors) {
+            if (clazz.isInstance(processor)) {
+                p.add(clazz.cast(processor));
+            }
+        }
+        return p;
     }
 
     public BlueprintListener getEventDispatcher() {
@@ -364,9 +371,9 @@
             if (ComponentDefinitionRegistryProcessor.class.isAssignableFrom(clazz)) {
                 Object obj = instantiator.create(bean.getId());
                 ((ComponentDefinitionRegistryProcessor) obj).process(componentDefinitionRegistry);
-            } else if (BeanProcessor.class.isAssignableFrom(clazz)) {
+            } else if (Processor.class.isAssignableFrom(clazz)) {
                 Object obj = instantiator.create(bean.getId());
-                this.beanProcessors.add((BeanProcessor) obj);
+                this.processors.add((Processor) obj);
             }
         }
     }

Modified: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/Parser.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/Parser.java?rev=779313&r1=779312&r2=779313&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/Parser.java (original)
+++ geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/Parser.java Wed May 27 21:21:01 2009
@@ -579,7 +579,8 @@
                         }
                         service.setInterfaceNames(parseInterfaceNames(e));
                     } else if (nodeNameEquals(e, SERVICE_PROPERTIES_ELEMENT)) {
-                        service.setServiceProperties(parseMap(e, service).getEntries());
+                        List<MapEntry> entries = parseServiceProperties(e, service).getEntries();
+                        service.setServiceProperties(entries); 
                     } else if (nodeNameEquals(e, REGISTRATION_LISTENER_ELEMENT)) {
                         service.addRegistrationListener(parseRegistrationListener(e));
                     } else if (nodeNameEquals(e, BEAN_ELEMENT)) {
@@ -745,6 +746,13 @@
         return keyValue;
     }
     
+    public MapMetadata parseServiceProperties(Element element, ComponentMetadata enclosingComponent) {
+        // TODO: need to handle this better
+        MapMetadata map = parseMap(element, enclosingComponent);
+        handleCustomElements(element, enclosingComponent);
+        return map;
+    }
+    
     private RegistrationListener parseRegistrationListener(Element element) {
         // Parse attributes
         String ref = element.hasAttribute(REF_ATTRIBUTE) ? element.getAttribute(REF_ATTRIBUTE) : null;
@@ -988,7 +996,7 @@
         return listener;
     }
 
-    private List<String> parseInterfaceNames(Element element) {
+    public List<String> parseInterfaceNames(Element element) {
         List<String> interfaceNames = new ArrayList<String>();
         NodeList nl = element.getChildNodes();
         for (int i = 0; i < nl.getLength(); i++) {

Modified: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/ParserContextImpl.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/ParserContextImpl.java?rev=779313&r1=779312&r2=779313&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/ParserContextImpl.java (original)
+++ geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/ParserContextImpl.java Wed May 27 21:21:01 2009
@@ -71,4 +71,8 @@
     public <T> T parseElement(Class<T> type, ComponentMetadata enclosingComponent, Element element) {
         return parser.parseElement(type, enclosingComponent, element);
     }
+    
+    public Parser getParser() {
+        return parser;
+    }
 }

Modified: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/ServiceRecipe.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/ServiceRecipe.java?rev=779313&r1=779312&r2=779313&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/ServiceRecipe.java (original)
+++ geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/ServiceRecipe.java Wed May 27 21:21:01 2009
@@ -11,8 +11,10 @@
 import java.util.Set;
 import java.util.ArrayList;
 
+import org.apache.geronimo.blueprint.BeanProcessor;
 import org.apache.geronimo.blueprint.BlueprintConstants;
 import org.apache.geronimo.blueprint.ExtendedBlueprintContainer;
+import org.apache.geronimo.blueprint.ServiceProcessor;
 import org.apache.geronimo.blueprint.di.AbstractRecipe;
 import org.apache.geronimo.blueprint.di.CollectionRecipe;
 import org.apache.geronimo.blueprint.di.DefaultExecutionContext;
@@ -22,6 +24,7 @@
 import org.apache.geronimo.blueprint.di.Recipe;
 import org.apache.geronimo.blueprint.di.RefRecipe;
 import org.apache.geronimo.blueprint.di.Repository;
+import org.apache.geronimo.blueprint.utils.JavaUtils;
 import org.apache.geronimo.blueprint.utils.ReflectionUtils;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.Constants;
@@ -110,6 +113,7 @@
         if (registration != null) {
             return;
         }
+        
         Hashtable props = new Hashtable();
         if (properties == null) {
             properties = (Map) createSimpleRecipe(propertiesRecipe);
@@ -120,6 +124,10 @@
         if (componentName != null) {
             props.put(BlueprintConstants.COMPONENT_NAME_PROPERTY, componentName);
         }
+        for (ServiceProcessor processor : blueprintContainer.getProcessors(ServiceProcessor.class)) {
+            processor.updateProperties(new PropertiesUpdater(), props);
+        }
+        
         Set<String> classes = getClasses();
         String[] classArray = classes.toArray(new String[classes.size()]);
         registration = blueprintContainer.getBundleContext().registerService(classArray, new TriggerServiceFactory(), props);
@@ -165,7 +173,7 @@
             registration = null;
         }
     }
-
+    
     public Object getService() {
         return getService(blueprintContainer.getBundleContext().getBundle(), null);
     }
@@ -341,6 +349,19 @@
         }
     }
 
+    private class PropertiesUpdater implements ServiceProcessor.ServicePropertiesUpdater {
+
+        public String getId() {
+            return metadata.getId();
+        }
+
+        public void updateProperties(Dictionary properties) {
+            Hashtable table = JavaUtils.getProperties(getReference());
+            JavaUtils.copy(table, properties);
+            setProperties(table);
+        }        
+    }
+    
     public static class Listener {
 
         private Object listener;

Added: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/utils/JavaUtils.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/utils/JavaUtils.java?rev=779313&view=auto
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/utils/JavaUtils.java (added)
+++ geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/utils/JavaUtils.java Wed May 27 21:21:01 2009
@@ -0,0 +1,50 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.blueprint.utils;
+
+import java.util.Dictionary;
+import java.util.Enumeration;
+import java.util.Hashtable;
+
+import org.osgi.framework.ServiceReference;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public final class JavaUtils {
+    
+    private JavaUtils() {
+    }
+
+    public static void copy(Dictionary destination, Dictionary source) {
+        Enumeration e = source.keys();
+        while (e.hasMoreElements()) {
+            Object key = e.nextElement();
+            Object value = source.get(key);
+            destination.put(key, value);
+        }
+    }
+    
+    public static Hashtable getProperties(ServiceReference ref) {
+        Hashtable props = new Hashtable();
+        for (String key : ref.getPropertyKeys()) {
+            props.put(key, ref.getProperty(key));
+        }
+        return props;
+    }
+    
+}

Propchange: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/utils/JavaUtils.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/utils/JavaUtils.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/utils/JavaUtils.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message