8 Replies Latest reply on Jun 16, 2005 8:56 AM by aloubyansky

    Inline bindings with jbxb

    aloubyansky

      I've been working on binding bean-deployer XSD to the corresponding Java classes.
      Current state can be tracked by checking out

      package org.jboss.test.xml;
      public class JbxbPojoServerUnitTestCase
      


      The annotated schema is 'xml/jbxb-bean-deployer_1_0.xsd' in the src/resources.
      Though, as I understand, the xsd and classes I have in test/xml got out of date.

      The programmatic binding still remains for:
      - map entry binding when we have to create a temporary container for the entry
      - merging properties (if I am doing this right...)

        • 1. Re: Inline bindings with jbxb
          aloubyansky

          Current binding elements are described here http://www.jboss.org/wiki/Wiki.jsp?page=JBossXB_JBXBAnnotations

          • 2. Re: Inline bindings with jbxb

            I'd like to drop the pojoserver test in the testsuite (I don't want to cross maintain
            this everytime new features are added) in favour of more
            clearly defined unit tests of the features I'm using in the MC (where they are not
            already tested).
            e.g.
            1) recursion in the value processing
            2) polymorphism in the value processing
            3) holders

            Basically, turn each one of the patterns I use in BeanSchemaBinding
            into a unit test that can be tested with both a programmatic binding and an annotated
            binding.

            Does this sounds acceptable to you?

            • 3. Re: Inline bindings with jbxb
              aloubyansky

              > Does this sounds acceptable to you?
              Yes.

              • 4. Re: Inline bindings with jbxb
                aloubyansky

                Here I explain binding to java.util.Map
                http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossXB_BindingToJavaUtilMap

                Any feedback is appreciated.

                • 5. Re: Inline bindings with jbxb

                  I notice you didn't try to support

                  <map>
                   <key>xxx</key><value>yyy</value>
                   <key>zzz</key><value>qqq</value>
                  </map>
                  


                  What are the rules for referencing types across namespaces
                  and "parameterizing them"?
                  i.e. Is there a way for me to say I accept any of those map types and
                  but the implementation of the map/key/value should be of a specific class
                  or another element type?

                  e.g. I want would like to use any of your rules/bindings from the map namespace
                  but override the map type to AbstractMapMetaData and the key/value to
                  one of my ValueMetaData types.

                  • 6. Re: Inline bindings with jbxb
                    aloubyansky

                    AFAIU, this style needs support for element group binding which is not supported yet. But I'll look into how hard it would be to add this and let you know.

                    I am not entirely clear about the other question.
                    As I understand it, there is a schema which is already bound. And you want to use that schema's types in your other schema and override type bindings from the first schema?

                    • 7. Re: Inline bindings with jbxb

                       

                      "alex.loubyansky@jboss.com" wrote:

                      I am not entirely clear about the other question.
                      As I understand it, there is a schema which is already bound. And you want to use that schema's types in your other schema and override type bindings from the first schema?


                      Yes. I want to sort of inherit your complex type into my namespace and
                      specialize it (name the classes or maybe override the annotations?).
                      And also let the user choose what type of entry binding they would like to use
                      (the short form or the long form) depending upon whether the values are Strings or
                      something more complex?

                      i.e. JBossXB provides some template types for some of the more common
                      use cases.

                      I was merely asking whether such a thing is possible (even it it requires
                      creating some special jbxb annotations to define it?).

                      The two advantages are:
                      1) I don't have to do all the work of defining what a map means
                      2) Consistency of form across our schemas.

                      • 8. Re: Inline bindings with jbxb
                        aloubyansky

                        Let's plan inheriting types and their bindings from other schemas for the future for now. It is possible. But I haven't tried it yet. In schemas it should be done with

                         <xsd:include schemaLocation="other.xsd"/>
                        


                        jbxb:mapEntry, jbxb:mapEntryValue, jbxb:mapEntryKey are *mostly* assembling annotations. In some cases, mapEntry can define types to the entry itself and its value. Otherwise, you just use jbxb:class.

                        PS: I have a new getting started tutorial http://jboss.org/wiki/Wiki.jsp?page=JBossXB_POTutorial. I will probably edit it to include some more basic customizations.