commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bill Barker (JIRA)" <j...@apache.org>
Subject [jira] Commented: (MODELER-10) [modeler] DTD violation when using simple wrapping
Date Mon, 05 Jun 2006 00:26:30 GMT
    [ http://issues.apache.org/jira/browse/MODELER-10?page=comments#action_12414674 ] 

Bill Barker commented on MODELER-10:
------------------------------------

The 'domain' attribute is for defining the metadata.  I see nowhere in the docs where it claims
that it will be used loadMBeans.  The xml file format for loadMBeans doesn't actually have
a published DTD, and it's just a coincidence that the tag name is the same as for loadMetadata.
 In fact, AFAIK, using the 'name' field in loadMBeans is an undocumented option.  What you
are trying to do would fail really badly if you had a more complex example, and should log
errors even with your example.

For your bad example, what you want is:
  <mbeans-descriptors>
  <mbean name="Pool"
            objectName="myNodDefaultDomain:name=Pool"
            className="my.package.Pool"
          description="Object Pool"
               domain="myNonDefaultDomain"
                group="dontCare"
                 type="dontCare">

<attribute name="Size"
          description="number of currently pooled objects"
                 type="java.lang.Integer"
            writeable="true"/>

</mbean>
</mbeans-descriptors>


> [modeler] DTD violation when using simple wrapping
> --------------------------------------------------
>
>          Key: MODELER-10
>          URL: http://issues.apache.org/jira/browse/MODELER-10
>      Project: Commons Modeler
>         Type: Bug

>  Environment: Operating System: other
> Platform: Other
>     Reporter: L. Hahn
>  Attachments: modeler.diff.bz2
>
> - using MBean implementation of sun j2sdk 1.5.0_02 win 32 bit
> When just wrapping a class without overriding BaseModelMBean, a working
> configuration looks like this:
> -------------------- 8< ----------------------
> <mbeans-descriptors>
>   <mbean         name="myNonDefaultDomain:name=Pool"
>             className="dontCare"
>           description="Object Pool"
>                domain="dontCare"
>                 group="dontCare"
>                 code="my.package.Pool"
>                  type="dontCare">
>     <attribute   name="Size"
>           description="number of currently pooled objects"
>                  type="java.lang.Integer"
>             writeable="true"/>
>   </mbean>
> </mbeans-descriptors>
> -------------------------- >8 ------------------------
> The class my.package.Pool:
> -------------------- 8< ----------------------
> package my.package;
> public class Pool
> {
>   Integer size = new Integer(42);
>   public Pool(){}
>   
>   public Integer getSize() {
>     return size;
>   }
>   public void setSize(Integer size)
>   {
>     this.size = size;
>   }
> }
> -------------------------- >8 ------------------------
> The code to register the MBean inside the platform MBean server:
> -------------------------- 8< ------------------------
>       URL url= this.getClass().getResource("MBeanConfig.xml");
>       Registry registry = Registry.getRegistry(null, null);
>       registry.setMBeanServer(ManagementFactory.getPlatformMBeanServer());
>       registry.loadMetadata(url);
>       registry.loadMBeans(url);
> --------------------------- >8 -----------------------
> The field viewed with jconsole (local connected) is
> MBeans=>Tree=>myNonDefaultDomain=>Pool=>size = 42
> Following the API-Docs one would expect
> -------------------- 8< ----------------------
> <mbeans-descriptors>
>   <mbean         name="Pool"
>             className="my.package.Pool"
>           description="Object Pool"
>                domain="myNonDefaultDomain"
>                 group="dontCare"
>                  type="dontCare">
>     <attribute   name="Size"
>           description="number of currently pooled objects"
>                  type="java.lang.Integer"
>             writeable="true"/>
>   </mbean>
> </mbeans-descriptors>
> -------------------------- >8 ------------------------

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message