Announcement Announcement Module
Collapse

Spring Dynamic Modules forum decommissioned in favor of Eclipse Gemini Blueprint

With the official first release of Eclipse Gemini Blueprint shipped, the migration of the Spring Dynamic Modules code base to the Eclipse Foundation, as part of the Gemini project, has been completed.

As such, this forum has been decommissioned in favour of the Eclipse Gemini forums.
See more
See less
Does Blueprint RI support custom elements in Blueprint context? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Does Blueprint RI support custom elements in Blueprint context?

    I tried to add other schema extension for osgi blueprint, like:

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
               xmlns:myns="http://www.mycompany.com/schema/myns"
               xmlns:osgix="http://www.springframework.org/schema/osgi-compendium">
         
             
        <myns:dateformat id="defaultDateFormat1" pattern="yyyy-MM-dd HH:mm"
    		lenient="true" />
    	   
    	 	
    	<reference-list id="functions" filter="(&amp;(osgi.command.scope=*)(osgi.command.function=*))"
                        availability="optional"> 
        </reference-list>
        
        <osgix:cm-properties id="cmProps" persistent-id="org.apache.servicemix.shell">
            <prop key="sshPort">8101</prop>      
        </osgix:cm-properties>
        
    </blueprint>
    ------------------------------------------------------
    We always get errors like "The matching wildcard is strict, but no declaration can be found for element 'myns:dateformat1' " or "The matching wildcard is strict, but no declaration can be found for element 'osgix:cm-properties' ".

    Thoughts?
    Last edited by kmshi_array; Nov 4th, 2009, 10:31 PM.

  • #2
    Originally posted by kmshi_array View Post
    I tried to add other schema extension for osgi blueprint, like:

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
               xmlns:myns="http://www.mycompany.com/schema/myns"
               xmlns:osgix="http://www.springframework.org/schema/osgi-compendium">
         
             
        <myns:dateformat id="defaultDateFormat1" pattern="yyyy-MM-dd HH:mm"
    		lenient="true" />
    	   
    	 	
    	<reference-list id="functions" filter="(&amp;(osgi.command.scope=*)(osgi.command.function=*))"
                        availability="optional"> 
        </reference-list>
        
        <osgix:cm-properties id="cmProps" persistent-id="org.apache.servicemix.shell">
            <prop key="sshPort">8101</prop>      
        </osgix:cm-properties>
        
    </blueprint>
    ------------------------------------------------------
    We always get errors like "The matching wildcard is strict, but no declaration can be found for element 'myns:dateformat1' " or "The matching wildcard is strict, but no declaration can be found for element 'osgix:cm-properties' ".

    Thoughts?
    If this is to work I'm pretty sure you need a schema that blueprint can find - at least that's the way it works in Spring DM. If you look at the Blueprint schema it has this:

    <xsd:any namespace="##other" processContents="strict"/>

    so Blueprint is only going to let you insert other stuff if it has a schema definition for the namespace. As to how you make the schema available - that's really down to what Costin has implemented. In Spring DM you can put it in META-INF and then put spring.handlers and spring.schemas in there also.

    Comment


    • #3
      Yes, I do follow "Appendix D Extensible XML authoring" in spring-framework-reference to register "myns" namespace, I know I did it right for it worked very well if I added same element into beans context:

      Code:
      <?xml version="1.0" encoding="UTF-8"?>
      <beans xmlns="http://www.springframework.org/schema/beans"
      	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      	xmlns:myns="http://www.mycompany.com/schema/myns"
      	xsi:schemaLocation="
      http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
      http://www.mycompany.com/schema/myns http://www.mycompany.com/schema/myns/myns.xsd">
      	
      	<myns:dateformat id="defaultDateFormat2" pattern="yyyy-MM-dd HH:mm" lenient="true" />
      
      </beans>
      I wonder if there is any trick to wrap it to work in blueprint context.

      Comment


      • #4
        Andy is right - any new namespace inserted have to be validated (which means they have to present). As from the Spring DM side, any Spring schemas (such as the ones in META-INF/spring.handlers and META-INF/spring.schemas) are discovered and shared automatically. We use this internally for the blueprint schema as well.

        Comment


        • #5
          Originally posted by Costin Leau View Post
          Andy is right - any new namespace inserted have to be validated (which means they have to present). As from the Spring DM side, any Spring schemas (such as the ones in META-INF/spring.handlers and META-INF/spring.schemas) are discovered and shared automatically. We use this internally for the blueprint schema as well.

          Yea, so I wonder why "myns:dateformat" or "osgix:cm-properties" in blueprint context (the xml file was under OSGI-INF/blueprint) did not work, but they worked in beans context(the file was put at META-INF/spring), in my test, the 2 xml files were in same bundle, and my env was 2.0.0.M2-SNAPSHOT mainline.

          Can anyone have interest to give it a test too?

          Comment


          • #6
            This comes back to the way validation is performed. By using beans you have used spring-beans.xsd as your main schema which does not require strict validation of the imported declarations (the same should apply if you use spring dm schema).
            You can double check this by looking at the xsd declarations or by opening them inside a rich ID which is XML aware since usually they offer a solution as well (such as importing the missing schemas).

            Comment


            • #7
              Guys, thanks for your help.

              Comment

              Working...
              X