1 2 Previous Next 21 Replies Latest reply on Aug 26, 2005 10:13 AM by bill.burke

    getting access to arbitrary content

    bill.burke

      JBoss AOP has the concept of generic metadata that you can apply to a class and/or the fields, constructors, methods of that class:

      
      <metadata group="transaction" class="com.acme.MyBean">
       <method name="someMethod">
       <trans-attribute>REQUIRED</trans-attribute>
       </method>
      </metadata>
      
      


      This is only an example of what can be done, but what happens is that the metadata and method tags are part of the schema, but ANYTHING can be within the method element.

      A datastructure is created that represents the reflection data of the class, For method "someMethd" a Map is created with the key being trans-attribute and the value being REQUIRED.

      With JBoss XB SchemaBindings is it possible to obtain the elements and the values of those elements in the method element generically without defining an XB mapping?

      Believe it or not, I have an actual paying customer that makes use of this stuff.

      Thanks.

        • 1. Re: getting access to arbitrary content
          starksm64

          So what is the java object representation for the ANY content in the metamodel? JBossXB supports binding ANY content to an object specified by another schema from a seperate namespace. The xml login module has an options java.util.Map there the map key element is part of its security-config_4_1.xsd schema while the value element is arbitrary. Here is a fragment where the userInfo module option is an object represented by an xml fragment conforming to a foreign user-roles_1_0.xsd schema, along with a simple unauthenticatedIdentity option which is just a string:

           <jaas:login-module code="org.jboss.security.auth.spi.XMLLoginModule"
           flag="required">
           <jaas:module-option name="userInfo">
           <ur:users
           xsi:schemaLocation="urn:jboss:user-roles user-roles_1_0.xsd"
           xmlns:ur="urn:jboss:user-roles">
           <ur:user name="jduke" password="theduke">
           <ur:role name="Role1"/>
           <ur:role name="Role2"/>
           <ur:role name="Echo"/>
           <ur:role name="callerJduke" group="CallerPrincipal"/>
           </ur:user>
           </ur:users>
           </jaas:module-option>
           <jaas:module-option name="unauthenticatedIdentity">guest</jaas:module-option>
           </jaas:login-module>
          



          • 2. Re: getting access to arbitrary content
            bill.burke

            so, I have to use the

            <jbxb:class>
            


            element? I'm using raw SchemaBinding stuff with TypeBindings and all that junk. I'm not using an ObjectModelFactory.

            I'm not even sure what the <jbxb:class> does. Does it even work for non-ObjectModelFactory? (SchemaBinding).

            thanks

            • 3. Re: getting access to arbitrary content
              starksm64

              If your building the SchemaBinding directly, you essentially are not using the xsd annotations. Your just using an alternate java centric parsing configuration that ultimately drive an ObjectModelFactory that Alexey wrote. The problem with this is that you are not allowing users to control the type of the objects that show up in the schema wildcard extension points (ANY content locations). I guess it could be made to work if you detected when ANY content element was from a new namespace, but this would seem to be duplicating the work Alexey has already done.

              Why aren't you defining the SchemaBinding from the aop document schema annotations?

              • 4. Re: getting access to arbitrary content
                bill.burke

                ALso, the any type I am creating is in the same namespace. it is just arbitrary XML that is not bound to any real object, but rather generic objects are created from it.

                In other words, I just want to browse, generically, the elements under the method element. I want to look at the element name and the simplecontent of that element, genericall through a generic API (like I would with Xerces)

                • 5. Re: getting access to arbitrary content
                  starksm64

                  So why isn't that some type of named collection. Propagating xml into the metamodel is just does not make sense. If its truly an extension point I should be able to define the type I want introduced into the metamodel using another schema. I don't know that jbossxb currently has support for mapping an ANY from the current namespace to one thing vs an ANY from another namespace. Alexey would have to comment on that.

                  • 6. Re: getting access to arbitrary content
                    bill.burke

                     

                    "scott.stark@jboss.org" wrote:
                    If your building the SchemaBinding directly, you essentially are not using the xsd annotations. Your just using an alternate java centric parsing configuration that ultimately drive an ObjectModelFactory that Alexey wrote. The problem with this is that you are not allowing users to control the type of the objects that show up in the schema wildcard extension points (ANY content locations). I guess it could be made to work if you detected when ANY content element was from a new namespace, but this would seem to be duplicating the work Alexey has already done.


                    I need to be backward compatible with my old stuff and my old stuff uses xerces to create generic data holders from xerces Elements. I can't remove this backward compatibility


                    Why aren't you defining the SchemaBinding from the aop document schema annotations?


                    • 7. Re: getting access to arbitrary content
                      bill.burke

                      Plus, how do I hook in Adrian's schema binding?

                      • 8. Re: getting access to arbitrary content
                        bill.burke

                        what I mean is, Adrian is using a raw SchemaBinding, if I go th ObjectModelFactory approach, how do I hook in processing for his stuff?

                        • 9. Re: getting access to arbitrary content
                          bill.burke

                          ObjectModelFactories seem like it would support what I want to do, but, how would I hook in another schema binding like Adrian's.

                          Basically, what I should be able to do is not use JBoss XB features if I don't want to and just process raw elements.

                          • 10. Re: getting access to arbitrary content
                            starksm64

                            First, Adrian has moved away from the explicit SchemaBinding usage as far as I know so you need to synch up to ensure you are on the same page.

                            Let's get a simple testcase for the type of parsing you need. It sounds like what is needed is the ability to map an ANY in the aop document namespace to the dom element for the content, while a foreign namespace triggers the parsing based on the associated schema annotations.


                            ObjectModelFactories seem like it would support what I want to do, but, how would I hook in another schema binding like Adrian's.

                            I don't think the mapping of namespace to ObjectModelFactory is exposed to the ObjectModelFactory api. I want to see a testcase that demonstrates support of your legacy (although evil) dom usage in addition to allowing for user defined objects to be introduced into the metamodel. You, me and Adrian need to agree on the testcase. What is the configuration hiearchy here?

                            MC
                            + AOP
                            + User Defined



                            • 11. Re: getting access to arbitrary content

                               

                              "scott.stark@jboss.org" wrote:
                              First, Adrian has moved away from the explicit SchemaBinding usage as far as I know


                              Not yet, but I will be changing over to the schema annotation approach.
                              i.e. schema.xsd defines xml -> object bindings
                              this coupled with the ANY processing should allow us to mix and match
                              and also define new bindings "on the fly".

                              • 12. Re: getting access to arbitrary content
                                bill.burke

                                 

                                "adrian@jboss.org" wrote:
                                "scott.stark@jboss.org" wrote:
                                First, Adrian has moved away from the explicit SchemaBinding usage as far as I know


                                Not yet, but I will be changing over to the schema annotation approach.
                                i.e. schema.xsd defines xml -> object bindings
                                this coupled with the ANY processing should allow us to mix and match
                                and also define new bindings "on the fly".


                                I'm getting seriously annoyed here...as it seems the week+ work I have done learning and partially implement AOP parsing using the SchemaBinding approach needs to be trashed and I have to wait until Adrian finishes his ObjectModelFactory version before I can complete the AOP/MC XML stuff (and actually make it usable so I can use it in stuff like Embeddable EJB3). yet again, I am waiting on somebody and there's a good chance I'll get involved into something else and won't be able to work on this shit for yet another few months...


                                Then again, I could just write the XML stuff for Microcontainer myself, which would annoy me too, but hey, at least i'd be moving in some forward direction.

                                • 13. Re: getting access to arbitrary content
                                  bill.burke

                                  Also, I think the schema.xsd approach sucks because you are coupling your object model to the schema. If you refactor your model, you have to push out another version of the schema.

                                  • 14. Re: getting access to arbitrary content

                                    This was discussed and agreed back in March:
                                    http://www.jboss.org/index.html?module=bb&op=viewtopic&t=61570&postdays=0&postorder=asc&start=20

                                    The change makes no difference to end users and allows greater flexibilty
                                    in our own parsing without having to know the details or worry about backwards/forwards
                                    compatibility.

                                    Alex has already prototyped, I believe?

                                    1 2 Previous Next