Uploaded image for project: 'Aries'
  1. Aries
  2. ARIES-1424

Support to load namespace handler for class implementing the interface org.apache.aries.blueprint.NamespaceHandler

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • Web
    • None

    Description

      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

          <context-param>
              <param-name>blueprintNamespaceHandlers</param-name>
              <param-value>org.apache.camel.blueprint.handler.CamelNamespaceHandler</param-value>
          </context-param>
      

      So I propose to improve existing code to discover also class (like Apache Camel Blueprint - CamelNamespaceHandler) implementing - org.apache.aries.blueprint.NamespaceHandler

      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);
                          }
                      }
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            cmoulliard Moulliard Charles
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: