Results 1 to 1 of 1

Thread: Annotation based JMX: Defining descriptions of default method argument values

  1. #1
    Join Date
    Jan 2007
    Posts
    107

    Default Annotation based JMX: Defining descriptions of default method argument values

    Hi,

    I've seen the following example:

    Code:
    package org.springframework.jmx;
    
    import org.springframework.jmx.export.annotation.ManagedResource;
    import org.springframework.jmx.export.annotation.ManagedOperation;
    import org.springframework.jmx.export.annotation.ManagedAttribute;
    
    @ManagedResource(objectName="bean:name=testBean4", description="My Managed Bean", log=true,
        logFile="jmx.log", currencyTimeLimit=15, persistPolicy="OnUpdate", persistPeriod=200,
        persistLocation="foo", persistName="bar")
    public class AnnotationTestBean implements IJmxTestBean {
    
      private String name;
      private int age;
    
      @ManagedAttribute(description="The Age Attribute", currencyTimeLimit=15)
      public int getAge() {
        return age;
      }
    
      public void setAge(int age) {
        this.age = age;
      }
    
      @ManagedAttribute(description="The Name Attribute",
          currencyTimeLimit=20,
          defaultValue="bar",
          persistPolicy="OnUpdate")
      public void setName(String name) {
        this.name = name;
      }
    
      @ManagedAttribute(defaultValue="foo", persistPeriod=300)
      public String getName() {
        return name;
      }
    
      @ManagedOperation(description="Add two numbers")
      @ManagedOperationParameters({
        @ManagedOperationParameter(name = "x", description = "The first number"),
        @ManagedOperationParameter(name = "y", description = "The second number")})
      public int add(int x, int y) {
        return x + y;
      }
    
      public void dontExposeMe() {
        throw new RuntimeException();
      }
    }
    on:

    http://static.springframework.org/sp...rence/jmx.html

    and that works fine.

    However is there any way to populate the method argument fields in jconsole with default values? So instead of the field saying 'String' by default it will say 'Name'.

    I think I've seen this in jconsole before but I would like to know how to do this using Spring. Or is this not possible at all?

    Many thanks.

    UPDATE: Never mind. It seems I was thinking of something else. The above already achieves what I am asking for. Sorry!
    Last edited by Narada; Mar 8th, 2008 at 07:40 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •