0

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

user1633823
  • 347
  • 2
  • 5
  • 14

1 Answers1

1

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.

Gary Russell
  • 166,535
  • 14
  • 146
  • 179
  • @Garry Russell Thanks a lot can you please share an example of MBeanInfoAssembler, so that I can grasp more – user1633823 Jan 18 '14 at 04:45
  • Thanks a lot but my point was that can you please update a short example , can you please show me a small example which i can follow and grasp, that will be really helpful. – user1633823 Jan 19 '14 at 04:09
  • No; I don't have time to do your work for you; I think I gave you enough pointers. If you are not able to understand the concepts, I must ask why you need to eliminate the annotations. – Gary Russell Jan 19 '14 at 04:31
  • here what I grasp from your understanding..http://stackoverflow.com/questions/8910064/name-for-managedoperation-in-spring-jmx – user1633823 Jan 19 '14 at 05:00