1 2 Previous Next 22 Replies Latest reply on Dec 19, 2006 6:40 PM by alesj

    Other IoC containers support

    alesj

      Regarding http://jira.jboss.com/jira/browse/JBMICROCONT-26.

      1)
      Where to put such code?
      New module / project - ioc-ext?

      2)
      I see two ways that we can support this:

      2a)
      Exactly what the task is stating: translate other IOC xml into JBoss MC metadata.
      Similar as to what we are already doing with JavaBeans, we can also manage beans defined by other IoC containers - integration with MC via xsd and SingletonSchemaResolverFactory.

      2b)
      Second one is similar to the way current SpringDeployer is done - propagating bean deployment / management to Spring container.
      So all this supported IoC containers manage their beans themselves.
      This is more of a test of finding a common way on top of new deployers to handle different IoC container management - possible hierarchy with deploy/redeploy/undeploy.

        • 1. Re: Other IoC containers support
          starksm64

          The point of this task should be validating the ability to support mappings of other frameworks onto the mc model. Arbitrary interaction between the mc and some other kernel implementation has too many complications.

          The main framework I want to see validated is osgi.

          • 2. Re: Other IoC containers support
            alesj

             

            "scott.stark@jboss.org" wrote:

            The main framework I want to see validated is osgi.

            Ok.
            I already started with Spring, just to get the first grip on how to do this.
            Once I'm finished, I'll try to do the same with OSGi.

            • 3. Re: Other IoC containers support
              alesj

               

              "scott.stark@jboss.org" wrote:
              The point of this task should be validating the ability to support mappings of other frameworks onto the mc model. Arbitrary interaction between the mc and some other kernel implementation has too many complications.


              I already have the code that does user-transparent bi-directional interaction between MC and Spring.
              If I have the time and idea I don't see why not to include this for other IoC containers as well.
              But as you said - our/my main goal will be validating the ability to support mappings of other frameworks onto the MC model.

              • 4. Re: Other IoC containers support
                alesj

                How is it with having modified Spring xsd file in our distribution?
                Are we allowed to modify xsd and ship it with our dist?

                Since if I want to handle xml + xsd binding as we do it now with MC MD and JavaBeans, I have to modify Spring's xsd - adding names to complex types (they are using nested complex types inside element definitions).

                • 5. Re: Other IoC containers support
                  starksm64

                  Its just a licensing issue. As long as the license allows it, its is fine. We need to be using a unique namespace to avoid conflicts with the base version.

                  • 6. Re: Other IoC containers support
                    alesj

                     

                    "scott.stark@jboss.org" wrote:
                    Its just a licensing issue. As long as the license allows it, its is fine.


                    Who would know this?

                    I've already commited initial code to the mc trunk (spring-int module):
                    - mc-spring-beans_2_0.xsd (my modification)
                    - http://www.springframework.org/schema/beans/spring-beans-2.0.xsd (original)

                    So if someone can have a look at the modifications and specify what we can do or what we can't do.

                    • 7. Re: Other IoC containers support
                      starksm64

                      What is the license of the distribution in which this schema is found? At a minimum the some attribution of the copyright and license terms needs to be added. We should use a namespace like urn:jboss:spring-deployer:2.0 for the modified schema.

                      • 8. Re: Other IoC containers support
                        alesj

                         

                        "scott.stark@jboss.org" wrote:
                        What is the license of the distribution in which this schema is found?


                        The Spring Framework is licensed under the terms of the Apache License, Version 2.0.
                        From http://www.springframework.org/about.

                        We should use a namespace like urn:jboss:spring-deployer:2.0 for the modified schema.


                        I suggest 'urn:jboss:spring-beans:2.0'.

                        This means that you cannot just drop in your current spring xml definition - you must change the namespace.
                        But it is probably nicer when we want to mix and match with our mc beans.

                        • 9. Re: Other IoC containers support
                          starksm64

                           

                          "alesj" wrote:

                          I suggest 'urn:jboss:spring-beans:2.0'.

                          Fine.

                          "alesj" wrote:

                          This means that you cannot just drop in your current spring xml definition - you must change the namespace.
                          But it is probably nicer when we want to mix and match with our mc beans.

                          If we want some transparent replacement of the schema with the changes, then we should just have to map the http://www.springframework.org/schema/beans name to the urn:jboss:spring-beans:2.0 schema. This requires that the urn:jboss:spring-beans:2.0 is a pure superset of the http://www.springframework.org/schema/beans schema. Difficult to guarentee that given that its not even a versioned namespace.

                          • 10. Re: Other IoC containers support
                            alesj

                             

                            "scott.stark@jboss.org" wrote:

                            If we want some transparent replacement of the schema with the changes, then we should just have to map the http://www.springframework.org/schema/beans name to the urn:jboss:spring-beans:2.0 schema. This requires that the urn:jboss:spring-beans:2.0 is a pure superset of the http://www.springframework.org/schema/beans schema. Difficult to guarentee that given that its not even a versioned namespace.


                            You're right.
                            Currently we don't support all of the features of the Spring schema - I'm working on it, but I think we will never support them 100%. Some things are plain unnecessary or would require move into something we basically don't need or take us too much time for little gained.

                            • 11. Re: Other IoC containers support
                              alesj

                              While testing, I get this exception.
                              What's the problem, any ideas?

                              ---------------------------------

                              93 DEBUG [InstantiateSpringTestCase] ==== Starting testInstantiate ====
                              375 DEBUG [InstantiateSpringTestCase] Initialized parsing in 266ms
                              843 WARN [JBossEntityResolver] Cannot load publicId from resource: xml.xsd
                              859 DEBUG [JBossEntityResolver] Cannot resolve [publicID=http://www.w3.org/XML/1998/namespace,systemID=null]
                              859 WARN [JBossEntityResolver] Cannot load systemId from resource: xml.xsd
                              15171 DEBUG [InstantiateSpringTestCase] Error during parsing: file:/C:/ales/projects/microcontainer/spring-int/classes/org/jboss/test/spring/test/TestInstantiate.xml
                              org.jboss.xb.binding.JBossXBException: Failed to parse source: file:/C:/ales/projects/microcontainer/spring-int/classes/org/jboss/test/spring/test/TestInstantiate.xml@3,91
                              at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.parse(SaxJBossXBParser.java:173)
                              at org.jboss.xb.binding.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:133)
                              at org.jboss.test.ioc.test.IoCTestDelegate.unmarshal(IoCTestDelegate.java:74)
                              at org.jboss.test.ioc.test.AbstractIoCTest.unmarshal(AbstractIoCTest.java:73)
                              at org.jboss.test.ioc.test.AbstractIoCTest.unmarshal(AbstractIoCTest.java:56)
                              at org.jboss.test.spring.test.InstantiateSpringTestCase.testInstantiate(InstantiateSpringTestCase.java:50)
                              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                              at java.lang.reflect.Method.invoke(Method.java:585)
                              at junit.framework.TestCase.runTest(TestCase.java:164)
                              at junit.framework.TestCase.runBare(TestCase.java:130)
                              at junit.framework.TestResult$1.protect(TestResult.java:110)
                              at junit.framework.TestResult.runProtected(TestResult.java:128)
                              at junit.framework.TestResult.run(TestResult.java:113)
                              at junit.framework.TestCase.run(TestCase.java:120)
                              at junit.framework.TestSuite.runTest(TestSuite.java:228)
                              at junit.framework.TestSuite.run(TestSuite.java:223)
                              at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
                              at junit.extensions.TestSetup$1.protect(TestSetup.java:23)
                              at junit.framework.TestResult.runProtected(TestResult.java:128)
                              at junit.extensions.TestSetup.run(TestSetup.java:27)
                              at junit.framework.TestSuite.runTest(TestSuite.java:228)
                              at junit.framework.TestSuite.run(TestSuite.java:223)
                              at junit.textui.TestRunner.doRun(TestRunner.java:115)
                              at com.intellij.rt.execution.junit2.IdeaJUnitAgent.doRun(IdeaJUnitAgent.java:58)
                              at junit.textui.TestRunner.start(TestRunner.java:179)
                              at com.intellij.rt.execution.junit.TextTestRunner2.startRunnerWithArgs(TextTestRunner2.java:23)
                              at com.intellij.rt.execution.junit2.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:98)
                              at com.intellij.rt.execution.junit2.JUnitStarter.main(JUnitStarter.java:32)
                              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                              at java.lang.reflect.Method.invoke(Method.java:585)
                              at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
                              Caused by: org.jboss.xb.binding.JBossXBRuntimeException: -1:-1 5:28 s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'. Saw 'The "xml:" Namespace'.
                              at org.jboss.xb.binding.sunday.unmarshalling.XsdBinderTerminatingErrorHandler.handleError(XsdBinderTerminatingErrorHandler.java:40)
                              at org.apache.xerces.impl.xs.XMLSchemaLoader.reportDOMFatalError(Unknown Source)
                              at org.apache.xerces.impl.xs.XSLoaderImpl.load(Unknown Source)
                              at org.jboss.xb.binding.Util.loadSchema(Util.java:395)
                              at org.jboss.xb.binding.sunday.unmarshalling.XsdBinder.bind(XsdBinder.java:168)
                              at org.jboss.xb.binding.sunday.unmarshalling.XsdBinder.bind(XsdBinder.java:139)
                              at org.jboss.xb.binding.sunday.unmarshalling.DefaultSchemaResolver.resolve(DefaultSchemaResolver.java:247)
                              at org.jboss.xb.binding.sunday.unmarshalling.SundayContentHandler.startElement(SundayContentHandler.java:187)
                              at org.jboss.xb.binding.parser.sax.SaxJBossXBParser$DelegatingContentHandler.startElement(SaxJBossXBParser.java:381)
                              at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
                              at org.apache.xerces.xinclude.XIncludeHandler.startElement(Unknown Source)
                              at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
                              at org.apache.xerces.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook(Unknown Source)
                              at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
                              at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
                              at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
                              at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
                              at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
                              at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
                              at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
                              at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.parse(SaxJBossXBParser.java:169)
                              ... 34 more
                              15234 DEBUG [InstantiateSpringTestCase] testInstantiate took 15141ms
                              15234 DEBUG [InstantiateSpringTestCase] ==== Stopping testInstantiate ====

                              org.jboss.xb.binding.JBossXBException: Failed to parse source: file:/C:/ales/projects/microcontainer/spring-int/classes/org/jboss/test/spring/test/TestInstantiate.xml@3,91
                              at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.parse(SaxJBossXBParser.java:173)
                              at org.jboss.xb.binding.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:133)
                              at org.jboss.test.ioc.test.IoCTestDelegate.unmarshal(IoCTestDelegate.java:74)
                              at org.jboss.test.ioc.test.AbstractIoCTest.unmarshal(AbstractIoCTest.java:73)
                              at org.jboss.test.ioc.test.AbstractIoCTest.unmarshal(AbstractIoCTest.java:56)
                              at org.jboss.test.spring.test.InstantiateSpringTestCase.testInstantiate(InstantiateSpringTestCase.java:50)
                              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                              at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
                              at junit.extensions.TestSetup$1.protect(TestSetup.java:23)
                              at junit.extensions.TestSetup.run(TestSetup.java:27)
                              at com.intellij.rt.execution.junit2.JUnitStarter.main(JUnitStarter.java:32)
                              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                              at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
                              Caused by: org.jboss.xb.binding.JBossXBRuntimeException: -1:-1 5:28 s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'. Saw 'The "xml:" Namespace'.
                              at org.jboss.xb.binding.sunday.unmarshalling.XsdBinderTerminatingErrorHandler.handleError(XsdBinderTerminatingErrorHandler.java:40)
                              at org.apache.xerces.impl.xs.XMLSchemaLoader.reportDOMFatalError(Unknown Source)
                              at org.apache.xerces.impl.xs.XSLoaderImpl.load(Unknown Source)
                              at org.jboss.xb.binding.Util.loadSchema(Util.java:395)
                              at org.jboss.xb.binding.sunday.unmarshalling.XsdBinder.bind(XsdBinder.java:168)
                              at org.jboss.xb.binding.sunday.unmarshalling.XsdBinder.bind(XsdBinder.java:139)
                              at org.jboss.xb.binding.sunday.unmarshalling.DefaultSchemaResolver.resolve(DefaultSchemaResolver.java:247)
                              at org.jboss.xb.binding.sunday.unmarshalling.SundayContentHandler.startElement(SundayContentHandler.java:187)
                              at org.jboss.xb.binding.parser.sax.SaxJBossXBParser$DelegatingContentHandler.startElement(SaxJBossXBParser.java:381)
                              at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
                              at org.apache.xerces.xinclude.XIncludeHandler.startElement(Unknown Source)
                              at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
                              at org.apache.xerces.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook(Unknown Source)
                              at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
                              at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
                              at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
                              at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
                              at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
                              at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
                              at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
                              at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.parse(SaxJBossXBParser.java:169)
                              ... 34 more

                              15234 DEBUG [InstantiateSpringTestCase] ==== tornDown org.jboss.test.spring.test.InstantiateSpringTestCase ====

                              Process finished with exit code -1

                              • 12. Re: Other IoC containers support
                                alesj

                                Found the problem.
                                I needed to put xml.xsd into my classpath.

                                So we should do this also in our dist or is this already in?
                                Or you can reference it some other way?

                                ---------------------------

                                <?xml version='1.0'?>
                                <xs:schema targetNamespace="http://www.w3.org/XML/1998/namespace" xmlns:xs="http://www.w3.org/2001/XMLSchema" xml:lang="en">

                                <xs:annotation>
                                <xs:documentation>
                                See http://www.w3.org/XML/1998/namespace.html and
                                http://www.w3.org/TR/REC-xml for information about this namespace.

                                This schema document describes the XML namespace, in a form
                                suitable for import by other schema documents.

                                Note that local names in this namespace are intended to be defined
                                only by the World Wide Web Consortium or its subgroups. The
                                following names are currently defined in this namespace and should
                                not be used with conflicting semantics by any Working Group,
                                specification, or document instance:

                                base (as an attribute name): denotes an attribute whose value
                                provides a URI to be used as the base for interpreting any
                                relative URIs in the scope of the element on which it
                                appears; its value is inherited. This name is reserved
                                by virtue of its definition in the XML Base specification.

                                id (as an attribute name): denotes an attribute whose value
                                should be interpreted as if declared to be of type ID.
                                The xml:id specification is not yet a W3C Recommendation,
                                but this attribute is included here to facilitate experimentation
                                with the mechanisms it proposes. Note that it is _not_ included
                                in the specialAttrs attribute group.

                                lang (as an attribute name): denotes an attribute whose value
                                is a language code for the natural language of the content of
                                any element; its value is inherited. This name is reserved
                                by virtue of its definition in the XML specification.

                                space (as an attribute name): denotes an attribute whose
                                value is a keyword indicating what whitespace processing
                                discipline is intended for the content of the element; its
                                value is inherited. This name is reserved by virtue of its
                                definition in the XML specification.

                                Father (in any context at all): denotes Jon Bosak, the chair of
                                the original XML Working Group. This name is reserved by
                                the following decision of the W3C XML Plenary and
                                XML Coordination groups:

                                In appreciation for his vision, leadership and dedication
                                the W3C XML Plenary on this 10th day of February, 2000
                                reserves for Jon Bosak in perpetuity the XML name
                                xml:Father
                                </xs:documentation>
                                </xs:annotation>

                                <xs:annotation>
                                <xs:documentation>This schema defines attributes and an attribute group
                                suitable for use by
                                schemas wishing to allow xml:base, xml:lang, xml:space or xml:id
                                attributes on elements they define.

                                To enable this, such a schema must import this schema
                                for the XML namespace, e.g. as follows:
                                <schema . . .>
                                . . .


                                Subsequently, qualified reference to any of the attributes
                                or the group defined below will have the desired effect, e.g.

                                <type . . .>
                                . . .


                                will define a type which will schema-validate an instance
                                element with any of those attributes</xs:documentation>

                                </xs:annotation>

                                <xs:annotation>
                                <xs:documentation>In keeping with the XML Schema WG's standard versioning
                                policy, this schema document will persist at
                                http://www.w3.org/2005/08/xml.xsd.
                                At the date of issue it can also be found at
                                http://www.w3.org/2001/xml.xsd.
                                The schema document at that URI may however change in the future,
                                in order to remain compatible with the latest version of XML Schema
                                itself, or with the XML namespace itself. In other words, if the XML
                                Schema or XML namespaces change, the version of this document at
                                http://www.w3.org/2001/xml.xsd will change
                                accordingly; the version at
                                http://www.w3.org/2005/08/xml.xsd will not change.
                                </xs:documentation>
                                </xs:annotation>

                                <xs:attribute name="lang">
                                <xs:annotation>
                                <xs:documentation>Attempting to install the relevant ISO 2- and 3-letter
                                codes as the enumerated possible values is probably never
                                going to be a realistic possibility. See
                                RFC 3066 at http://www.ietf.org/rfc/rfc3066.txt and the IANA registry
                                at http://www.iana.org/assignments/lang-tag-apps.htm for
                                further information.

                                The union allows for the 'un-declaration' of xml:lang with
                                the empty string.</xs:documentation>

                                </xs:annotation>
                                <xs:simpleType>
                                <xs:union memberTypes="xs:language">
                                <xs:simpleType>
                                <xs:restriction base="xs:string">
                                <xs:enumeration value=""/>
                                </xs:restriction>
                                </xs:simpleType>
                                </xs:union>

                                </xs:simpleType>
                                </xs:attribute>

                                <xs:attribute name="space">
                                <xs:simpleType>
                                <xs:restriction base="xs:NCName">
                                <xs:enumeration value="default"/>
                                <xs:enumeration value="preserve"/>
                                </xs:restriction>

                                </xs:simpleType>
                                </xs:attribute>

                                <xs:attribute name="base" type="xs:anyURI">
                                <xs:annotation>
                                <xs:documentation>See http://www.w3.org/TR/xmlbase/ for
                                information about this attribute.</xs:documentation>
                                </xs:annotation>
                                </xs:attribute>

                                <xs:attribute name="id" type="xs:ID">

                                <xs:annotation>
                                <xs:documentation>See http://www.w3.org/TR/xml-id/ for
                                information about this attribute.</xs:documentation>
                                </xs:annotation>
                                </xs:attribute>

                                <xs:attributeGroup name="specialAttrs">
                                <xs:attribute ref="xml:base"/>
                                <xs:attribute ref="xml:lang"/>
                                <xs:attribute ref="xml:space"/>

                                </xs:attributeGroup>

                                </xs:schema>

                                • 13. Re: Other IoC containers support
                                  starksm64

                                  It along with many others are already in the jboss5 config of the jbossxb layer.

                                  • 14. Re: Other IoC containers support
                                    aloubyansky

                                    I tried to load this XSD w/o xml.xsd in the classpath and there was no problem. There was also no resource resolution. Commit or send me a testcase if it's still a problem.

                                    1 2 Previous Next