8 Replies Latest reply on Apr 10, 2008 8:06 AM by alesj

    Registering schema with JBossXB

    alesj

       

      "adrian@jboss.org" wrote:

      I guess we could add an extra option to the SchemaResolverParser
       <propertry name="registerWithJBossXB">true</property>
      

      which would take the schema name from the annotation on the class/package
      and register the generated schema binding with JBossXB?

      This is now done, see SchemaResolverXBTestCase.
      But should there be a remove/unregister on uninstall of deployer?


        • 1. Re: Registering schema with JBossXB
          alesj

           

          "alesj" wrote:
          But should there be a remove/unregister on uninstall of deployer?

          Looking at DefaultSchemaResolver.
          Shouldn't this
           /** Namespace to JBossXBBuilder binding class */
           private WeakHashMap<String, Class> uriToClass = new WeakHashMap<String, Class>();
           /** SchemaLocation to JBossXBBuilder binding class */
           private WeakHashMap<String, Class> schemaLocationToClass = new WeakHashMap<String, Class>();
          

          be WeakValueHashMap?

          • 2. Re: Registering schema with JBossXB

             

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

            I guess we could add an extra option to the SchemaResolverParser
             <propertry name="registerWithJBossXB">true</property>
            

            which would take the schema name from the annotation on the class/package
            and register the generated schema binding with JBossXB?

            This is now done, see SchemaResolverXBTestCase.
            But should there be a remove/unregister on uninstall of deployer?


            Yes.

            • 3. Re: Registering schema with JBossXB

               

              "alesj" wrote:
              "alesj" wrote:
              But should there be a remove/unregister on uninstall of deployer?

              Looking at DefaultSchemaResolver.
              Shouldn't this
               /** Namespace to JBossXBBuilder binding class */
               private WeakHashMap<String, Class> uriToClass = new WeakHashMap<String, Class>();
               /** SchemaLocation to JBossXBBuilder binding class */
               private WeakHashMap<String, Class> schemaLocationToClass = new WeakHashMap<String, Class>();
              

              be WeakValueHashMap?


              No. Because nothing will be holding a reference to the class other than the
              resolver normally. Therefore it would get garbage collected and the config removed.

              • 4. Re: Registering schema with JBossXB
                alesj

                 

                "adrian@jboss.org" wrote:
                Yes.

                Already there. ;-)

                • 5. Re: Registering schema with JBossXB
                  alesj

                   

                  "adrian@jboss.org" wrote:

                  No. Because nothing will be holding a reference to the class other than the
                  resolver normally. Therefore it would get garbage collected and the config removed.

                  Yeah, I've though of that.
                  But in the case when deployers register it, they also hold a ref to metadata class.
                  OK, but they can do its own clean up, like mentioned before.

                  btw: who then holds the ref to the namespace string key?

                  • 6. Re: Registering schema with JBossXB

                     

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

                    No. Because nothing will be holding a reference to the class other than the
                    resolver normally. Therefore it would get garbage collected and the config removed.

                    Yeah, I've though of that.
                    But in the case when deployers register it, they also hold a ref to metadata class.
                    OK, but they can do its own clean up, like mentioned before.

                    btw: who then holds the ref to the namespace string key?


                    You do in the parser (or you work it out again).

                    • 7. Re: Registering schema with JBossXB
                      alesj

                       

                      "adrian@jboss.org" wrote:
                      You do in the parser.

                      Meaning I should put a ref on the namespace string I get of JBossXmlSchema?

                      "adrian@jboss.org" wrote:
                      (or you work it out again).

                      "Suck it and see" who's holding the ref?


                      • 8. Re: Registering schema with JBossXB
                        alesj

                         

                        "alesj" wrote:

                        btw: who then holds the ref to the namespace string key?

                        OK, this - to have WeakHashMap on the string key - is a bug then. ;-)
                        See SingletonSchemaResolverFactory constructor.