Charles Moulliard created ARIES-1424:
----------------------------------------
Summary: Support to load namespace handler for class implementing
the interface org.apache.aries.blueprint.NamespaceHandler
Key: ARIES-1424
URL: https://issues.apache.org/jira/browse/ARIES-1424
Project: Aries
Issue Type: Improvement
Components: Web
Reporter: Charles Moulliard
The existing code of the Apache Aries Blueprint Web
(org.apache.aries.blueprint.web.BlueprintContextListener) scans to find
@Namespaces annotated class for namespace handler passed as parameter
like that within the web.xml file
{code}
<context-param>
<param-name>blueprintNamespaceHandlers</param-name>
<param-value>org.apache.camel.blueprint.handler.CamelNamespaceHandler</param-value>
</context-param>
{code}
So I propose to improve existing code to discover also class (like Apache Camel
Blueprint - CamelNamespaceHandler) implementing -
org.apache.aries.blueprint.NamespaceHandler
{code}
Namespaces namespaces = nsHandler.getClass().getAnnotation(Namespaces.class);
if (namespaces != null) {
for (String ns : namespaces.value()) {
servletContext.log("Namespace handler retrieved for
@Namespaces : " + ns);
nsSet.addNamespace(URI.create(ns),
nsHandler.getSchemaLocation(ns), nsHandler);
}
} else {
Class<?>[] interfaces = nsHandler.getClass().getInterfaces();
for(Class<?> clazz : interfaces) {
String ns = clazz.getName();
if
(ns.equals("org.apache.aries.blueprint.NamespaceHandler")) {
servletContext.log("Class implementing Blueprint
NamespaceHandler : " + nsHandler.getClass().getName());
nsSet.addNamespace(URI.create(nsHandler.getClass().getName()),
nsHandler.getSchemaLocation(nsHandler.getClass().getName()), nsHandler);
}
}
{code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)