3 Replies Latest reply on Jun 8, 2005 10:14 AM by starksm64

    Deployment Enhancement - Custom Attribute handler

    mike.chack

      I was interested on whether or not the following enhancement request is of interest to others.

      Problem. Our application platform has a database for common configuration data. It would be nice if there was some generic way to extend the \<attribute\> tag such that a custom handler could be invoked to get the data.

      e.g. \<atttribute handler="mydatahandler" name="xxx"\>some-key\</attribute\>


      In this case my custom handler, mydatahandler would use some-key to reference our configuration database, rather than treating it as a string literal. This makes it much easier to manage site specific configuration data.

      From an implementation standpoint, I was looking into whether or not I could use AOP as a means to intercept MBean provisioining and tag custom data with some unique string such as %% e.g. so the intereceptor would see which attributes need to be handled specially. While promising at first it seems like all of the access will typically be via reflection which is a bit of a pain for AOP.

      Sorry about the \, was't sure how to escape the tags.

      Any comments appreciated.

      Thanks

        • 1. Re: Deployment Enhancement - Custom Attribute handler
          starksm64

          Use the code tag to encapsulate xml.

          This looks like an extension to the existing attribute injection mechanism where instead of:

           <mbean code="org.jboss.test.jmx.proxy.ProxyTests"
           name="jboss.test:name=ProxyTestsAttribute">
           <depends optional-attribute-name="xxx"
           proxy-type="attribute">:name=ConfigService</depends>
           </mbean>
          


          there is a key
           <mbean code="org.jboss.test.jmx.proxy.ProxyTests"
           name="jboss.test:name=ProxyTestsAttribute">
           <depends optional-attribute-name="xxx"
           proxy-type="attribute"
           handler="mydatahandler"
           key="some-key">:name=ConfigService</depends>
           </mbean>
          


          where the handler knows how to extract the some-key value of type matching the attribute type from the dependency target.


          • 2. Re: Deployment Enhancement - Custom Attribute handler
            mike.chack

            Thanks for the reply.

            I assume that the myDataHandler would just be an mbean operation of the dependant service that took the some-key as its only argument.

            Is there any interest in doing this? Would this be something where you would like someone to make a contribution to the project?



            • 3. Re: Deployment Enhancement - Custom Attribute handler
              starksm64

              If you want to inject an attribute of the dependent target sevice then I would have a syntax like:

              <mbean code="org.jboss.test.jmx.proxy.ProxyTests"
               name="jboss.test:name=ProxyTestsAttribute">
               <depends optional-attribute-name="xxx"
               proxy-type="attribute"
               attributeName="SomeAttr">:name=ConfigService</depends>
               </mbean>
              


              No handler is needed to do this.

              The handler attribute type should just be some interface implementation that allows the attribute value to be obtained from the target service in whatever means it wants:

              interface DependentAttributeHandler
              {
               Object getAttribute(ObjectName targetService, String key);
              }
              


              I would be interested in seeing such a contribution.