aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r1824423 - in /aries/trunk/blueprint/blueprint-noosgi: pom.xml src/main/java/org/apache/aries/blueprint/container/SimpleNamespaceHandlerSet.java src/main/java/org/apache/aries/blueprint/ext/impl/ExtNamespaceHandler.java
Date Fri, 16 Feb 2018 06:56:36 GMT
Author: gnodet
Date: Fri Feb 16 06:56:36 2018
New Revision: 1824423

URL: http://svn.apache.org/viewvc?rev=1824423&view=rev
Log:
Upgrade blueprint-noosgi to latest blueprint-core / parser

Modified:
    aries/trunk/blueprint/blueprint-noosgi/pom.xml
    aries/trunk/blueprint/blueprint-noosgi/src/main/java/org/apache/aries/blueprint/container/SimpleNamespaceHandlerSet.java
    aries/trunk/blueprint/blueprint-noosgi/src/main/java/org/apache/aries/blueprint/ext/impl/ExtNamespaceHandler.java

Modified: aries/trunk/blueprint/blueprint-noosgi/pom.xml
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-noosgi/pom.xml?rev=1824423&r1=1824422&r2=1824423&view=diff
==============================================================================
--- aries/trunk/blueprint/blueprint-noosgi/pom.xml (original)
+++ aries/trunk/blueprint/blueprint-noosgi/pom.xml Fri Feb 16 06:56:36 2018
@@ -31,7 +31,7 @@
     <groupId>org.apache.aries.blueprint</groupId>
     <artifactId>org.apache.aries.blueprint.noosgi</artifactId>
     <packaging>jar</packaging>
-    <version>1.1.3-SNAPSHOT</version>
+    <version>1.2.0-SNAPSHOT</version>
     <name>Apache Aries Blueprint no-OSGI</name>
     <description>
         This jar contains everything needed to run Blueprint outside OSGi.
@@ -45,8 +45,8 @@
 
     <properties>
         <blueprint.api.version>1.0.1</blueprint.api.version>
-        <blueprint.core.version>1.4.3</blueprint.core.version>
-        <blueprint.parser.version>1.3.1</blueprint.parser.version>
+        <blueprint.core.version>1.9.0</blueprint.core.version>
+        <blueprint.parser.version>1.5.0</blueprint.parser.version>
         <proxy.impl.version>1.0.3</proxy.impl.version>
     </properties>
 

Modified: aries/trunk/blueprint/blueprint-noosgi/src/main/java/org/apache/aries/blueprint/container/SimpleNamespaceHandlerSet.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-noosgi/src/main/java/org/apache/aries/blueprint/container/SimpleNamespaceHandlerSet.java?rev=1824423&r1=1824422&r2=1824423&view=diff
==============================================================================
--- aries/trunk/blueprint/blueprint-noosgi/src/main/java/org/apache/aries/blueprint/container/SimpleNamespaceHandlerSet.java
(original)
+++ aries/trunk/blueprint/blueprint-noosgi/src/main/java/org/apache/aries/blueprint/container/SimpleNamespaceHandlerSet.java
Fri Feb 16 06:56:36 2018
@@ -45,8 +45,6 @@ import org.xml.sax.SAXException;
 
 public class SimpleNamespaceHandlerSet implements NamespaceHandlerSet {
 
-    public static final URI EXT_1_2_NAMESPACE = URI.create("http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.2.0");
-
     private Map<URI, URL> namespaces;
     private Map<URI, NamespaceHandler> handlers;
     private Schema schema;
@@ -54,9 +52,10 @@ public class SimpleNamespaceHandlerSet i
     public SimpleNamespaceHandlerSet() {
         this.namespaces = new LinkedHashMap<URI, URL>();
         this.handlers = new LinkedHashMap<URI, NamespaceHandler>();
-        addNamespace(EXT_1_2_NAMESPACE,
-                getClass().getResource("/org/apache/aries/blueprint/ext/impl/blueprint-ext-1.2.xsd"),
-                new ExtNamespaceHandler());
+        ExtNamespaceHandler ext = new ExtNamespaceHandler();
+        for (String uri : ExtNamespaceHandler.EXT_URIS) {
+            addNamespace(URI.create(uri), ext.getSchemaLocation(uri), ext);
+        }
     }
 
     public Set<URI> getNamespaces() {
@@ -76,12 +75,17 @@ public class SimpleNamespaceHandlerSet i
         return handlers.get(uri);
     }
 
+    @Override
+    public Schema getSchema(Map<String, String> locations) throws SAXException, IOException
{
+        return getSchema();
+    }
+
     public Schema getSchema() throws SAXException, IOException {
         if (schema == null) {
             final List<StreamSource> schemaSources = new ArrayList<StreamSource>();
             final List<InputStream> streams = new ArrayList<InputStream>();
             try {
-                InputStream is = getClass().getResourceAsStream("/org/apache/aries/blueprint/blueprint.xsd");
+                InputStream is = getClass().getResourceAsStream("/org/osgi/service/blueprint/blueprint.xsd");
                 streams.add(is);
                 schemaSources.add(new StreamSource(is));
                 for (URI uri : namespaces.keySet()) {

Modified: aries/trunk/blueprint/blueprint-noosgi/src/main/java/org/apache/aries/blueprint/ext/impl/ExtNamespaceHandler.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-noosgi/src/main/java/org/apache/aries/blueprint/ext/impl/ExtNamespaceHandler.java?rev=1824423&r1=1824422&r2=1824423&view=diff
==============================================================================
--- aries/trunk/blueprint/blueprint-noosgi/src/main/java/org/apache/aries/blueprint/ext/impl/ExtNamespaceHandler.java
(original)
+++ aries/trunk/blueprint/blueprint-noosgi/src/main/java/org/apache/aries/blueprint/ext/impl/ExtNamespaceHandler.java
Fri Feb 16 06:56:36 2018
@@ -18,24 +18,34 @@
  */
 package org.apache.aries.blueprint.ext.impl;
 
-import org.apache.aries.blueprint.ComponentDefinitionRegistry;
-import org.apache.aries.blueprint.ExtendedBeanMetadata;
-import org.apache.aries.blueprint.ExtendedReferenceListMetadata;
-import org.apache.aries.blueprint.ParserContext;
+import java.net.URL;
+import java.util.*;
+
+import org.apache.aries.blueprint.*;
+import org.apache.aries.blueprint.container.NullProxy;
 import org.apache.aries.blueprint.ext.AbstractPropertyPlaceholder;
 import org.apache.aries.blueprint.ext.PlaceholdersUtils;
 import org.apache.aries.blueprint.ext.PropertyPlaceholder;
-import org.apache.aries.blueprint.ext.evaluator.PropertyEvaluator;
-import org.apache.aries.blueprint.mutable.*;
+import org.apache.aries.blueprint.mutable.MutableBeanMetadata;
+import org.apache.aries.blueprint.mutable.MutableCollectionMetadata;
+import org.apache.aries.blueprint.mutable.MutableComponentMetadata;
+import org.apache.aries.blueprint.mutable.MutableIdRefMetadata;
+import org.apache.aries.blueprint.mutable.MutableMapMetadata;
+import org.apache.aries.blueprint.mutable.MutableRefMetadata;
+import org.apache.aries.blueprint.mutable.MutableReferenceMetadata;
+import org.apache.aries.blueprint.mutable.MutableServiceReferenceMetadata;
+import org.apache.aries.blueprint.mutable.MutableValueMetadata;
 import org.osgi.service.blueprint.container.ComponentDefinitionException;
 import org.osgi.service.blueprint.reflect.*;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.w3c.dom.*;
+import org.w3c.dom.Attr;
 import org.w3c.dom.CharacterData;
-
-import java.net.URL;
-import java.util.*;
+import org.w3c.dom.Comment;
+import org.w3c.dom.Element;
+import org.w3c.dom.EntityReference;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
 
 /**
  * A namespace handler for Aries blueprint extensions
@@ -48,7 +58,11 @@ public class ExtNamespaceHandler impleme
     public static final String BLUEPRINT_EXT_NAMESPACE_V1_0 = "http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0";
     public static final String BLUEPRINT_EXT_NAMESPACE_V1_1 = "http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.1.0";
     public static final String BLUEPRINT_EXT_NAMESPACE_V1_2 = "http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.2.0";
-    
+    public static final String BLUEPRINT_EXT_NAMESPACE_V1_3 = "http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.3.0";
+    public static final String BLUEPRINT_EXT_NAMESPACE_V1_4 = "http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.4.0";
+    public static final String BLUEPRINT_EXT_NAMESPACE_V1_5 = "http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.5.0";
+    public static final String BLUEPRINT_EXT_NAMESPACE_V1_6 = "http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.6.0";
+
     public static final String PROPERTY_PLACEHOLDER_ELEMENT = "property-placeholder";
     public static final String DEFAULT_PROPERTIES_ELEMENT = "default-properties";
     public static final String PROPERTY_ELEMENT = "property";
@@ -58,6 +72,7 @@ public class ExtNamespaceHandler impleme
     public static final String ID_ATTRIBUTE = "id";
     public static final String PLACEHOLDER_PREFIX_ATTRIBUTE = "placeholder-prefix";
     public static final String PLACEHOLDER_SUFFIX_ATTRIBUTE = "placeholder-suffix";
+    public static final String PLACEHOLDER_NULL_VALUE_ATTRIBUTE = "null-value";
     public static final String DEFAULTS_REF_ATTRIBUTE = "defaults-ref";
     public static final String IGNORE_MISSING_LOCATIONS_ATTRIBUTE = "ignore-missing-locations";
     public static final String EVALUATOR_ATTRIBUTE = "evaluator";
@@ -74,25 +89,61 @@ public class ExtNamespaceHandler impleme
 
     public static final String ROLE_ATTRIBUTE = "role";
     public static final String ROLE_PROCESSOR = "processor";
-    
+
     public static final String FIELD_INJECTION_ATTRIBUTE = "field-injection";
-    
+
+    public static final String NON_STANDARD_SETTERS_ATTRIBUTE = "non-standard-setters";
+
     public static final String DEFAULT_REFERENCE_BEAN = "default";
 
+    public static final String FILTER_ATTRIBUTE = "filter";
+
+    public static final String ADDITIONAL_INTERFACES = "additional-interfaces";
+    public static final String INTERFACE_VALUE = "value";
+
+    public static final String BEAN = "bean";
+    public static final String REFERENCE = "reference";
+    public static final String ARGUMENT = "argument";
+
+    public static final String DAMPING_ATTRIBUTE = "damping";
+
+    public static final String DAMPING_RELUCTANT = "reluctant";
+    public static final String DAMPING_GREEDY = "greedy";
+
+    public static final String LIFECYCLE_ATTRIBUTE = "lifecycle";
+
+    public static final String LIFECYCLE_DYNAMIC = "dynamic";
+    public static final String LIFECYCLE_STATIC = "static";
+
+    public static final String RAW_CONVERSION_ATTRIBUTE = "raw-conversion";
+
+    public static final String NULL_PROXY_ELEMENT = "null-proxy";
+
+    public static final Set<String> EXT_URIS = Collections.unmodifiableSet(new LinkedHashSet<String>(Arrays.asList(
+            BLUEPRINT_EXT_NAMESPACE_V1_0,
+            BLUEPRINT_EXT_NAMESPACE_V1_1,
+            BLUEPRINT_EXT_NAMESPACE_V1_2,
+            BLUEPRINT_EXT_NAMESPACE_V1_3,
+            BLUEPRINT_EXT_NAMESPACE_V1_4,
+            BLUEPRINT_EXT_NAMESPACE_V1_5,
+            BLUEPRINT_EXT_NAMESPACE_V1_6)));
+
     private static final Logger LOGGER = LoggerFactory.getLogger(ExtNamespaceHandler.class);
 
     private int idCounter;
-    
+
     public URL getSchemaLocation(String namespace) {
-        if (BLUEPRINT_EXT_NAMESPACE_V1_0.equals(namespace)) {
-          return getClass().getResource("blueprint-ext.xsd");
-        } else if (BLUEPRINT_EXT_NAMESPACE_V1_1.equals(namespace)) {
-          return getClass().getResource("blueprint-ext-1.1.xsd");
-        } else if (BLUEPRINT_EXT_NAMESPACE_V1_2.equals(namespace)) {
-          return getClass().getResource("blueprint-ext-1.2.xsd");
-        } else {
-          return null;
+        if (isExtNamespace(namespace)) {
+            String v = namespace.substring("http://aries.apache.org/blueprint/xmlns/blueprint-ext/v".length());
+            return getClass().getResource("blueprint-ext-" + v + ".xsd");
+        } else if ("http://www.w3.org/XML/1998/namespace".equals(namespace)) {
+            return getClass().getResource("xml.xsd");
         }
+        return null;
+    }
+
+    public static boolean isExtNamespace(String e) {
+        return EXT_URIS.contains(e);
     }
 
     public Set<Class> getManagedClasses() {
@@ -105,6 +156,10 @@ public class ExtNamespaceHandler impleme
         LOGGER.debug("Parsing element {{}}{}", element.getNamespaceURI(), element.getLocalName());
         if (nodeNameEquals(element, PROPERTY_PLACEHOLDER_ELEMENT)) {
             return parsePropertyPlaceholder(context, element);
+        } else if (nodeNameEquals(element, BEAN)) {
+            return context.parseElement(BeanMetadata.class, context.getEnclosingComponent(),
element);
+        } else if (nodeNameEquals(element, NULL_PROXY_ELEMENT)) {
+            return parseNullProxy(element, context);
         } else {
             throw new ComponentDefinitionException("Unsupported element: " + element.getNodeName());
         }
@@ -117,13 +172,55 @@ public class ExtNamespaceHandler impleme
             return decorateRole(node, component, context);
         } else if (node instanceof Attr && nodeNameEquals(node, FIELD_INJECTION_ATTRIBUTE))
{
             return decorateFieldInjection(node, component, context);
+        } else if (node instanceof Attr && nodeNameEquals(node, NON_STANDARD_SETTERS_ATTRIBUTE))
{
+            return decorateNonStandardSetters(node, component, context);
         } else if (node instanceof Attr && nodeNameEquals(node, DEFAULT_REFERENCE_BEAN))
{
             return decorateDefaultBean(node, component, context);
+        } else if (node instanceof Attr && nodeNameEquals(node, FILTER_ATTRIBUTE))
{
+            return decorateFilter(node, component, context);
+        } else if (node instanceof Element && nodeNameEquals(node, ADDITIONAL_INTERFACES))
{
+            return decorateAdditionalInterfaces(node, component, context);
+        } else if (node instanceof Element && nodeNameEquals(node, BEAN)) {
+            return context.parseElement(BeanMetadata.class, component, (Element) node);
+        } else if (node instanceof Attr && nodeNameEquals(node, DAMPING_ATTRIBUTE))
{
+            return decorateDamping(node, component, context);
+        } else if (node instanceof Attr && nodeNameEquals(node, LIFECYCLE_ATTRIBUTE))
{
+            return decorateLifecycle(node, component, context);
+        } else if (node instanceof Attr && nodeNameEquals(node, RAW_CONVERSION_ATTRIBUTE))
{
+            return decorateRawConversion(node, component, context);
+        } else if (node instanceof Element && nodeNameEquals(node, ARGUMENT)) {
+            return parseBeanArgument(context, (Element) node);
         } else {
             throw new ComponentDefinitionException("Unsupported node: " + node.getNodeName());
         }
     }
-    
+
+    private ComponentMetadata parseNullProxy(Element element, ParserContext context) {
+        MutableBeanMetadata mb = context.createMetadata(MutableBeanMetadata.class);
+        mb.setRuntimeClass(NullProxy.class);
+        mb.addArgument(createRef(context, "blueprintContainer"), null, -1);
+        mb.setId(element.hasAttribute(ID_ATTRIBUTE) ? element.getAttribute(ID_ATTRIBUTE)
: "null-proxy");
+        return mb;
+    }
+
+    private ComponentMetadata decorateAdditionalInterfaces(Node node, ComponentMetadata component,
+                                                           ParserContext context) {
+        if (!(component instanceof MutableReferenceMetadata)) {
+            throw new ComponentDefinitionException("Expected an instanceof MutableReferenceMetadata");
+        }
+        MutableReferenceMetadata mrm = (MutableReferenceMetadata) component;
+        List<String> list = new ArrayList<String>();
+        Node nd = node.getFirstChild();
+        while (nd != null) {
+            if (nd instanceof Element && nodeNameEquals(nd, INTERFACE_VALUE)) {
+                list.add(((Element) nd).getTextContent());
+            }
+            nd = nd.getNextSibling();
+        }
+        mrm.setExtraInterfaces(list);
+        return component;
+    }
+
     private ComponentMetadata decorateDefaultBean(Node node,
         ComponentMetadata component, ParserContext context) 
     {
@@ -154,6 +251,20 @@ public class ExtNamespaceHandler impleme
         return component;
     }
 
+    private ComponentMetadata decorateNonStandardSetters(Node node, ComponentMetadata component,
ParserContext context) {
+        if (!(component instanceof BeanMetadata)) {
+            throw new ComponentDefinitionException("Attribute " + node.getNodeName() + "
can only be used on a <bean> element");
+        }
+
+        if (!(component instanceof MutableBeanMetadata)) {
+            throw new ComponentDefinitionException("Expected an instanceof MutableBeanMetadata");
+        }
+
+        String value = ((Attr) node).getValue();
+        ((MutableBeanMetadata) component).setNonStandardSetters("true".equals(value) || "1".equals(value));
+        return component;
+    }
+
     private ComponentMetadata decorateRole(Node node, ComponentMetadata component, ParserContext
context) {
         if (!(component instanceof BeanMetadata)) {
             throw new ComponentDefinitionException("Attribute " + node.getNodeName() + "
can only be used on a <bean> element");
@@ -203,6 +314,96 @@ public class ExtNamespaceHandler impleme
         return component;
     }
 
+    private ComponentMetadata decorateFilter(Node node,
+                                             ComponentMetadata component, ParserContext context)
+    {
+        if (!(component instanceof ServiceReferenceMetadata)) {
+            throw new ComponentDefinitionException("Attribute " + node.getNodeName() + "
can only be used on a <reference> or <reference-list> element");
+        }
+
+        if (!(component instanceof MutableServiceReferenceMetadata)) {
+            throw new ComponentDefinitionException("Expected an instanceof MutableServiceReferenceMetadata");
+        }
+
+        String value = ((Attr) node).getValue();
+        ((MutableServiceReferenceMetadata) component).setExtendedFilter(createValue(context,
value));
+        return component;
+    }
+
+    private ComponentMetadata decorateDamping(Node node, ComponentMetadata component, ParserContext
context) {
+        if (!(component instanceof ReferenceMetadata)) {
+            throw new ComponentDefinitionException("Attribute " + node.getNodeName() + "
can only be used on a <reference> element");
+        }
+        if (!(component instanceof MutableReferenceMetadata)) {
+            throw new ComponentDefinitionException("Expected an instance of MutableReferenceMetadata");
+        }
+        int damping = ExtendedReferenceMetadata.DAMPING_GREEDY;
+        String value = ((Attr) node).getValue();
+        if (DAMPING_RELUCTANT.equals(value)) {
+            damping = ExtendedReferenceMetadata.DAMPING_RELUCTANT;
+        } else if (!DAMPING_GREEDY.equals(value)) {
+            throw new ComponentDefinitionException("Unknown damping method: " + value);
+        }
+        ((MutableReferenceMetadata) component).setDamping(damping);
+        return component;
+    }
+
+    private ComponentMetadata decorateLifecycle(Node node, ComponentMetadata component, ParserContext
context) {
+        if (!(component instanceof ReferenceMetadata)) {
+            throw new ComponentDefinitionException("Attribute " + node.getNodeName() + "
can only be used on a <reference> element");
+        }
+        if (!(component instanceof MutableReferenceMetadata)) {
+            throw new ComponentDefinitionException("Expected an instance of MutableReferenceMetadata");
+        }
+        int lifecycle = ExtendedReferenceMetadata.LIFECYCLE_DYNAMIC;
+        String value = ((Attr) node).getValue();
+        if (LIFECYCLE_STATIC.equals(value)) {
+            lifecycle = ExtendedReferenceMetadata.LIFECYCLE_STATIC;
+        } else if (!LIFECYCLE_DYNAMIC.equals(value)) {
+            throw new ComponentDefinitionException("Unknown lifecycle method: " + value);
+        }
+        ((MutableReferenceMetadata) component).setLifecycle(lifecycle);
+        return component;
+    }
+
+    private ComponentMetadata decorateRawConversion(Node node, ComponentMetadata component,
ParserContext context) {
+        if (!(component instanceof BeanMetadata)) {
+            throw new ComponentDefinitionException("Attribute " + node.getNodeName() + "
can only be used on a <bean> element");
+        }
+
+        if (!(component instanceof MutableBeanMetadata)) {
+            throw new ComponentDefinitionException("Expected an instanceof MutableBeanMetadata");
+        }
+
+        String value = ((Attr) node).getValue();
+        ((MutableBeanMetadata) component).setRawConversion("true".equals(value) || "1".equals(value));
+        return component;
+    }
+
+    private ComponentMetadata parseBeanArgument(ParserContext context, Element element) {
+        MutableBeanMetadata mbm = (MutableBeanMetadata) context.getEnclosingComponent();
+        BeanArgument arg = context.parseElement(BeanArgument.class, mbm, element);
+        int index = 0;
+        for (Node node = element.getPreviousSibling(); node != null; node = node.getPreviousSibling())
{
+            if (nodeNameEquals(node, ARGUMENT)) {
+                index++;
+            }
+        }
+        List<BeanArgument> args = new ArrayList<BeanArgument>(mbm.getArguments());
+        if (index == args.size()) {
+            mbm.addArgument(arg);
+        } else {
+            for (BeanArgument ba : args) {
+                mbm.removeArgument(ba);
+            }
+            args.add(index, arg);
+            for (BeanArgument ba : args) {
+                mbm.addArgument(ba);
+            }
+        }
+        return mbm;
+    }
+
     private Metadata parsePropertyPlaceholder(ParserContext context, Element element) {
         MutableBeanMetadata metadata = context.createMetadata(MutableBeanMetadata.class);
         metadata.setProcessor(true);
@@ -219,6 +420,12 @@ public class ExtNamespaceHandler impleme
                                     : "}";
         metadata.addProperty("placeholderSuffix", createValue(context, suffix));
         metadata.addProperty("blueprintContainer", createRef(context, "blueprintContainer"));
+        String nullValue = element.hasAttribute(PLACEHOLDER_NULL_VALUE_ATTRIBUTE)
+                ? element.getAttribute(PLACEHOLDER_NULL_VALUE_ATTRIBUTE)
+                : null;
+        if (nullValue != null) {
+            metadata.addProperty("nullValue", createValue(context, nullValue));
+        }
         String defaultsRef = element.hasAttribute(DEFAULTS_REF_ATTRIBUTE) ? element.getAttribute(DEFAULTS_REF_ATTRIBUTE)
: null;
         if (defaultsRef != null) {
             metadata.addProperty("defaultProperties", createRef(context, defaultsRef));
@@ -242,9 +449,7 @@ public class ExtNamespaceHandler impleme
             Node node = nl.item(i);
             if (node instanceof Element) {
                 Element e = (Element) node;
-                if (BLUEPRINT_EXT_NAMESPACE_V1_0.equals(e.getNamespaceURI())
-                        || BLUEPRINT_EXT_NAMESPACE_V1_1.equals(e.getNamespaceURI())
-                        || BLUEPRINT_EXT_NAMESPACE_V1_2.equals(e.getNamespaceURI())) {
+                if (isExtNamespace(e.getNamespaceURI())) {
                     if (nodeNameEquals(e, DEFAULT_PROPERTIES_ELEMENT)) {
                         if (defaultsRef != null) {
                             throw new ComponentDefinitionException("Only one of " + DEFAULTS_REF_ATTRIBUTE
+ " attribute or " + DEFAULT_PROPERTIES_ELEMENT + " element is allowed");
@@ -261,9 +466,9 @@ public class ExtNamespaceHandler impleme
             metadata.addProperty("locations", createList(context, locations));
         }
 
-        boolean result = validatePlaceholder(metadata, context.getComponentDefinitionRegistry());
+        validatePlaceholder(metadata, context.getComponentDefinitionRegistry());
 
-        return result ? metadata : null;
+        return metadata;
     }
 
     private boolean validatePlaceholder(MutableBeanMetadata metadata, ComponentDefinitionRegistry
registry) {
@@ -346,7 +551,6 @@ public class ExtNamespaceHandler impleme
         return null;
     }
 
-
     private Metadata parseDefaultProperties(ParserContext context, MutableBeanMetadata enclosingComponent,
Element element) {
         MutableMapMetadata props = context.createMetadata(MutableMapMetadata.class);
         NodeList nl = element.getChildNodes();
@@ -354,9 +558,7 @@ public class ExtNamespaceHandler impleme
             Node node = nl.item(i);
             if (node instanceof Element) {
                 Element e = (Element) node;
-                if (BLUEPRINT_EXT_NAMESPACE_V1_0.equals(e.getNamespaceURI())
-                        || BLUEPRINT_EXT_NAMESPACE_V1_1.equals(e.getNamespaceURI())
-                        || BLUEPRINT_EXT_NAMESPACE_V1_2.equals(e.getNamespaceURI())) {
+                if (isExtNamespace(e.getNamespaceURI())) {
                     if (nodeNameEquals(e, PROPERTY_ELEMENT)) {
                         BeanProperty prop = context.parseElement(BeanProperty.class, enclosingComponent,
e);
                         props.addEntry(createValue(context, prop.getName(), String.class.getName()),
prop.getValue());



Mime
View raw message