JDK-4786777 : MBeanInfo could have way to mark attribute or operation as "disabled"
  • Type: Enhancement
  • Component: core-svc
  • Sub-Component: javax.management
  • Affected Version: 1.2.0
  • Priority: P5
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2002-12-02
  • Updated: 2005-09-01
  • Resolved: 2005-09-01
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6
6 b43Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Description
Rasmus Lund wrote:
> What about providing extra info on attributes and operations telling if they
> are enabled at the moment?
> 
> E.g. imagine a MBean with the following:
> 
> * Attribute: enablePooling (boolean)
> * Attribute: poolSize (int)
> * Attribute: debug (boolean)
> * Attribute: debugLevel (int)
> * Operation: refreshPool
> 
> Now. If enablePooling is set to false, I would someone reading
> poolSizeAttribute.isEnabled and refreshPoolOperation.isEnables to get false
> as return value. Likewise if debug is set to false, they should read
> debugLevelAttribute.isEabled to false.
> 
> This would make the automatic generation of user interfaces based on
> MBean-meta-info a lot easier.

Comments
EVALUATION Cannot fix for Tiger because of compatibility requirement with J2EE 1.4. Revisit for Mustang. ###@###.### 2004-02-10 Another way to address this would be as a side-effect of adding Descriptor support to all types of MBeans (see 6204469). We could establish a convention that if an attribute or operation has an entry "enabled" in its Descriptor, and the associated value is "false" (either the String "false" or Boolean.FALSE), then the attribute or operation is disabled. The advantage compared to the approach detailed in the Description is that it is basically transparent to a client that doesn't understand the convention. The main disadvantage is that it requires support for modifiable Descriptor entries. ###@###.### 2004-12-31 10:27:25 GMT The "enabled" Descriptor field is now standard and is the suggested way to handle this. ###@###.### 2005-07-19 09:39:11 GMT
31-12-2004

SUGGESTED FIX Possibly just document the "_" convention. Or, add a boolean "enabled" to the constructors of MBeanAttributeInfo and MBeanOperationInfo and an isEnabled() method. Adding a setEnabled method is not a good idea since MBean*Info objects should be immutable. Or, implement Descriptor support for all types of MBean and define a convention for disabled attributes and operations in the Descriptor. ###@###.### 2004-12-31 10:27:25 GMT
31-12-2004

WORK AROUND At present, a Dynamic MBean can simply remove disabled attributes and operations from its MBeanInfo, since the management interface of a Dynamic MBean can change at any time. However, that doesn't allow you to "grey out" those attributes and operations in a GUI. One workaround would be to introduce a convention that attributes or operations whose name begins with "_" are disabled. So when you set enablePooling to false, the poolSize attribute changes its name to _poolSize. If the GUI understands this convention, it can grey out the "_" elements.
01-09-2004

PUBLIC COMMENTS MBeanInfo could have way to mark attribute or operation as "disabled"
01-09-2004