1 2 3 Previous Next 35 Replies Latest reply on Mar 4, 2008 3:51 PM by kabirkhan

    MC + JAXB (JBossXB Builder)

    alesj

      I ported the MC JAXB features from JBossXB builder project.
      How much was this thing tested?

      The JavaBean tests work OK, but I get a lot of failing tests for MC XML handling.
      It's mostly the same problem in all cases - even though we override the type for collections of annotations, propertys, demands, ... the interface type is used when applying beanAdapterFactory.newInstance.

      I'll commit the changes anyway, in order to move this fwd.
      The changes don't/shouldn't affect previous work.

        • 1. Re: MC + JAXB (JBossXB Builder)

           

          "alesj" wrote:
          I ported the MC JAXB features from JBossXB builder project.
          How much was this thing tested?


          I ported the entire set of MC parsing tests into the JBossXB builder testsuite.
          Are these now broken?


          • 2. Re: MC + JAXB (JBossXB Builder)
            alesj

             

            "adrian@jboss.org" wrote:

            Are these now broken?

            Yes.

            I ran them from IDEA's JUnit integration.
            Some of them pass, but most of them fail due to collection's element interface usage (instead of using declared type="AbstractXYZMetaData") when binding.

            • 3. Re: MC + JAXB (JBossXB Builder)

               

              "alesj" wrote:
              "adrian@jboss.org" wrote:

              Are these now broken?

              Yes.

              I ran them from IDEA's JUnit integration.
              Some of them pass, but most of them fail due to collection's element interface usage (instead of using declared type="AbstractXYZMetaData") when binding.


              I'm not seeing this. When I run the builder mc tests they all pass.
              You know the builder code and test are now in the jbossxb
              project? The original jbossxb-builder project is obsolete.

              e.g. If I run the org.jboss.test.xb.builder.object.mc.test.DependencyTestCase
              it passes. The model is declared (AbstractBeanMetaData):
               /**
               * Set what the bean depends.
               *
               * @param depends Set<DependencyMetaData>
               */
               @XmlElement(name="depends", type=AbstractDependencyMetaData.class)
               public void setDepends(Set<DependencyMetaData> depends)
               {
               this.depends = depends;
               flushJBossObjectCache();
               }
              


              • 4. Re: MC + JAXB (JBossXB Builder)
                alesj

                 

                "adrian@jboss.org" wrote:
                [
                You know the builder code and test are now in the jbossxb
                project? The original jbossxb-builder project is obsolete.

                No. :-)

                Which version of jbossxb has this already included?




                • 5. Re: MC + JAXB (JBossXB Builder)
                  starksm64

                  2.0.0.CR5 and trunk.

                  • 6. Re: MC + JAXB (JBossXB Builder)
                    alesj

                     

                    "scott.stark@jboss.org" wrote:
                    2.0.0.CR5 and trunk.

                    OK, I'll remove the jbossxb-builder dependency in MC, and updated jbossxb version to 2.0.0.CR5.

                    • 7. Re: MC + JAXB (JBossXB Builder)

                       

                      "alesj" wrote:
                      "scott.stark@jboss.org" wrote:
                      2.0.0.CR5 and trunk.

                      OK, I'll remove the jbossxb-builder dependency in MC, and updated jbossxb version to 2.0.0.CR5.


                      I've just done that. But there are a number of problems still to resolve.

                      1) I don't know why but there is a change in the way JAXB was handling elements.
                      e.g. I had to reinstate the "bean" element in BeanSchemaBindingHelper.configureValueBindings()
                      But the same issue is broken for PolicySchemaBindingHelper in that it doesn't
                      recognise the nested value in the BindingComplexValue test.

                      2) The new JAXB wasn't even working. I've udpated some of the none xml properties
                      e.g. getChildren() on most of the metadata to mark it @XmlTransient.
                      It can now actually build the schema ;-)

                      There was some other fixes as well.

                      3) The remaining issues are the BeanFactory tests are all failing.
                      And the way I did MapMetaData in the jbossxb is wrong.
                      In the JBossXB tests I implemented it as a Set
                      but this is obviously wrong, since it is a Map not a Set.

                      The current way to markup a Map is to use XmlAdapter
                      http://viewvc.jboss.org/cgi-bin/viewvc.cgi/common/jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/element/javatypeadapter/support/
                      But it would be better if we had native support like we do for collections.


                      Off Topic. I'm seeing some other tests. e.g. the value-factory tests
                      are failing because of AccessControlException when trying to get the classloader.

                      • 8. Re: MC + JAXB (JBossXB Builder)
                        alesj

                         

                        "adrian@jboss.org" wrote:

                        I've just done that. But there are a number of problems still to resolve.

                        1) I don't know why but there is a change in the way JAXB was handling elements.
                        e.g. I had to reinstate the "bean" element in BeanSchemaBindingHelper.configureValueBindings()
                        But the same issue is broken for PolicySchemaBindingHelper in that it doesn't
                        recognise the nested value in the BindingComplexValue test.

                        2) The new JAXB wasn't even working. I've udpated some of the none xml properties
                        e.g. getChildren() on most of the metadata to mark it @XmlTransient.
                        It can now actually build the schema ;-)

                        Uf, we were doing the same thing, and you beat me to it. :-)
                        I'll revert my changes, and do an update.

                        "adrian@jboss.org" wrote:

                        There was some other fixes as well.

                        3) The remaining issues are the BeanFactory tests are all failing.
                        And the way I did MapMetaData in the jbossxb is wrong.
                        In the JBossXB tests I implemented it as a Set<MapEntry>
                        but this is obviously wrong, since it is a Map not a Set.

                        The current way to markup a Map is to use XmlAdapter
                        http://viewvc.jboss.org/cgi-bin/viewvc.cgi/common/jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/element/javatypeadapter/support/
                        But it would be better if we had native support like we do for collections.

                        Yup, I noticed that.
                        I can have a look at this.

                        "adrian@jboss.org" wrote:

                        Off Topic. I'm seeing some other tests. e.g. the value-factory tests
                        are failing because of AccessControlException when trying to get the classloader.

                        That's what I was explaining here:
                        - http://www.jboss.org/index.html?module=bb&op=viewtopic&t=125785&postdays=0&postorder=asc&start=0

                        • 9. Re: MC + JAXB (JBossXB Builder)

                           

                          "alesj" wrote:

                          "adrian@jboss.org" wrote:

                          And the way I did MapMetaData in the jbossxb is wrong.
                          In the JBossXB tests I implemented it as a Set<MapEntry>
                          but this is obviously wrong, since it is a Map not a Set.

                          The current way to markup a Map is to use XmlAdapter
                          http://viewvc.jboss.org/cgi-bin/viewvc.cgi/common/jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/element/javatypeadapter/support/
                          But it would be better if we had native support like we do for collections.

                          Yup, I noticed that.
                          I can have a look at this.


                          Actually that's no good for the way we do maps. It only supports
                          collection type map definitions, e.g.
                          <map key="1">2</map>
                          <map key="3">4</map>
                          


                          I've been speaking with Alexey and we'll probably add support for
                          some kind of @JBossXMLMap annotation.

                          • 10. Re: MC + JAXB (JBossXB Builder)

                             

                            "adrian@jboss.org" wrote:

                            3) The remaining issues are the BeanFactory tests are all failing.


                            I fixed this by using my new improved version of the GenericBeanFactoryMetaData,
                            I called it GenericBeanFactoryMetaData2.

                            But this implementation is incomplete, it needs to add the install callbacks "etc."
                            into the constructed BeanMetaData:
                            
                             public List<BeanMetaData> getBeans()
                             {
                             AbstractBeanMetaData gbf = new AbstractBeanMetaData();
                             gbf.setName(name);
                             gbf.setAliases(aliases);
                             gbf.setBean(GenericBeanFactory.class.getName());
                             gbf.setMode(mode);
                             Set<PropertyMetaData> properties = new HashSet<PropertyMetaData>();
                             gbf.setProperties(properties);
                             properties.add(createProperty("bean", bean));
                             properties.add(createProperty("classLoader", classLoader));
                             properties.add(createProperty("constructor", constructor));
                             properties.add(createMapProperty("properties", properties));
                             properties.add(createProperty("start", start));
                             properties.add(createProperty("create", create));
                             // etc.
                             return Collections.singletonList((BeanMetaData) gbf);
                             }
                            


                            • 11. Re: MC + JAXB (JBossXB Builder)

                              So once the Map issue is resolved, the remaining work is to do the same for the
                              aop-mc-int deployment stuff then we can ditch all the schema binding initializer code.

                              That will make the MC jar a lot smaller. ;-)

                              • 12. Re: MC + JAXB (JBossXB Builder)
                                alesj

                                 

                                "adrian@jboss.org" wrote:

                                But this implementation is incomplete, it needs to add the install callbacks "etc." into the constructed BeanMetaData:

                                Is install callbacks even legit for beanfactory?
                                Since once the bean is created, we have no control.
                                So, only the callbacks at the time of creation would be applied - meaning that the order of creation would be important.
                                e.g. getting different behavior if something changes the order, a new dependency ...
                                And no way of applying uninstalls.


                                • 13. Re: MC + JAXB (JBossXB Builder)
                                  alesj

                                   

                                  "adrian@jboss.org" wrote:

                                  I fixed this by using my new improved version of the GenericBeanFactoryMetaData,
                                  I called it GenericBeanFactoryMetaData2.

                                  I think it's missing the features of MetaDataVisitorNode. ;-)

                                  • 14. Re: MC + JAXB (JBossXB Builder)
                                    alesj

                                     

                                    "alesj" wrote:

                                    I think it's missing the features of MetaDataVisitorNode. ;-)

                                    Or not. :-)
                                     public List<BeanMetaData> getBeans()
                                     {
                                     AbstractBeanMetaData gbf = new AbstractBeanMetaData();
                                     gbf.setName(name);
                                     gbf.setAliases(aliases);
                                     gbf.setBean(GenericBeanFactory.class.getName());
                                     gbf.setMode(mode);
                                     Set<PropertyMetaData> properties = new HashSet<PropertyMetaData>();
                                     gbf.setProperties(properties);
                                     properties.add(createProperty("bean", bean));
                                     properties.add(createProperty("classLoader", classLoader));
                                     properties.add(createProperty("constructor", constructor));
                                     properties.add(createMapProperty("properties", properties));
                                     properties.add(createProperty("start", start));
                                     properties.add(createProperty("create", create));
                                     gbf.setDemands(demands);
                                     gbf.setDepends(depends);
                                     gbf.setSupplies(supplies);
                                     gbf.setInstalls(installs);
                                     gbf.setUninstalls(uninstalls);
                                     gbf.setInstallCallbacks(installCallbacks);
                                     gbf.setUninstallCallbacks(uninstallCallbacks);
                                     return Collections.singletonList((BeanMetaData) gbf);
                                     }
                                    


                                    1 2 3 Previous Next