Controlling the case of an attribute name

Is it possible in a standard mbean to control the case of the attribute name? For example, I have a simple MBean:

publicinterface EJBMBean{

public Stats getstats();

publicvoid setstats(Stats stats);

}

publicclass EJBimplements EJBMBean{

public Stats stats;

public EJB(Stats stats){

this.stats = stats;

}

public Stats getstats(){

return stats;

}

publicvoid setstats(Stats stats){

this.stats = stats;

}

}

I'm writing some mocks for a unit test of some mbeans in websphere, and the websphere mbeans have an attribute "stats", lower case. The only way to get my attribute name lower case is to make the get/set methods all lower case as shown above. Is there some other way to specify the attribute case if I want my method case as nornal (getStats/setStats) but have the attribute be lower case?

Thanks for any help,

Alper

[1682 byte] By [aakturea] at [2007-11-27 6:05:19]
# 1

I neglected to mention, maybe it's obvious, the issue is when I try to query for the mbean attribute as in:

StatsImpl attribute = (StatsImpl)serverProxy.getMBeanServer().getAttribute(objName, "stats");

I have to be consistent with websphere, so I have to use lower case attribute name "stats" here.

aakturea at 2007-7-12 16:51:07 > top of Java-index,Core,Monitoring & Management...
# 2

As far as I'm aware (never used Websphere) the attributes should all be lower case (i.e. "stats") and getters/setters should be camel case as in "getStats()".

So from that perspective your query looks ok. Or maybe I'm misunderstanding you?

I would think that you would need to cast the return type to "Stats" instead of "StatsImpl" as you are most likely getting a reference to remote proxy object. But again, I'm fairly clueless in Websphere.

Reagrds,

Eske

esorta at 2007-7-12 16:51:07 > top of Java-index,Core,Monitoring & Management...
# 3

Ya, that's what I thought too. But apparently, if you create a standard MBean, the attribute name you use when querying the mbean server, is matched with the case you used in your set/get methods. So if you have setValue/getValue, your attribute name should be referenced as "Value" in queries. However, you can use setvalue/getvalue, and your attribute name will be referenced as "value" in queries. More of an mild irritation than a real problem, as I can't use camel case in my mock mbean set/get methods, as I have to duplicate the attribute name in websphere of "stats".

aakturea at 2007-7-12 16:51:07 > top of Java-index,Core,Monitoring & Management...