Author: gnodet
Date: Tue Apr 12 09:05:33 2016
New Revision: 1738740
URL: http://svn.apache.org/viewvc?rev=1738740&view=rev
Log:
[ARIES-1503] attempt to fix current code
Added:
aries/trunk/blueprint/blueprint-testbundlea/src/main/java/org/apache/aries/blueprint/testbundlea/NSHandlerHeight.java
aries/trunk/blueprint/blueprint-testbundlea/src/main/resources/org/apache/aries/blueprint/testbundlea/nshandlerheight.xsd
aries/trunk/blueprint/blueprint-testbundlea/src/main/resources/org/apache/aries/blueprint/testbundlea/nshandlerheightinc2.xsd
aries/trunk/blueprint/blueprint-testbundlea/src/main/resources/org/apache/aries/blueprint/testbundlea/nshandlerheightincluded.xsd
Modified:
aries/trunk/blueprint/blueprint-cm/pom.xml
aries/trunk/blueprint/blueprint-cm/src/main/java/org/apache/aries/blueprint/compendium/cm/CmNamespaceHandler.java
aries/trunk/blueprint/blueprint-cm/src/main/resources/OSGI-INF/blueprint/blueprint-cm.xml
aries/trunk/blueprint/blueprint-core/pom.xml
aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/namespace/NamespaceHandlerRegistryImpl.java
aries/trunk/blueprint/blueprint-itests/pom.xml
aries/trunk/blueprint/blueprint-parser/src/main/java/org/apache/aries/blueprint/NamespaceHandler2.java
aries/trunk/blueprint/blueprint-spring-extender/pom.xml
aries/trunk/blueprint/blueprint-spring/pom.xml
aries/trunk/blueprint/blueprint-spring/src/main/java/org/apache/aries/blueprint/spring/BlueprintNamespaceHandler.java
aries/trunk/blueprint/blueprint-testbundlea/pom.xml
aries/trunk/blueprint/blueprint-testbundlea/src/main/resources/OSGI-INF/blueprint/config.xml
aries/trunk/blueprint/blueprint-testbundleb/pom.xml
aries/trunk/blueprint/blueprint-testbundleb/src/main/resources/OSGI-INF/blueprint/config.xml
Modified: aries/trunk/blueprint/blueprint-cm/pom.xml
URL:
http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-cm/pom.xml?rev=1738740&r1=1738739&r2=1738740&view=diff
==============================================================================
--- aries/trunk/blueprint/blueprint-cm/pom.xml (original)
+++ aries/trunk/blueprint/blueprint-cm/pom.xml Tue Apr 12 09:05:33 2016
@@ -56,8 +56,8 @@
</aries.osgi.private.pkg>
<blueprint.api.version>1.0.0</blueprint.api.version>
- <blueprint.core.version>1.6.1</blueprint.core.version>
- <blueprint.parser.version>1.5.0</blueprint.parser.version>
+ <blueprint.core.version>1.6.1-SNAPSHOT</blueprint.core.version>
+ <blueprint.parser.version>1.4.0</blueprint.parser.version>
<lastReleaseVersion>1.0.8</lastReleaseVersion>
</properties>
@@ -67,7 +67,7 @@
<properties>
<blueprint.api.version>1.0.1</blueprint.api.version>
<blueprint.core.version>1.6.1-SNAPSHOT</blueprint.core.version>
-
<blueprint.parser.version>1.5.0-SNAPSHOT</blueprint.parser.version>
+ <blueprint.parser.version>1.4.0</blueprint.parser.version>
</properties>
</profile>
</profiles>
Modified:
aries/trunk/blueprint/blueprint-cm/src/main/java/org/apache/aries/blueprint/compendium/cm/CmNamespaceHandler.java
URL:
http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-cm/src/main/java/org/apache/aries/blueprint/compendium/cm/CmNamespaceHandler.java?rev=1738740&r1=1738739&r2=1738740&view=diff
==============================================================================
---
aries/trunk/blueprint/blueprint-cm/src/main/java/org/apache/aries/blueprint/compendium/cm/CmNamespaceHandler.java
(original)
+++
aries/trunk/blueprint/blueprint-cm/src/main/java/org/apache/aries/blueprint/compendium/cm/CmNamespaceHandler.java
Tue Apr 12 09:05:33 2016
@@ -29,7 +29,6 @@ import java.util.Set;
import org.apache.aries.blueprint.ComponentDefinitionRegistry;
import org.apache.aries.blueprint.NamespaceHandler;
-import org.apache.aries.blueprint.NamespaceHandler2;
import org.apache.aries.blueprint.ParserContext;
import org.apache.aries.blueprint.ext.PlaceholdersUtils;
import org.apache.aries.blueprint.mutable.MutableBeanMetadata;
@@ -78,7 +77,7 @@ import org.w3c.dom.NodeList;
*
* @version $Rev$, $Date$
*/
-public class CmNamespaceHandler implements NamespaceHandler2 {
+public class CmNamespaceHandler implements NamespaceHandler {
public static final String BLUEPRINT_NAMESPACE =
"http://www.osgi.org/xmlns/blueprint/v1.0.0";
public static final String BLUEPRINT_CM_NAMESPACE_1_0 =
"http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0";
@@ -154,16 +153,6 @@ public class CmNamespaceHandler implemen
CmNamespaceHandler.configAdmin = configAdmin;
}
- public boolean usePsvi() {
- return false;
- }
-
- public boolean mayResolve(String namespace) {
- return namespace != null
- &&
(namespace.startsWith("http://aries.apache.org/blueprint/xmlns/blueprint-cm")
- ||
namespace.startsWith("http://aries.apache.org/blueprint/xmlns/blueprint-ext"));
- }
-
public URL getSchemaLocation(String namespace) {
if (BLUEPRINT_CM_NAMESPACE_1_3.equals(namespace)) {
return getClass().getResource("blueprint-cm-1.3.0.xsd");
Modified:
aries/trunk/blueprint/blueprint-cm/src/main/resources/OSGI-INF/blueprint/blueprint-cm.xml
URL:
http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-cm/src/main/resources/OSGI-INF/blueprint/blueprint-cm.xml?rev=1738740&r1=1738739&r2=1738740&view=diff
==============================================================================
---
aries/trunk/blueprint/blueprint-cm/src/main/resources/OSGI-INF/blueprint/blueprint-cm.xml
(original)
+++
aries/trunk/blueprint/blueprint-cm/src/main/resources/OSGI-INF/blueprint/blueprint-cm.xml
Tue Apr 12 09:05:33 2016
@@ -24,7 +24,6 @@
<service ref="CmNamespaceHandler">
<interfaces>
<value>org.apache.aries.blueprint.NamespaceHandler</value>
- <value>org.apache.aries.blueprint.NamespaceHandler2</value>
</interfaces>
<service-properties>
<entry key="osgi.service.blueprint.namespace"
value="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0"/>
@@ -33,7 +32,6 @@
<service ref="CmNamespaceHandler">
<interfaces>
<value>org.apache.aries.blueprint.NamespaceHandler</value>
- <value>org.apache.aries.blueprint.NamespaceHandler2</value>
</interfaces>
<service-properties>
<entry key="osgi.service.blueprint.namespace"
value="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"/>
@@ -42,7 +40,6 @@
<service ref="CmNamespaceHandler">
<interfaces>
<value>org.apache.aries.blueprint.NamespaceHandler</value>
- <value>org.apache.aries.blueprint.NamespaceHandler2</value>
</interfaces>
<service-properties>
<entry key="osgi.service.blueprint.namespace"
value="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.2.0"/>
@@ -51,7 +48,6 @@
<service ref="CmNamespaceHandler">
<interfaces>
<value>org.apache.aries.blueprint.NamespaceHandler</value>
- <value>org.apache.aries.blueprint.NamespaceHandler2</value>
</interfaces>
<service-properties>
<entry key="osgi.service.blueprint.namespace"
value="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.3.0"/>
Modified: aries/trunk/blueprint/blueprint-core/pom.xml
URL:
http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-core/pom.xml?rev=1738740&r1=1738739&r2=1738740&view=diff
==============================================================================
--- aries/trunk/blueprint/blueprint-core/pom.xml (original)
+++ aries/trunk/blueprint/blueprint-core/pom.xml Tue Apr 12 09:05:33 2016
@@ -91,12 +91,12 @@
</aries.osgi.include.resource>
<blueprint.annotation.api.version>1.0.0</blueprint.annotation.api.version>
<blueprint.api.version>1.0.0</blueprint.api.version>
- <blueprint.parser.version>1.5.0-SNAPSHOT</blueprint.parser.version>
+ <blueprint.parser.version>1.4.0</blueprint.parser.version>
<proxy.api.version>1.0.0</proxy.api.version>
<proxy.impl.version>1.0.3</proxy.impl.version>
<quiesce.api.version>1.0.0</quiesce.api.version>
<util.version>1.0.0</util.version>
- <lastReleaseVersion>1.5.0</lastReleaseVersion>
+ <lastReleaseVersion>1.6.0</lastReleaseVersion>
</properties>
<profiles>
@@ -105,7 +105,7 @@
<properties>
<blueprint.annotation.api.version>1.0.1</blueprint.annotation.api.version>
<blueprint.api.version>1.0.1</blueprint.api.version>
-
<blueprint.parser.version>1.5.0-SNAPSHOT</blueprint.parser.version>
+ <blueprint.parser.version>1.4.0</blueprint.parser.version>
<proxy.api.version>1.0.1</proxy.api.version>
<proxy.impl.version>1.0.1</proxy.impl.version>
<quiesce.api.version>1.0.0</quiesce.api.version>
Modified:
aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/namespace/NamespaceHandlerRegistryImpl.java
URL:
http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/namespace/NamespaceHandlerRegistryImpl.java?rev=1738740&r1=1738739&r2=1738740&view=diff
==============================================================================
---
aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/namespace/NamespaceHandlerRegistryImpl.java
(original)
+++
aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/namespace/NamespaceHandlerRegistryImpl.java
Tue Apr 12 09:05:33 2016
@@ -51,7 +51,6 @@ import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import org.apache.aries.blueprint.NamespaceHandler;
-import org.apache.aries.blueprint.NamespaceHandler2;
import org.apache.aries.blueprint.container.NamespaceHandlerRegistry;
import org.apache.aries.blueprint.parser.NamespaceHandlerSet;
import org.osgi.framework.Bundle;
@@ -75,8 +74,6 @@ import org.xml.sax.SAXException;
*/
public class NamespaceHandlerRegistryImpl implements NamespaceHandlerRegistry,
ServiceTrackerCustomizer {
- public static final URI BLUEPRINT_NAMESPACE =
URI.create("http://www.osgi.org/xmlns/blueprint/v1.0.0");
-
public static final String NAMESPACE = "osgi.service.blueprint.namespace";
private static final Logger LOGGER =
LoggerFactory.getLogger(NamespaceHandlerRegistryImpl.class);
@@ -330,8 +327,10 @@ public class NamespaceHandlerRegistryImp
Properties schemaMap,
Map<String, String> locations) throws
IOException, SAXException {
final List<StreamSource> schemaSources = new ArrayList<StreamSource>();
+ final Map<String, URI> urlToNamespace = new HashMap<String, URI>();
try {
schemaSources.add(new
StreamSource(getClass().getResourceAsStream("/org/apache/aries/blueprint/blueprint.xsd")));
+ schemaSources.add(new
StreamSource(getClass().getResourceAsStream("/org/apache/aries/blueprint/ext/impl/xml.xsd")));
// Create a schema for all namespaces known at this point
// It will speed things as it can be reused for all other
blueprint containers
for (URI ns : handlers.keySet()) {
@@ -345,6 +344,7 @@ public class NamespaceHandlerRegistryImp
if (url == null) {
LOGGER.warn("No URL is defined for schema " + ns + ". This
schema will not be validated");
} else {
+ urlToNamespace.put(url.toExternalForm(), ns);
schemaSources.add(new StreamSource(url.openStream(),
url.toExternalForm()));
}
}
@@ -357,7 +357,7 @@ public class NamespaceHandlerRegistryImp
}
}
synchronized (schemaFactory) {
- schemaFactory.setResourceResolver(new
BundleResourceResolver(handlers, schemaMap, bundle, schemaSources));
+ schemaFactory.setResourceResolver(new
BundleResourceResolver(handlers, schemaMap, bundle, schemaSources,
urlToNamespace));
return schemaFactory.newSchema(schemaSources.toArray(new
Source[schemaSources.size()]));
}
} finally {
@@ -377,23 +377,28 @@ public class NamespaceHandlerRegistryImp
}
}
- private class BundleResourceResolver implements LSResourceResolver {
+ private static class BundleResourceResolver implements LSResourceResolver {
private final Map<URI, NamespaceHandler> handlers;
private final Properties schemaMap;
private final Bundle bundle;
private final List<StreamSource> schemaSources;
+ private final Map<String, URI> urlToNamespace;
- public BundleResourceResolver(Map<URI, NamespaceHandler> handlers,
Properties schemaMap, Bundle bundle, List<StreamSource> schemaSources) {
+ public BundleResourceResolver(Map<URI, NamespaceHandler> handlers,
Properties schemaMap, Bundle bundle, List<StreamSource> schemaSources,
Map<String, URI> urlToNamespace) {
this.handlers = handlers;
this.schemaMap = schemaMap;
this.bundle = bundle;
this.schemaSources = schemaSources;
+ this.urlToNamespace = urlToNamespace;
}
public LSInput resolveResource(String type,
final String namespaceURI,
final String publicId,
- String systemId, String baseURI) {
+ String systemId,
+ String baseURI) {
+ URI nsUri = namespaceURI != null ? URI.create(namespaceURI) : null;
+ // Use provided schema map to find the resource
String loc = null;
if (namespaceURI != null) {
loc = schemaMap.getProperty(namespaceURI);
@@ -407,68 +412,65 @@ public class NamespaceHandlerRegistryImp
if (loc != null) {
URL url = bundle.getResource(loc);
if (url != null) {
- try {
- StreamSource source
- = new StreamSource(url.openStream(),
url.toExternalForm());
- schemaSources.add(source);
- return new SourceLSInput(source, publicId, url);
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
+ return createLSInput(url, nsUri);
}
}
- URI uri = URI.create(namespaceURI);
- Set<NamespaceHandler> hs =
NamespaceHandlerRegistryImpl.this.handlers.get(uri);
- // first check registered handlers
- if (hs != null) {
- for (NamespaceHandler h : hs) {
- URL url = h.getSchemaLocation(namespaceURI);
- if (url != null) {
- return createLSInput(publicId, systemId, url);
- }
+ // Support include-relative-path case
+ if (baseURI != null && systemId != null &&
!systemId.matches("^[a-z][-+.0-9a-z]*:.*")) {
+ URL url;
+ try {
+ url = new URL(new URL(baseURI), systemId);
+ } catch (IOException e) {
+ throw new RuntimeException(e);
}
+ return createLSInput(url, nsUri);
}
- // then check if some handler may resolve the namespace
- for (NamespaceHandler h : handlers.values()) {
- if (h instanceof NamespaceHandler2 && ((NamespaceHandler2)
h).mayResolve(namespaceURI)) {
- URL url = h.getSchemaLocation(namespaceURI);
- if (url != null) {
- return createLSInput(publicId, systemId, url);
-
+ if (namespaceURI != null) {
+ String id = systemId != null ? systemId : namespaceURI;
+ // This is a namespace with a known handler
+ if (handlers.containsKey(nsUri)) {
+ NamespaceHandler h = handlers.get(nsUri);
+ if (h != null) {
+ URL url = h.getSchemaLocation(id);
+ if (url != null) {
+ return createLSInput(url, nsUri);
+ }
+ }
+ }
+ // This is a resource loaded from a schema
+ if (baseURI != null && urlToNamespace.containsKey(baseURI)) {
+ NamespaceHandler h =
handlers.get(urlToNamespace.get(baseURI));
+ if (h != null) {
+ URL url = h.getSchemaLocation(id);
+ if (url != null) {
+ return createLSInput(url, nsUri);
+ }
}
}
}
return null;
}
- private LSInput createLSInput(String publicId, String systemId, URL
url) {
- // handling include-relative-path case
- if (systemId != null &&
!systemId.matches("^[a-z][-+.0-9a-z]*:.*")) {
- try {
- url = new URL(url, systemId);
- } catch (Exception e) {
- // ignore and use the given systemId
- }
- }
+ private LSInput createLSInput(URL url, URI nsUri) {
try {
- final StreamSource source = new StreamSource(url.openStream(),
url.toExternalForm());
+ String systemId = url.toExternalForm();
+ final StreamSource source = new StreamSource(url.openStream(),
systemId);
schemaSources.add(source);
- return new SourceLSInput(source, publicId, url);
+ if (nsUri != null) {
+ urlToNamespace.put(systemId, nsUri);
+ }
+ return new SourceLSInput(source);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}
- private class SourceLSInput implements LSInput {
+ private static class SourceLSInput implements LSInput {
private final StreamSource source;
- private final URL systemId;
- private final String publicId;
- public SourceLSInput(StreamSource source, String publicId, URL
systemId) {
+ public SourceLSInput(StreamSource source) {
this.source = source;
- this.publicId = publicId;
- this.systemId = systemId;
}
public Reader getCharacterStream() {
@@ -493,14 +495,14 @@ public class NamespaceHandlerRegistryImp
}
public String getSystemId() {
- return systemId.toExternalForm();
+ return source.getSystemId();
}
public void setSystemId(String systemId) {
}
public String getPublicId() {
- return publicId;
+ return null;
}
public void setPublicId(String publicId) {
Modified: aries/trunk/blueprint/blueprint-itests/pom.xml
URL:
http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-itests/pom.xml?rev=1738740&r1=1738739&r2=1738740&view=diff
==============================================================================
--- aries/trunk/blueprint/blueprint-itests/pom.xml (original)
+++ aries/trunk/blueprint/blueprint-itests/pom.xml Tue Apr 12 09:05:33 2016
@@ -67,7 +67,7 @@
<dependency>
<groupId>org.apache.aries.blueprint</groupId>
<artifactId>blueprint-parser</artifactId>
- <version>1.5.0-SNAPSHOT</version>
+ <version>1.4.0</version>
</dependency>
<dependency>
<groupId>org.apache.aries.blueprint</groupId>
@@ -188,7 +188,7 @@
<groupId>org.apache.aries.blueprint</groupId>
<artifactId>org.apache.aries.blueprint.testbundlea</artifactId>
<scope>test</scope>
- <version>1.0.1-SNAPSHOT</version>
+ <version>1.1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.aries.blueprint</groupId>
Modified:
aries/trunk/blueprint/blueprint-parser/src/main/java/org/apache/aries/blueprint/NamespaceHandler2.java
URL:
http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-parser/src/main/java/org/apache/aries/blueprint/NamespaceHandler2.java?rev=1738740&r1=1738739&r2=1738740&view=diff
==============================================================================
---
aries/trunk/blueprint/blueprint-parser/src/main/java/org/apache/aries/blueprint/NamespaceHandler2.java
(original)
+++
aries/trunk/blueprint/blueprint-parser/src/main/java/org/apache/aries/blueprint/NamespaceHandler2.java
Tue Apr 12 09:05:33 2016
@@ -28,13 +28,4 @@ public interface NamespaceHandler2 exten
*/
boolean usePsvi();
- /**
- * <p>A hint for a registry of handlers that this handler actually may
resolve given namespace
- * and {@link NamespaceHandler#getSchemaLocation(String) return a location
for XSD resource} for it.</p>
- * <p>Some handlers return <em>some</em> XSD resource when asked for
location of unknown namespace</p>
- * @param namespace
- * @return
- */
- boolean mayResolve(String namespace);
-
}
Modified: aries/trunk/blueprint/blueprint-spring-extender/pom.xml
URL:
http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-spring-extender/pom.xml?rev=1738740&r1=1738739&r2=1738740&view=diff
==============================================================================
--- aries/trunk/blueprint/blueprint-spring-extender/pom.xml (original)
+++ aries/trunk/blueprint/blueprint-spring-extender/pom.xml Tue Apr 12 09:05:33
2016
@@ -59,7 +59,7 @@
org.apache.aries.blueprint.spring.extender.Activator
</aries.osgi.activator>
<blueprint.api.version>1.0.0</blueprint.api.version>
- <blueprint.core.version>1.6.0-SNAPSHOT</blueprint.core.version>
+ <blueprint.core.version>1.6.0</blueprint.core.version>
<blueprint.parser.version>1.5.0-SNAPSHOT</blueprint.parser.version>
<!--
<lastReleaseVersion>1.0.4</lastReleaseVersion>
@@ -71,7 +71,7 @@
<id>dev</id>
<properties>
<blueprint.api.version>1.0.1</blueprint.api.version>
- <blueprint.core.version>1.6.0-SNAPSHOT</blueprint.core.version>
+ <blueprint.core.version>1.7.0-SNAPSHOT</blueprint.core.version>
<blueprint.parser.version>1.5.0-SNAPSHOT</blueprint.parser.version>
</properties>
</profile>
Modified: aries/trunk/blueprint/blueprint-spring/pom.xml
URL:
http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-spring/pom.xml?rev=1738740&r1=1738739&r2=1738740&view=diff
==============================================================================
--- aries/trunk/blueprint/blueprint-spring/pom.xml (original)
+++ aries/trunk/blueprint/blueprint-spring/pom.xml Tue Apr 12 09:05:33 2016
@@ -60,7 +60,7 @@
</aries.osgi.activator>
<blueprint.api.version>1.0.0</blueprint.api.version>
<blueprint.core.version>1.6.1-SNAPSHOT</blueprint.core.version>
- <blueprint.parser.version>1.5.0-SNAPSHOT</blueprint.parser.version>
+ <blueprint.parser.version>1.4.0</blueprint.parser.version>
<!--
<lastReleaseVersion>1.0.4</lastReleaseVersion>
-->
@@ -71,7 +71,7 @@
<id>dev</id>
<properties>
<blueprint.api.version>1.0.1</blueprint.api.version>
- <blueprint.core.version>1.6.1-SNAPSHOT</blueprint.core.version>
+ <blueprint.core.version>1.7.0-SNAPSHOT</blueprint.core.version>
<blueprint.parser.version>1.5.0-SNAPSHOT</blueprint.parser.version>
</properties>
</profile>
Modified:
aries/trunk/blueprint/blueprint-spring/src/main/java/org/apache/aries/blueprint/spring/BlueprintNamespaceHandler.java
URL:
http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-spring/src/main/java/org/apache/aries/blueprint/spring/BlueprintNamespaceHandler.java?rev=1738740&r1=1738739&r2=1738740&view=diff
==============================================================================
---
aries/trunk/blueprint/blueprint-spring/src/main/java/org/apache/aries/blueprint/spring/BlueprintNamespaceHandler.java
(original)
+++
aries/trunk/blueprint/blueprint-spring/src/main/java/org/apache/aries/blueprint/spring/BlueprintNamespaceHandler.java
Tue Apr 12 09:05:33 2016
@@ -22,6 +22,7 @@ import java.util.Properties;
import java.util.Set;
import org.apache.aries.blueprint.ComponentDefinitionRegistry;
+import org.apache.aries.blueprint.NamespaceHandler;
import org.apache.aries.blueprint.NamespaceHandler2;
import org.apache.aries.blueprint.ParserContext;
import org.apache.aries.blueprint.PassThroughMetadata;
@@ -55,7 +56,7 @@ import org.w3c.dom.Node;
/**
* Blueprint NamespaceHandler wrapper for a spring NamespaceHandler
*/
-public class BlueprintNamespaceHandler implements NamespaceHandler2 {
+public class BlueprintNamespaceHandler implements NamespaceHandler,
NamespaceHandler2 {
public static final String SPRING_CONTEXT_ID = "." +
org.springframework.beans.factory.xml.ParserContext.class.getName();
public static final String SPRING_BEAN_PROCESSOR_ID = "." +
SpringBeanProcessor.class.getName();
@@ -83,11 +84,6 @@ public class BlueprintNamespaceHandler i
}
@Override
- public boolean mayResolve(String namespace) {
- return schemas.containsKey(namespace);
- }
-
- @Override
public URL getSchemaLocation(String s) {
if (schemas.containsKey(s)) {
return bundle.getResource(schemas.getProperty(s));
Modified: aries/trunk/blueprint/blueprint-testbundlea/pom.xml
URL:
http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-testbundlea/pom.xml?rev=1738740&r1=1738739&r2=1738740&view=diff
==============================================================================
--- aries/trunk/blueprint/blueprint-testbundlea/pom.xml (original)
+++ aries/trunk/blueprint/blueprint-testbundlea/pom.xml Tue Apr 12 09:05:33 2016
@@ -31,7 +31,7 @@
<groupId>org.apache.aries.blueprint</groupId>
<artifactId>org.apache.aries.blueprint.testbundlea</artifactId>
<name>Apache Aries Blueprint Test Bundle A</name>
- <version>1.0.1-SNAPSHOT</version>
+ <version>1.1.0-SNAPSHOT</version>
<packaging>bundle</packaging>
<description>Blueprint Test Bundle A, provides NamespaceHandler,
BeanProcessor etc implementations for Test Bundle B</description>
Added:
aries/trunk/blueprint/blueprint-testbundlea/src/main/java/org/apache/aries/blueprint/testbundlea/NSHandlerHeight.java
URL:
http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-testbundlea/src/main/java/org/apache/aries/blueprint/testbundlea/NSHandlerHeight.java?rev=1738740&view=auto
==============================================================================
---
aries/trunk/blueprint/blueprint-testbundlea/src/main/java/org/apache/aries/blueprint/testbundlea/NSHandlerHeight.java
(added)
+++
aries/trunk/blueprint/blueprint-testbundlea/src/main/java/org/apache/aries/blueprint/testbundlea/NSHandlerHeight.java
Tue Apr 12 09:05:33 2016
@@ -0,0 +1,68 @@
+/**
+ * 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.aries.blueprint.testbundlea;
+
+import java.net.URL;
+import java.util.Collections;
+import java.util.Set;
+
+import org.apache.aries.blueprint.NamespaceHandler;
+import org.apache.aries.blueprint.ParserContext;
+import org.apache.aries.blueprint.mutable.MutableBeanMetadata;
+import org.osgi.service.blueprint.reflect.ComponentMetadata;
+import org.osgi.service.blueprint.reflect.Metadata;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+public class NSHandlerHeight implements NamespaceHandler{
+ public static String NSURI = "http://ns.handler.height";
+ private static String ELT_NAME = "nshandlerheight";
+ private static String ATTRIB_ID = "id";
+
+ //process elements
+ public Metadata parse(Element element, ParserContext context) {
+ Metadata retval = null;
+ if( element.getLocalName().equals(ELT_NAME) ) {
+ final String id = element.getAttributeNS(NSURI, ATTRIB_ID);
+ MutableBeanMetadata bm =
context.createMetadata(MutableBeanMetadata.class);
+ bm.setId(id);
+ bm.setScope("PROTOTYPE");
+ bm.setClassName(TestBean.class.getName());
+ retval = bm;
+ }
+ return retval;
+ }
+
+ //supply schema back to blueprint.
+ public URL getSchemaLocation(String namespace) {
+ if (NSURI.equals(namespace)) {
+ return this.getClass().getResource("nshandlerheight.xsd");
+ }
+ return null;
+ }
+
+ public Set<Class> getManagedClasses() {
+ Class cls = TestBean.class;
+ return Collections.singleton(cls);
+ }
+
+ public ComponentMetadata decorate(Node node, ComponentMetadata component,
+ ParserContext context) {
+ return component;
+ }
+
+}
Modified:
aries/trunk/blueprint/blueprint-testbundlea/src/main/resources/OSGI-INF/blueprint/config.xml
URL:
http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-testbundlea/src/main/resources/OSGI-INF/blueprint/config.xml?rev=1738740&r1=1738739&r2=1738740&view=diff
==============================================================================
---
aries/trunk/blueprint/blueprint-testbundlea/src/main/resources/OSGI-INF/blueprint/config.xml
(original)
+++
aries/trunk/blueprint/blueprint-testbundlea/src/main/resources/OSGI-INF/blueprint/config.xml
Tue Apr 12 09:05:33 2016
@@ -31,7 +31,8 @@
<bean id="NSHandlerFive"
class="org.apache.aries.blueprint.testbundlea.NSHandlerFive"/>
<bean id="NSHandlerSix"
class="org.apache.aries.blueprint.testbundlea.NSHandlerSix"/>
<bean id="NSHandlerSeven"
class="org.apache.aries.blueprint.testbundlea.NSHandlerSeven"/>
-
+ <bean id="NSHandlerHeight"
class="org.apache.aries.blueprint.testbundlea.NSHandlerHeight"/>
+
<service interface="org.apache.aries.blueprint.NamespaceHandler"
ref="NSHandlerOne">
<service-properties>
<entry key="osgi.service.blueprint.namespace"
value="http://ns.handler.one"/>
@@ -83,7 +84,16 @@
</entry>
</service-properties>
</service>
-
+ <service interface="org.apache.aries.blueprint.NamespaceHandler"
ref="NSHandlerHeight">
+ <service-properties>
+ <entry key="osgi.service.blueprint.namespace">
+ <list>
+ <value>http://ns.handler.height</value>
+ </list>
+ </entry>
+ </service-properties>
+ </service>
+
<bean id="MultiService"
class="org.apache.aries.blueprint.testbundlea.multi.MultiService"/>
<service ref="MultiService">
<interfaces>
Added:
aries/trunk/blueprint/blueprint-testbundlea/src/main/resources/org/apache/aries/blueprint/testbundlea/nshandlerheight.xsd
URL:
http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-testbundlea/src/main/resources/org/apache/aries/blueprint/testbundlea/nshandlerheight.xsd?rev=1738740&view=auto
==============================================================================
---
aries/trunk/blueprint/blueprint-testbundlea/src/main/resources/org/apache/aries/blueprint/testbundlea/nshandlerheight.xsd
(added)
+++
aries/trunk/blueprint/blueprint-testbundlea/src/main/resources/org/apache/aries/blueprint/testbundlea/nshandlerheight.xsd
Tue Apr 12 09:05:33 2016
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://ns.handler.height"
+ xmlns:imp="http://ns.handler.height.imp"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ elementFormDefault="qualified"
+ attributeFormDefault="qualified" >
+
+ <include schemaLocation="nshandlerheightincluded.xsd"/>
+
+</schema>
\ No newline at end of file
Added:
aries/trunk/blueprint/blueprint-testbundlea/src/main/resources/org/apache/aries/blueprint/testbundlea/nshandlerheightinc2.xsd
URL:
http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-testbundlea/src/main/resources/org/apache/aries/blueprint/testbundlea/nshandlerheightinc2.xsd?rev=1738740&view=auto
==============================================================================
---
aries/trunk/blueprint/blueprint-testbundlea/src/main/resources/org/apache/aries/blueprint/testbundlea/nshandlerheightinc2.xsd
(added)
+++
aries/trunk/blueprint/blueprint-testbundlea/src/main/resources/org/apache/aries/blueprint/testbundlea/nshandlerheightinc2.xsd
Tue Apr 12 09:05:33 2016
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://ns.handler.height"
+ xmlns:tns="http://ns.handler.height"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ elementFormDefault="qualified"
+ attributeFormDefault="qualified" >
+
+ <complexType name="Included">
+ <sequence>
+ <element name="stuffinc" type="xsd:string"/>
+ <any minOccurs="0"/>
+ </sequence>
+ </complexType>
+ <attribute name="attrib" type="xsd:string"/>
+</schema>
\ No newline at end of file
Added:
aries/trunk/blueprint/blueprint-testbundlea/src/main/resources/org/apache/aries/blueprint/testbundlea/nshandlerheightincluded.xsd
URL:
http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-testbundlea/src/main/resources/org/apache/aries/blueprint/testbundlea/nshandlerheightincluded.xsd?rev=1738740&view=auto
==============================================================================
---
aries/trunk/blueprint/blueprint-testbundlea/src/main/resources/org/apache/aries/blueprint/testbundlea/nshandlerheightincluded.xsd
(added)
+++
aries/trunk/blueprint/blueprint-testbundlea/src/main/resources/org/apache/aries/blueprint/testbundlea/nshandlerheightincluded.xsd
Tue Apr 12 09:05:33 2016
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://ns.handler.height"
+ xmlns:tns="http://ns.handler.height"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ elementFormDefault="qualified"
+ attributeFormDefault="qualified" >
+
+ <xsd:include schemaLocation="nshandlerheightinc2.xsd" />
+
+ <element name="nshandlerheight">
+ <complexType>
+ <sequence>
+ <element name="stuff" type="tns:Included"/>
+ </sequence>
+ <attribute name="id" type="xsd:string"/>
+ <attribute ref="tns:attrib"/>
+ </complexType>
+ </element>
+
+</schema>
\ No newline at end of file
Modified: aries/trunk/blueprint/blueprint-testbundleb/pom.xml
URL:
http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-testbundleb/pom.xml?rev=1738740&r1=1738739&r2=1738740&view=diff
==============================================================================
--- aries/trunk/blueprint/blueprint-testbundleb/pom.xml (original)
+++ aries/trunk/blueprint/blueprint-testbundleb/pom.xml Tue Apr 12 09:05:33 2016
@@ -64,7 +64,7 @@
<dependency>
<groupId>org.apache.aries.blueprint</groupId>
<artifactId>org.apache.aries.blueprint.testbundlea</artifactId>
- <version>1.0.1-SNAPSHOT</version>
+ <version>1.1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.aries.blueprint</groupId>
Modified:
aries/trunk/blueprint/blueprint-testbundleb/src/main/resources/OSGI-INF/blueprint/config.xml
URL:
http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-testbundleb/src/main/resources/OSGI-INF/blueprint/config.xml?rev=1738740&r1=1738739&r2=1738740&view=diff
==============================================================================
---
aries/trunk/blueprint/blueprint-testbundleb/src/main/resources/OSGI-INF/blueprint/config.xml
(original)
+++
aries/trunk/blueprint/blueprint-testbundleb/src/main/resources/OSGI-INF/blueprint/config.xml
Tue Apr 12 09:05:33 2016
@@ -28,6 +28,7 @@
xmlns:six="http://ns.handler.six"
xmlns:sixim="http://ns.handler.six.import"
xmlns:seven="http://ns.handler.seven"
+ xmlns:height="http://ns.handler.height"
default-availability="optional">
<ext:property-placeholder placeholder-prefix="$(" placeholder-suffix=")">
@@ -120,9 +121,15 @@
<seven:stuffinc>foo</seven:stuffinc>
<mytest:foo xmlns:mytest="http://ns.handler.mytest">blah</mytest:foo>
</seven:stuff>
- </seven:nshandlerseven>
-
-
+ </seven:nshandlerseven>
+
+ <height:nshandlerheight height:id="HEIGHT" height:attrib="foo">
+ <height:stuff>
+ <height:stuffinc>foo</height:stuffinc>
+ <mytest:foo xmlns:mytest="http://ns.handler.mytest">blah</mytest:foo>
+ </height:stuff>
+ </height:nshandlerheight>
+
<reference id="OnlyA"
interface="org.apache.aries.blueprint.testbundlea.multi.InterfaceA"/>
<reference id="AandB"
interface="org.apache.aries.blueprint.testbundlea.multi.InterfaceA">
<ext:additional-interfaces>