Return-Path: Delivered-To: apmail-geronimo-scm-archive@www.apache.org Received: (qmail 88683 invoked from network); 6 May 2009 12:51:23 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 6 May 2009 12:51:23 -0000 Received: (qmail 14007 invoked by uid 500); 6 May 2009 12:51:23 -0000 Delivered-To: apmail-geronimo-scm-archive@geronimo.apache.org Received: (qmail 13942 invoked by uid 500); 6 May 2009 12:51:23 -0000 Mailing-List: contact scm-help@geronimo.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: dev@geronimo.apache.org List-Id: Delivered-To: mailing list scm@geronimo.apache.org Received: (qmail 13933 invoked by uid 99); 6 May 2009 12:51:23 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 06 May 2009 12:51:23 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 06 May 2009 12:51:14 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id AD6A723888A4; Wed, 6 May 2009 12:50:52 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r772187 - 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/cont... Date: Wed, 06 May 2009 12:50:49 -0000 To: scm@geronimo.apache.org From: gnodet@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090506125052.AD6A723888A4@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: gnodet Date: Wed May 6 12:50:42 2009 New Revision: 772187 URL: http://svn.apache.org/viewvc?rev=772187&view=rev Log: Support for Added: geronimo/sandbox/blueprint/blueprint-cm/src/main/java/org/apache/geronimo/blueprint/compendium/cm/CmManagedProperties.java geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/BeanProcessor.java geronimo/sandbox/blueprint/blueprint-itests/src/test/java/org/apache/geronimo/blueprint/itests/TestConfigAdmin.java - copied, changed from r772106, geronimo/sandbox/blueprint/blueprint-itests/src/test/java/org/apache/geronimo/blueprint/itests/TestBlueprintContext.java geronimo/sandbox/blueprint/blueprint-itests/src/test/resources/log4j.properties Modified: 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/ExtendedBlueprintContext.java geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/BlueprintContextImpl.java geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/BlueprintObjectRecipe.java geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/Parser.java geronimo/sandbox/blueprint/blueprint-itests/pom.xml geronimo/sandbox/blueprint/blueprint-itests/src/test/java/org/apache/geronimo/blueprint/itests/TestBlueprintContext.java geronimo/sandbox/blueprint/blueprint-itests/src/test/java/org/apache/geronimo/blueprint/itests/TestReferences.java geronimo/sandbox/blueprint/blueprint-sample/src/main/java/org/apache/geronimo/blueprint/sample/Foo.java geronimo/sandbox/blueprint/blueprint-sample/src/main/resources/OSGI-INF/blueprint/config.xml geronimo/sandbox/blueprint/pom.xml Added: 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=772187&view=auto ============================================================================== --- geronimo/sandbox/blueprint/blueprint-cm/src/main/java/org/apache/geronimo/blueprint/compendium/cm/CmManagedProperties.java (added) +++ geronimo/sandbox/blueprint/blueprint-cm/src/main/java/org/apache/geronimo/blueprint/compendium/cm/CmManagedProperties.java Wed May 6 12:50:42 2009 @@ -0,0 +1,279 @@ +/** + * 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.lang.reflect.Method; +import java.lang.reflect.Modifier; +import java.util.Dictionary; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Properties; +import java.util.Set; +import java.util.LinkedList; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.LinkedHashSet; + +import org.apache.geronimo.blueprint.BeanProcessor; +import org.apache.geronimo.blueprint.ExtendedBlueprintContext; +import org.apache.geronimo.blueprint.utils.ReflectionUtils; +import org.apache.xbean.recipe.ReflectionUtil; +import org.apache.xbean.recipe.MissingAccessorException; +import org.apache.xbean.recipe.Option; +import org.apache.xbean.recipe.RecipeHelper; +import org.apache.xbean.recipe.Recipe; +import org.osgi.framework.Bundle; +import org.osgi.framework.Constants; +import org.osgi.framework.ServiceRegistration; +import org.osgi.service.cm.ConfigurationAdmin; +import org.osgi.service.cm.ConfigurationException; +import org.osgi.service.cm.ManagedService; +import org.slf4j.LoggerFactory; +import org.slf4j.Logger; + +/** + * TODO + * + * @author Apache Geronimo Project + * @version $Rev: 766508 $, $Date: 2009-04-19 22:09:27 +0200 (Sun, 19 Apr 2009) $ + */ +public class CmManagedProperties implements BeanProcessor { + + private static final Logger LOGGER = LoggerFactory.getLogger(CmManagedProperties.class); + + private ExtendedBlueprintContext blueprintContext; + private ConfigurationAdmin configAdmin; + private String persistentId; + private String updateStrategy; + private String updateMethod; + private String beanName; + + private final Object lock = new Object(); + private final Set beans = new HashSet(); + private ServiceRegistration registration; + private Dictionary properties; + + public ExtendedBlueprintContext getBlueprintContext() { + return blueprintContext; + } + + public void setBlueprintContext(ExtendedBlueprintContext blueprintContext) { + this.blueprintContext = blueprintContext; + } + + public ConfigurationAdmin getConfigAdmin() { + return configAdmin; + } + + public void setConfigAdmin(ConfigurationAdmin configAdmin) { + this.configAdmin = configAdmin; + } + + public String getPersistentId() { + return persistentId; + } + + public void setPersistentId(String persistentId) { + this.persistentId = persistentId; + } + + public String getUpdateStrategy() { + return updateStrategy; + } + + public void setUpdateStrategy(String updateStrategy) { + this.updateStrategy = updateStrategy; + } + + public String getUpdateMethod() { + return updateMethod; + } + + public void setUpdateMethod(String updateMethod) { + this.updateMethod = updateMethod; + } + + public String getBeanName() { + return beanName; + } + + public void setBeanName(String beanName) { + this.beanName = beanName; + } + + public void init() { + LOGGER.debug("Initializing CmManagedProperties for bean={} / pid={}", beanName, persistentId); + Properties props = new Properties(); + props.put(Constants.SERVICE_PID, persistentId); + Bundle bundle = blueprintContext.getBundleContext().getBundle(); + props.put(Constants.BUNDLE_SYMBOLICNAME, bundle.getSymbolicName()); + props.put(Constants.BUNDLE_VERSION, bundle.getHeaders().get(Constants.BUNDLE_VERSION)); + synchronized (lock) { + registration = blueprintContext.getBundleContext().registerService(ManagedService.class.getName(), new ConfigurationWatcher(), props); + try { + properties = configAdmin.getConfiguration(persistentId).getProperties(); + } catch (Throwable t) { + LOGGER.debug("Unable to retrieve initial configuration for bean={} / pid={}", beanName, persistentId); + } + } + } + + public void destroy() { + if (registration != null) { + registration.unregister(); + } + } + + public void updated(Dictionary props) { + LOGGER.debug("Configuration updated for bean={} / pid={}", beanName, persistentId); + synchronized (lock) { + this.properties = props; + for (Object bean : beans) { + inject(bean, false); + } + } + } + + public Object beforeInit(Object bean, String beanName) { + if (beanName.equals(this.beanName)) { + LOGGER.debug("Adding bean for bean={} / pid={}", beanName, persistentId); + synchronized (lock) { + beans.add(bean); + inject(bean, true); + } + } + return bean; + } + + public Object afterInit(Object bean, String beanName) { + return bean; + } + + public void beforeDestroy(Object bean, String beanName) { + if (beanName.equals(this.beanName)) { + LOGGER.debug("Removing bean for bean={} / pid={}", beanName, persistentId); + synchronized (lock) { + beans.remove(bean); + } + } + } + + public void afterDestroy(Object bean, String beanName) { + } + + private void inject(Object bean, boolean initial) { + LOGGER.debug("Injecting bean for bean={} / pid={}", beanName, persistentId); + LOGGER.debug("Configuration: {}", properties); + if (initial || "container-managed".equals(updateStrategy)) { + if (properties != null) { + for (Enumeration e = properties.keys(); e.hasMoreElements();) { + String key = e.nextElement(); + Object val = properties.get(key); + String setterName = "set" + Character.toUpperCase(key.charAt(0)); + if (key.length() > 0) { + setterName += key.substring(1); + } + MissingAccessorException missException = null; + Set validSetters = new LinkedHashSet(); + List methods = new ArrayList(Arrays.asList(bean.getClass().getMethods())); + methods.addAll(Arrays.asList(bean.getClass().getDeclaredMethods())); + for (Method method : methods) { + if (method.getName().equals(setterName)) { + if (method.getParameterTypes().length == 0) { + LOGGER.debug("Setter takes no parameters: {}", method); + continue; + } + if (method.getParameterTypes().length > 1) { + LOGGER.debug("Setter takes more than one parameter: {}", method); + continue; + } + if (method.getReturnType() != Void.TYPE) { + LOGGER.debug("Setter returns a value: {}", method); + continue; + } + if (Modifier.isAbstract(method.getModifiers())) { + LOGGER.debug("Setter is abstract: {}", method); + continue; + } + if (!Modifier.isPublic(method.getModifiers())) { + LOGGER.debug("Setter is not public: {}", method); + continue; + } + if (Modifier.isStatic(method.getModifiers())) { + LOGGER.debug("Setter is static: {}", method); + continue; + } + Class methodParameterType = method.getParameterTypes()[0]; + Object propertyValue; + try { + propertyValue = blueprintContext.getConversionService().convert(val, methodParameterType); + } catch (Throwable t) { + LOGGER.debug("Unable to convert value for setter: " + method, t); + continue; + } + if (methodParameterType.isPrimitive() && propertyValue == null) { + LOGGER.debug("Null can not be assigned to {}: {}", methodParameterType.getName(), method); + continue; + } + if (validSetters.add(method)) { + try { + method.invoke(bean, propertyValue); + } catch (Throwable t) { + LOGGER.debug("Setter can not be invoked: " + method, t); + } + } + } + } + if (validSetters.isEmpty()) { + LOGGER.debug("Unable to find a valid setter method for property {} and value {}", key, val); + } + } + } + } else if ("component-managed".equals(updateStrategy) && updateMethod != null) { + List methods = ReflectionUtils.findCompatibleMethods(bean.getClass(), updateMethod, new Class[] { Map.class }); + Map map = null; + if (properties != null) { + map = new HashMap(); + for (Enumeration e = properties.keys(); e.hasMoreElements();) { + String key = e.nextElement(); + Object val = properties.get(key); + map.put(key, val); + } + } + for (Method method : methods) { + try { + method.invoke(bean, map); + } catch (Throwable t) { + LOGGER.warn("Unable to call method " + method + " on bean " + beanName, t); + } + } + } + } + + private class ConfigurationWatcher implements ManagedService { + + public void updated(Dictionary props) throws ConfigurationException { + CmManagedProperties.this.updated(props); + } + } + +} 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=772187&r1=772186&r2=772187&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 6 12:50:42 2009 @@ -31,6 +31,7 @@ import org.apache.geronimo.blueprint.mutable.MutableValueMetadata; import org.apache.geronimo.blueprint.mutable.MutableRefMetadata; import org.apache.geronimo.blueprint.mutable.MutableReferenceMetadata; +import org.apache.geronimo.blueprint.mutable.MutableIdRefMetadata; import org.osgi.service.blueprint.context.ComponentDefinitionException; import org.osgi.service.blueprint.namespace.ComponentDefinitionRegistry; import org.osgi.service.blueprint.namespace.NamespaceHandler; @@ -41,6 +42,9 @@ import org.osgi.service.blueprint.reflect.ReferenceMetadata; import org.osgi.service.blueprint.reflect.ValueMetadata; import org.osgi.service.blueprint.reflect.RefMetadata; +import org.osgi.service.blueprint.reflect.BeanMetadata; +import org.osgi.service.blueprint.reflect.ServiceMetadata; +import org.osgi.service.blueprint.reflect.IdRefMetadata; import org.osgi.service.cm.ConfigurationAdmin; /** @@ -73,7 +77,7 @@ private int nameCounter; public URL getSchemaLocation(String namespace) { - return getClass().getResource("/org/apache/geronimo/blueprint/compendium/cm/blueprint-cm.xsd"); + return getClass().getResource("blueprint-cm.xsd"); } public ComponentMetadata parse(Element element, ParserContext ctx) { @@ -82,12 +86,30 @@ createConfigAdminProxy(context, registry); if (nodeNameEquals(element, PROPERTY_PLACEHOLDER_ELEMENT)) { return parsePropertyPlaceholder(context, element); + } else if (nodeNameEquals(element, MANAGED_SERVICE_FACTORY_ELEMENT)) { + return parseManagedServiceFactory(context, element); } else { - // TODO: parse other compendium elements. throw new ComponentDefinitionException("Unsupported element: " + element.getNodeName()); } } + public ComponentMetadata decorate(Node node, ComponentMetadata component, ParserContext ctx) { + ExtendedParserContext context = (ExtendedParserContext) ctx; + ExtendedComponentDefinitionRegistry registry = (ExtendedComponentDefinitionRegistry) context.getComponentDefinitionRegistry(); + createConfigAdminProxy(context, registry); + if (node instanceof Element) { + if (nodeNameEquals(node, MANAGED_PROPERTIES_ELEMENT)) { + return decorateManagedProperties(context, (Element) node, component); + } else if (nodeNameEquals(node, CM_PROPERTIES_ELEMENT)) { + return decorateCmProperties(context, (Element) node, component); + } else { + throw new ComponentDefinitionException("Unsupported element: " + node.getNodeName()); + } + } else { + throw new ComponentDefinitionException("Illegal use of blueprint cm namespace"); + } + } + private ComponentMetadata parsePropertyPlaceholder(ExtendedParserContext context, Element element) { MutableBeanMetadata metadata = context.createMetadata(MutableBeanMetadata.class); metadata.setId(getName(element)); @@ -145,6 +167,45 @@ return props; } + private ComponentMetadata parseManagedServiceFactory(ExtendedParserContext context, Element element) { + // TODO: implement managed-service-factory + throw new UnsupportedOperationException("Not implemented yet"); + } + + 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 element"); + } + // TODO: implement cm-properties + throw new UnsupportedOperationException("Not implemented yet"); + } + + private ComponentMetadata decorateManagedProperties(ExtendedParserContext context, Element element, ComponentMetadata component) { + if (!(component instanceof BeanMetadata)) { + throw new ComponentDefinitionException("Element " + MANAGED_PROPERTIES_ELEMENT + " must be used inside a element"); + } + if (component.getId() == null) { + throw new IllegalStateException("Component does not have an id: " + component); + } + MutableBeanMetadata metadata = context.createMetadata(MutableBeanMetadata.class); + metadata.setId(getName(element)); + metadata.setRuntimeClass(CmManagedProperties.class); + metadata.setInitMethodName("init"); + metadata.setDestroyMethodName("destroy"); + metadata.addProperty("blueprintContext", createRef(context, "blueprintContext")); + metadata.addProperty("configAdmin", createRef(context, CONFIG_ADMIN_REFERENCE_NAME)); + metadata.addProperty("persistentId", createValue(context, element.getAttribute(PERSISTENT_ID_ATTRIBUTE))); + if (element.hasAttribute(UPDATE_STRATEGY_ATTRIBUTE)) { + metadata.addProperty("updateStrategy", createValue(context, element.getAttribute(UPDATE_STRATEGY_ATTRIBUTE))); + } + if (element.hasAttribute(UPDATE_METHOD_ATTRIBUTE)) { + metadata.addProperty("updateMethod", createValue(context, element.getAttribute(UPDATE_METHOD_ATTRIBUTE))); + } + metadata.addProperty("beanName", createIdRef(context, component.getId())); + context.getComponentDefinitionRegistry().registerComponentDefinition(metadata); + return component; + } + /** * Create a reference to the ConfigurationAdmin service if not already done * and add it to the registry. @@ -162,10 +223,6 @@ } } - public ComponentMetadata decorate(Node node, ComponentMetadata component, ParserContext context) { - throw new ComponentDefinitionException("Illegal use of blueprint cm namespace"); - } - private static ValueMetadata createValue(ExtendedParserContext context, String value) { return createValue(context, value, null); } @@ -183,6 +240,12 @@ return m; } + private static IdRefMetadata createIdRef(ExtendedParserContext context, String value) { + MutableIdRefMetadata m = context.createMetadata(MutableIdRefMetadata.class); + m.setComponentId(value); + return m; + } + private static boolean nodeNameEquals(Node node, String name) { return (name.equals(node.getNodeName()) || name.equals(node.getLocalName())); } Added: 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=772187&view=auto ============================================================================== --- geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/BeanProcessor.java (added) +++ geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/BeanProcessor.java Wed May 6 12:50:42 2009 @@ -0,0 +1,37 @@ +/** + * 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; + +/** + * TODO + * + * @author Apache Geronimo Project + * @version $Rev: 766508 $, $Date: 2009-04-19 22:09:27 +0200 (Sun, 19 Apr 2009) $ + */ +public interface BeanProcessor { + + Object beforeInit(Object bean, String beanName); + + Object afterInit(Object bean, String beanName); + + void beforeDestroy(Object bean, String beanName); + + void afterDestroy(Object bean, String beanName); + +} Modified: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/ExtendedBlueprintContext.java URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/ExtendedBlueprintContext.java?rev=772187&r1=772186&r2=772187&view=diff ============================================================================== --- geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/ExtendedBlueprintContext.java (original) +++ geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/ExtendedBlueprintContext.java Wed May 6 12:50:42 2009 @@ -20,6 +20,7 @@ import org.osgi.service.blueprint.context.BlueprintContext; import org.osgi.service.blueprint.reflect.ComponentMetadata; +import org.osgi.service.blueprint.convert.ConversionService; /** * TODO: javadoc @@ -29,6 +30,8 @@ */ public interface ExtendedBlueprintContext extends BlueprintContext { + ConversionService getConversionService(); + Class loadClass(String name) throws ClassNotFoundException; List getComponentsMetadata(Class type); Modified: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/BlueprintContextImpl.java URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/BlueprintContextImpl.java?rev=772187&r1=772186&r2=772187&view=diff ============================================================================== --- geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/BlueprintContextImpl.java (original) +++ geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/BlueprintContextImpl.java Wed May 6 12:50:42 2009 @@ -41,6 +41,7 @@ import org.apache.geronimo.blueprint.SatisfiableRecipe; import org.apache.geronimo.blueprint.ComponentDefinitionRegistryProcessor; import org.apache.geronimo.blueprint.ExtendedBlueprintContext; +import org.apache.geronimo.blueprint.BeanProcessor; import org.apache.geronimo.blueprint.convert.ConversionServiceImpl; import org.apache.geronimo.blueprint.namespace.ComponentDefinitionRegistryImpl; import org.apache.xbean.recipe.Repository; @@ -101,6 +102,7 @@ private BlueprintObjectInstantiator instantiator; private ServiceRegistration registration; private boolean waitForNamespaceHandlersEventSent; + private List beanProcessors; private Map destroyables = new HashMap(); private Map> satisfiables; private boolean serviceActivation; @@ -117,6 +119,7 @@ this.executors = executors; this.lazyActivation = lazyActivation; this.triggerServices = new HashMap(); + this.beanProcessors = new ArrayList(); } public Class loadClass(String name) throws ClassNotFoundException { @@ -127,6 +130,10 @@ destroyables.put(name, destroyable); } + public List getBeanProcessors() { + return beanProcessors; + } + public BlueprintContextEventSender getSender() { return sender; } @@ -266,7 +273,30 @@ ((ComponentDefinitionRegistryProcessor) obj).process(componentDefinitionRegistry); } } - // TODO: need to destroy those objects at the end + for (Object obj : objects.values()) { + if (obj instanceof BeanProcessor) { + this.beanProcessors.add((BeanProcessor) obj); + } + } + + // Instanciate ComponentDefinitionRegistryProcessor and BeanProcessor + repository = i.createRepository(componentDefinitionRegistry); + instantiator = new BlueprintObjectInstantiator(repository); + for (BeanMetadata bean : getBeanComponentsMetadata()) { + Class clazz = bean.getRuntimeClass(); + if (clazz == null) { + clazz = loadClass(bean.getClassName()); + } + if (ComponentDefinitionRegistryProcessor.class.isAssignableFrom(clazz)) { + Object obj = instantiator.create(bean.getId()); + ((ComponentDefinitionRegistryProcessor) obj).process(componentDefinitionRegistry); + } else if (BeanProcessor.class.isAssignableFrom(clazz)) { + Object obj = instantiator.create(bean.getId()); + this.beanProcessors.add((BeanProcessor) obj); + } + } + + // TODO: need to destroy all those objects at the end } private Map> getSatisfiableDependenciesMap() { @@ -509,7 +539,7 @@ return instantiator.getRepository(); } - protected ConversionService getConversionService() { + public ConversionService getConversionService() { return conversionService; } Modified: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/BlueprintObjectRecipe.java URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/BlueprintObjectRecipe.java?rev=772187&r1=772186&r2=772187&view=diff ============================================================================== --- geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/BlueprintObjectRecipe.java (original) +++ geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/BlueprintObjectRecipe.java Wed May 6 12:50:42 2009 @@ -32,10 +32,12 @@ import org.apache.xbean.recipe.Recipe; import org.apache.xbean.recipe.RecipeHelper; import org.apache.xbean.recipe.ReferenceRecipe; +import org.apache.xbean.recipe.Option; import org.apache.geronimo.blueprint.namespace.ComponentDefinitionRegistryImpl; import org.apache.geronimo.blueprint.utils.ArgumentsMatch; import org.apache.geronimo.blueprint.utils.ArgumentsMatcher; import org.apache.geronimo.blueprint.utils.ReflectionUtils; +import org.apache.geronimo.blueprint.BeanProcessor; import org.osgi.service.blueprint.reflect.BeanArgument; import org.osgi.service.blueprint.reflect.CollectionMetadata; import org.osgi.service.blueprint.reflect.MapMetadata; @@ -65,6 +67,7 @@ public BlueprintObjectRecipe(BlueprintContextImpl blueprintContext, Class typeName) { super(typeName); this.blueprintContext = blueprintContext; + allow(Option.LAZY_ASSIGNMENT); } public void setFactoryMethod(String method) { @@ -174,6 +177,22 @@ return args; } + private List getFinalArguments(ArgumentsMatch match, boolean refAllowed) throws ConstructionException { + List arguments = match.getArguments(); + Class[] parameterTypes = match.getParameterTypes(); + + List args = new ArrayList(); + for (int i = 0; i < arguments.size(); i++) { + Object argument = arguments.get(i); + if (argument instanceof Recipe) { + argument = RecipeHelper.convert(parameterTypes[i], argument, refAllowed); + } + args.add(argument); + } + + return args; + } + private boolean shouldPreinstantiate(Metadata metadata) { if (metadata instanceof ValueMetadata) { ValueMetadata stringValue = (ValueMetadata) metadata; @@ -207,22 +226,6 @@ } } - private List getFinalArguments(ArgumentsMatch match, boolean refAllowed) throws ConstructionException { - List arguments = match.getArguments(); - Class[] parameterTypes = match.getParameterTypes(); - - List args = new ArrayList(); - for (int i = 0; i < arguments.size(); i++) { - Object argument = arguments.get(i); - if (argument instanceof Recipe) { - argument = RecipeHelper.convert(parameterTypes[i], argument, refAllowed); - } - args.add(argument); - } - - return args; - } - private Set getArgumentsMatcherOptions() { Set options = new HashSet(); if (reorderArguments) { @@ -330,10 +333,13 @@ } else { // factory-method was specified, so we're not really sure what type of object we create // until we actually create it + // TODO: is it possible to perform eager disambiguation on the factory method to get + // the return type? + // TODO: this stuff should be moved to getType() instead return true; } } - + @Override public List getConstructorRecipes() { return getNestedRecipes(); @@ -343,8 +349,8 @@ protected Object internalCreate(Type expectedType, boolean lazyRefAllowed) throws ConstructionException { instantiateExplicitDependencies(); - - final Object obj = getInstance(lazyRefAllowed); + + Object obj = getInstance(lazyRefAllowed); // check for init lifecycle method (if any) Method initMethod = getInitMethod(obj); @@ -354,6 +360,10 @@ // inject properties setProperties(obj); + + for (BeanProcessor processor : blueprintContext.getBeanProcessors()) { + obj = processor.beforeInit(obj, getName()); + } // call init method if (initMethod != null) { @@ -375,6 +385,9 @@ } public void destroyInstance(Object obj) { + for (BeanProcessor processor : blueprintContext.getBeanProcessors()) { + processor.beforeDestroy(obj, getName()); + } try { Method method = getDestroyMethod(obj); if (method != null) { @@ -383,5 +396,8 @@ } catch (Exception e) { e.printStackTrace(); } + for (BeanProcessor processor : blueprintContext.getBeanProcessors()) { + processor.afterDestroy(obj, getName()); + } } } Modified: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/Parser.java URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/Parser.java?rev=772187&r1=772186&r2=772187&view=diff ============================================================================== --- geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/Parser.java (original) +++ geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/Parser.java Wed May 6 12:50:42 2009 @@ -87,6 +87,8 @@ import org.osgi.service.blueprint.reflect.BeanArgument; import org.osgi.service.blueprint.reflect.BeanProperty; import org.xml.sax.InputSource; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * TODO: javadoc @@ -189,6 +191,8 @@ public static final String ODERING_BASIS_SERVICE_REFERENCES = "service-reference"; public static final String LAZY_INIT_DEFAULT = BOOLEAN_FALSE; + private static final Logger LOGGER = LoggerFactory.getLogger(Parser.class); + private List documents; private ExtendedComponentDefinitionRegistry registry; private NamespaceHandlerRegistry namespaceHandlerRegistry; @@ -299,6 +303,8 @@ URL url = handler.getSchemaLocation(uri.toString()); if (url != null) { schemaSources.add(new StreamSource(url.openStream())); + } else { + LOGGER.warn("No URL is defined for schema " + uri + ". This schema will not be validated"); } } SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); Modified: geronimo/sandbox/blueprint/blueprint-itests/pom.xml URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-itests/pom.xml?rev=772187&r1=772186&r2=772187&view=diff ============================================================================== --- geronimo/sandbox/blueprint/blueprint-itests/pom.xml (original) +++ geronimo/sandbox/blueprint/blueprint-itests/pom.xml Wed May 6 12:50:42 2009 @@ -63,6 +63,26 @@ junit test + + org.apache.felix + org.apache.felix.configadmin + test + + + org.ops4j.pax.logging + pax-logging-api + test + + + org.ops4j.pax.logging + pax-logging-service + test + + + org.ops4j.pax.url + pax-url-mvn + test + Modified: geronimo/sandbox/blueprint/blueprint-itests/src/test/java/org/apache/geronimo/blueprint/itests/TestBlueprintContext.java URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-itests/src/test/java/org/apache/geronimo/blueprint/itests/TestBlueprintContext.java?rev=772187&r1=772186&r2=772187&view=diff ============================================================================== --- geronimo/sandbox/blueprint/blueprint-itests/src/test/java/org/apache/geronimo/blueprint/itests/TestBlueprintContext.java (original) +++ geronimo/sandbox/blueprint/blueprint-itests/src/test/java/org/apache/geronimo/blueprint/itests/TestBlueprintContext.java Wed May 6 12:50:42 2009 @@ -30,6 +30,7 @@ import static org.junit.Assert.assertSame; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; +import static org.junit.Assert.assertNull; import org.junit.Test; import org.junit.runner.RunWith; import static org.ops4j.pax.exam.CoreOptions.equinox; @@ -55,7 +56,7 @@ public void test() throws Exception { // Create a config to check the property placeholder ConfigurationAdmin ca = getOsgiService(ConfigurationAdmin.class); - Configuration cf = ca.getConfiguration("blueprint-sample", null); + Configuration cf = ca.getConfiguration("blueprint-sample-placeholder", null); Hashtable props = new Hashtable(); props.put("key.b", "10"); cf.update(props); @@ -113,10 +114,13 @@ @org.ops4j.pax.exam.junit.Configuration public static Option[] configuration() { Option[] options = options( - // install log service using pax runners profile abstraction (there are more profiles, like DS) - logProfile(), - configProfile(), - profile("url"), + // Log + mavenBundle("org.ops4j.pax.logging", "pax-logging-api"), + mavenBundle("org.ops4j.pax.logging", "pax-logging-service"), + // Felix Config Admin + mavenBundle("org.apache.felix", "org.apache.felix.configadmin"), + // Felix mvn url handler + mavenBundle("org.ops4j.pax.url", "pax-url-mvn"), // this is how you set the default log level when using pax logging (logProfile) Copied: geronimo/sandbox/blueprint/blueprint-itests/src/test/java/org/apache/geronimo/blueprint/itests/TestConfigAdmin.java (from r772106, geronimo/sandbox/blueprint/blueprint-itests/src/test/java/org/apache/geronimo/blueprint/itests/TestBlueprintContext.java) URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-itests/src/test/java/org/apache/geronimo/blueprint/itests/TestConfigAdmin.java?p2=geronimo/sandbox/blueprint/blueprint-itests/src/test/java/org/apache/geronimo/blueprint/itests/TestConfigAdmin.java&p1=geronimo/sandbox/blueprint/blueprint-itests/src/test/java/org/apache/geronimo/blueprint/itests/TestBlueprintContext.java&r1=772106&r2=772187&rev=772187&view=diff ============================================================================== --- geronimo/sandbox/blueprint/blueprint-itests/src/test/java/org/apache/geronimo/blueprint/itests/TestBlueprintContext.java (original) +++ geronimo/sandbox/blueprint/blueprint-itests/src/test/java/org/apache/geronimo/blueprint/itests/TestConfigAdmin.java Wed May 6 12:50:42 2009 @@ -18,18 +18,12 @@ */ package org.apache.geronimo.blueprint.itests; -import java.text.SimpleDateFormat; import java.util.Currency; import java.util.Hashtable; -import org.apache.geronimo.blueprint.sample.Bar; import org.apache.geronimo.blueprint.sample.Foo; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertSame; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; import org.junit.Test; import org.junit.runner.RunWith; import static org.ops4j.pax.exam.CoreOptions.equinox; @@ -39,9 +33,6 @@ import static org.ops4j.pax.exam.CoreOptions.systemProperty; import org.ops4j.pax.exam.Option; import org.ops4j.pax.exam.OptionUtils; -import static org.ops4j.pax.exam.container.def.PaxRunnerOptions.configProfile; -import static org.ops4j.pax.exam.container.def.PaxRunnerOptions.logProfile; -import static org.ops4j.pax.exam.container.def.PaxRunnerOptions.profile; import org.ops4j.pax.exam.junit.JUnit4TestRunner; import org.osgi.framework.Bundle; import org.osgi.service.blueprint.context.BlueprintContext; @@ -49,74 +40,120 @@ import org.osgi.service.cm.ConfigurationAdmin; @RunWith(JUnit4TestRunner.class) -public class TestBlueprintContext extends AbstractIntegrationTest { +public class TestConfigAdmin extends AbstractIntegrationTest { @Test - public void test() throws Exception { - // Create a config to check the property placeholder + public void testStrategyNone() throws Exception { ConfigurationAdmin ca = getOsgiService(ConfigurationAdmin.class); - Configuration cf = ca.getConfiguration("blueprint-sample", null); - Hashtable props = new Hashtable(); - props.put("key.b", "10"); + Configuration cf = ca.getConfiguration("blueprint-sample-managed.none", null); + Hashtable props = new Hashtable(); + props.put("a", "5"); + props.put("currency", "PLN"); cf.update(props); Bundle bundle = getInstalledBundle("blueprint-sample"); assertNotNull(bundle); + bundle.start(); + + BlueprintContext blueprintContext = getBlueprintContextForBundle("blueprint-sample", 5000); + assertNotNull(blueprintContext); + + Foo foo = (Foo) blueprintContext.getComponent("none-managed"); + assertNotNull(foo); + + assertEquals(5, foo.getA()); + assertEquals(Currency.getInstance("PLN"), foo.getCurrency()); + + props = new Hashtable(); + props.put("a", "10"); + props.put("currency", "USD"); + cf.update(props); + + Thread.sleep(100); + assertEquals(5, foo.getA()); + assertEquals(Currency.getInstance("PLN"), foo.getCurrency()); + } + + @Test + public void testStrategyContainer() throws Exception { + ConfigurationAdmin ca = getOsgiService(ConfigurationAdmin.class); + Configuration cf = ca.getConfiguration("blueprint-sample-managed.container", null); + Hashtable props = new Hashtable(); + props.put("a", "5"); + props.put("currency", "PLN"); + cf.update(props); + + Bundle bundle = getInstalledBundle("blueprint-sample"); + assertNotNull(bundle); bundle.start(); BlueprintContext blueprintContext = getBlueprintContextForBundle("blueprint-sample", 5000); assertNotNull(blueprintContext); - Object obj = blueprintContext.getComponent("bar"); - assertNotNull(obj); - assertEquals(Bar.class, obj.getClass()); - Bar bar = (Bar) obj; - assertNotNull(bar.getContext()); - assertEquals("Hello FooBar", bar.getValue()); - assertNotNull(bar.getList()); - assertEquals(2, bar.getList().size()); - assertEquals("a list element", bar.getList().get(0)); - assertEquals(Integer.valueOf(5), bar.getList().get(1)); - obj = blueprintContext.getComponent("foo"); - assertNotNull(obj); - assertEquals(Foo.class, obj.getClass()); - Foo foo = (Foo) obj; + Foo foo = (Foo) blueprintContext.getComponent("container-managed"); + assertNotNull(foo); + assertEquals(5, foo.getA()); - assertEquals(10, foo.getB()); - assertSame(bar, foo.getBar()); assertEquals(Currency.getInstance("PLN"), foo.getCurrency()); - assertEquals(new SimpleDateFormat("yyyy.MM.dd").parse("2009.04.17"), foo.getDate()); - assertTrue(foo.isInitialized()); - assertFalse(foo.isDestroyed()); + props = new Hashtable(); + props.put("a", "10"); + props.put("currency", "USD"); + cf.update(props); - obj = getOsgiService(Foo.class, 5000); - assertNotNull(obj); - assertSame(foo, obj); + Thread.sleep(100); - bundle.stop(); + assertEquals(10, foo.getA()); + assertEquals(Currency.getInstance("USD"), foo.getCurrency()); + } - Thread.sleep(1000); + @Test + public void testStrategyComponent() throws Exception { + ConfigurationAdmin ca = getOsgiService(ConfigurationAdmin.class); + Configuration cf = ca.getConfiguration("blueprint-sample-managed.component", null); + Hashtable props = new Hashtable(); + props.put("a", "5"); + props.put("currency", "PLN"); + cf.update(props); - try { - blueprintContext = getBlueprintContextForBundle("blueprint-sample", 1); - fail("BlueprintContext should have been unregistered"); - } catch (Exception e) { - // Expected, as the module context should have been unregistered - } + Bundle bundle = getInstalledBundle("blueprint-sample"); + assertNotNull(bundle); + bundle.start(); - assertTrue(foo.isInitialized()); - assertTrue(foo.isDestroyed()); + BlueprintContext blueprintContext = getBlueprintContextForBundle("blueprint-sample", 5000); + assertNotNull(blueprintContext); + + Foo foo = (Foo) blueprintContext.getComponent("component-managed"); + assertNotNull(foo); + + assertEquals(5, foo.getA()); + assertEquals(Currency.getInstance("PLN"), foo.getCurrency()); + + props = new Hashtable(); + props.put("a", "10"); + props.put("currency", "USD"); + cf.update(props); + + Thread.sleep(100); + + assertEquals(5, foo.getA()); + assertEquals(Currency.getInstance("PLN"), foo.getCurrency()); + assertNotNull(foo.getProps()); + assertEquals("10", foo.getProps().get("a")); + assertEquals("USD", foo.getProps().get("currency")); } @org.ops4j.pax.exam.junit.Configuration public static Option[] configuration() { Option[] options = options( - // install log service using pax runners profile abstraction (there are more profiles, like DS) - logProfile(), - configProfile(), - profile("url"), + // Log + mavenBundle("org.ops4j.pax.logging", "pax-logging-api"), + mavenBundle("org.ops4j.pax.logging", "pax-logging-service"), + // Felix Config Admin + mavenBundle("org.apache.felix", "org.apache.felix.configadmin"), + // Felix mvn url handler + mavenBundle("org.ops4j.pax.url", "pax-url-mvn"), // this is how you set the default log level when using pax logging (logProfile) @@ -130,11 +167,11 @@ ); // use config generated by the Maven plugin (until PAXEXAM-62/64 get resolved) - if (TestBlueprintContext.class.getClassLoader().getResource("META-INF/maven/paxexam-config.args") != null) { + if (TestConfigAdmin.class.getClassLoader().getResource("META-INF/maven/paxexam-config.args") != null) { options = OptionUtils.combine(options, mavenConfiguration()); } return options; } -} +} \ No newline at end of file Modified: geronimo/sandbox/blueprint/blueprint-itests/src/test/java/org/apache/geronimo/blueprint/itests/TestReferences.java URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-itests/src/test/java/org/apache/geronimo/blueprint/itests/TestReferences.java?rev=772187&r1=772186&r2=772187&view=diff ============================================================================== --- geronimo/sandbox/blueprint/blueprint-itests/src/test/java/org/apache/geronimo/blueprint/itests/TestReferences.java (original) +++ geronimo/sandbox/blueprint/blueprint-itests/src/test/java/org/apache/geronimo/blueprint/itests/TestReferences.java Wed May 6 12:50:42 2009 @@ -20,9 +20,11 @@ import java.util.Hashtable; import java.util.List; +import java.util.Currency; import org.apache.geronimo.blueprint.sample.BindingListener; import org.apache.geronimo.blueprint.sample.InterfaceA; +import org.apache.geronimo.blueprint.sample.Foo; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; @@ -46,6 +48,8 @@ import org.osgi.framework.ServiceRegistration; import org.osgi.service.blueprint.context.BlueprintContext; import org.osgi.service.blueprint.context.ServiceUnavailableException; +import org.osgi.service.cm.ConfigurationAdmin; +import org.osgi.service.cm.Configuration; @RunWith(JUnit4TestRunner.class) public class TestReferences extends AbstractIntegrationTest { @@ -133,10 +137,13 @@ @org.ops4j.pax.exam.junit.Configuration public static Option[] configuration() { Option[] options = options( - // install log service using pax runners profile abstraction (there are more profiles, like DS) - logProfile(), - configProfile(), - profile("url"), + // Log + mavenBundle("org.ops4j.pax.logging", "pax-logging-api"), + mavenBundle("org.ops4j.pax.logging", "pax-logging-service"), + // Felix Config Admin + mavenBundle("org.apache.felix", "org.apache.felix.configadmin"), + // Felix mvn url handler + mavenBundle("org.ops4j.pax.url", "pax-url-mvn"), // this is how you set the default log level when using pax logging (logProfile) systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("INFO"), Added: geronimo/sandbox/blueprint/blueprint-itests/src/test/resources/log4j.properties URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-itests/src/test/resources/log4j.properties?rev=772187&view=auto ============================================================================== --- geronimo/sandbox/blueprint/blueprint-itests/src/test/resources/log4j.properties (added) +++ geronimo/sandbox/blueprint/blueprint-itests/src/test/resources/log4j.properties Wed May 6 12:50:42 2009 @@ -0,0 +1,33 @@ +################################################################################ +# +# 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. +# +################################################################################ + +# Root logger +log4j.rootLogger=DEBUG, stdout + +# CONSOLE appender not used by default +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout +log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} | %-5.5p | %-16.16t | %-32.32c{1} | %-32.32C %4L | %m%n + +# File appender +log4j.appender.out=org.apache.log4j.FileAppender +log4j.appender.out.layout=org.apache.log4j.PatternLayout +log4j.appender.out.layout.ConversionPattern=%d{ABSOLUTE} | %-5.5p | %-16.16t | %-32.32c{1} | %-32.32C %4L | %m%n +log4j.appender.out.file=${karaf.base}/data/log/karaf.log +log4j.appender.out.append=true Modified: geronimo/sandbox/blueprint/blueprint-sample/src/main/java/org/apache/geronimo/blueprint/sample/Foo.java URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-sample/src/main/java/org/apache/geronimo/blueprint/sample/Foo.java?rev=772187&r1=772186&r2=772187&view=diff ============================================================================== --- geronimo/sandbox/blueprint/blueprint-sample/src/main/java/org/apache/geronimo/blueprint/sample/Foo.java (original) +++ geronimo/sandbox/blueprint/blueprint-sample/src/main/java/org/apache/geronimo/blueprint/sample/Foo.java Wed May 6 12:50:42 2009 @@ -19,6 +19,7 @@ import java.io.Serializable; import java.util.Currency; import java.util.Date; +import java.util.Map; public class Foo implements Serializable { @@ -30,6 +31,7 @@ public boolean initialized; public boolean destroyed; + private Map props; public int getA() { return a; @@ -92,5 +94,13 @@ public boolean isDestroyed() { return destroyed; } + + public void update(Map props) { + this.props = props; + } + + public Map getProps() { + return props; + } } Modified: geronimo/sandbox/blueprint/blueprint-sample/src/main/resources/OSGI-INF/blueprint/config.xml URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-sample/src/main/resources/OSGI-INF/blueprint/config.xml?rev=772187&r1=772186&r2=772187&view=diff ============================================================================== --- geronimo/sandbox/blueprint/blueprint-sample/src/main/resources/OSGI-INF/blueprint/config.xml (original) +++ geronimo/sandbox/blueprint/blueprint-sample/src/main/resources/OSGI-INF/blueprint/config.xml Wed May 6 12:50:42 2009 @@ -9,13 +9,26 @@ - - - - - + + + + + + + + + + + + + + + + + + Modified: geronimo/sandbox/blueprint/pom.xml URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/pom.xml?rev=772187&r1=772186&r2=772187&view=diff ============================================================================== --- geronimo/sandbox/blueprint/pom.xml (original) +++ geronimo/sandbox/blueprint/pom.xml Wed May 6 12:50:42 2009 @@ -123,6 +123,26 @@ pax-exam-junit-extender-impl 0.5.0 + + org.apache.felix + org.apache.felix.configadmin + 1.0.10 + + + org.ops4j.pax.logging + pax-logging-api + 1.3.0 + + + org.ops4j.pax.logging + pax-logging-service + 1.3.0 + + + org.ops4j.pax.url + pax-url-mvn + 0.3.3 +