Question

I am using JMX of spring Version 2.5 in which I am using JMX as shown below..

@ManagedOperation(description = "Mark the Entry corresponding ABC flow")
@ManagedOperationParameters(value = {
        @ManagedOperationParameter(name = "def", description = "Ids of the entries that needs to be STOP"),
        @ManagedOperationParameter(name = "Comments", description = "Note on why these entries are being marked as stop") })
public void abcstop(String def, String gtr){
    StringBuffer gfhtrPresent= jmxService.abcd(Ids, comments);
    if(idsNotPresent.length()>0) 
        throw new IOARuntimeException("<font color=red><b>No data found for the following id/id's </b></font>"+idsNotPresent);
}

Now I want to remove the @Managedoperation annaotation and want to configure it with in XML , please advsie how can I configure the @Managedoperation , as i wan the same functionality to be run from xml itself, Please advise. Folks please advise as I am stuck up any help would be appreciated

Was it helpful?

Solution

You can export the MBean using XML - see the documentation. But, AFAIK, there's no way with standard components to add descriptions like that.

You would have to implement your own MBeanInfoAssembler (or subclass one of the standard ones).

EDIT:

For example, the AbstractReflectiveMBeanInfoAssembler gets the operation description in createModelMBeanOperationInfo by calling getOperationDescription(). By default, this just returns the method name. The MetadataMBeanInfoAssembler (used for the annotations) overrides this method to get the description from the annotation.

So, you could subclass the MethodNameBasedMBeanInfoAssembler and implement the getOperationDescription() method to get the description from wherever you want (perhaps another property in the XML).

Similarly, the operation parameter descriptions are set up in getOperationParameters() so you would override that to build them. See the MetadataMBeanInfoAssembler to see how he does it from the annotation.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top