Greetings -

I am writing my own persistence manager for my model mbeans.  Obviously, you need some 
sort of unique name to associate with each set of attributes for each MBean.  My 
intent was to use the MBean name, since it is there and already unique.  So, in my 
PersistenceManager.load(ModelMBeanInvoker, MBeanInfo) method, I need a way to get at 
the MBean name.

Based on the sun docs, it looked like the way to get it was from 
ModelMBeanInfo.getMBeanDescriptor().getFieldValue("name")

However, in my method, when I make the calls:

ModelMBeanInfo modelMBeanInfo = (ModelMBeanInfo)mbeanInfo;
  | Descriptor modelMBeanDescriptor = modelMBeanInfo.getMBeanDescriptor();
  | String mbeanName = 
(String)modelMBeanDescriptor.getFieldValue(ModelMBeanConstants.NAME);

mbeanName is set to my model mbean's class name.

Looking through the code (v3.2.3), I see in XMBeanMetaData.java in the build() method, 
line 194 is:

descr.setField("name", mmbClassName);

which leads me to believe it is intentional, and not something I am doing wrong in my 
configuration.

Is this name field supposed to yield the class name?  Am I looking for the ModelMBean 
name in the wrong spot?  Is there an alternate way of obtaining the ModelMBean name (I 
believe the ModelMBean itself is not yet registered, so calls to the MBeanServer to 
find out about it won't work yet.)

For now, I am setting the persistName to the mbean name in the configuration of the 
persistence descriptor, and then pull it from there in the persistence manager, so I 
can accomplish this without having the actual mbean name.  It is one more thing to 
configure for each model mbean, but no biggy; mostly, I am curious.

Thanks much,

Brett

View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3827997#3827997

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3827997


-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to