Example usage for javax.management.modelmbean ModelMBeanAttributeInfo ModelMBeanAttributeInfo

List of usage examples for javax.management.modelmbean ModelMBeanAttributeInfo ModelMBeanAttributeInfo

Introduction

In this page you can find the example usage for javax.management.modelmbean ModelMBeanAttributeInfo ModelMBeanAttributeInfo.

Prototype

public ModelMBeanAttributeInfo(String name, String type, String description, boolean isReadable,
        boolean isWritable, boolean isIs, Descriptor descriptor) 

Source Link

Document

Constructs a ModelMBeanAttributeInfo object.

Usage

From source file:org.apache.geode.admin.jmx.internal.ConfigAttributeInfo.java

@Override
public ModelMBeanAttributeInfo createAttributeInfo() {
    Descriptor desc = new DescriptorSupport(
            new String[] { "name=" + this.displayName, "descriptorType=attribute", "currencyTimeLimit=-1", // always stale
                    "displayName=" + this.displayName, "getMethod=getJmxValue", "setMethod=setJmxValue" });

    Assert.assertTrue(this.config != null, "Config target object is null!");
    desc.setField("targetObject", this.config);

    ModelMBeanAttributeInfo info = new ModelMBeanAttributeInfo(this.displayName, // name
            this.type, // type
            this.description, // description
            this.readable, // isReadable
            this.writeable, // isWritable
            this.is, // isIs
            desc);// w  ww  .jav a  2s  .c  o  m

    return info;
}

From source file:org.apache.geode.admin.jmx.internal.StatisticAttributeInfo.java

@Override
public ModelMBeanAttributeInfo createAttributeInfo() {
    Descriptor desc = new DescriptorSupport(
            new String[] { "name=" + this.displayName, "descriptorType=attribute", "currencyTimeLimit=-1", // always stale
                    "displayName=" + this.displayName, "getMethod=getValue" });

    Assert.assertTrue(this.stat != null, "Stat target object is null!");
    desc.setField("targetObject", this.stat);

    ModelMBeanAttributeInfo info = new ModelMBeanAttributeInfo(this.displayName, // name
            this.type, // type
            this.description, // description
            this.readable, // isReadable
            this.writeable, // isWritable
            this.is, // isIs
            desc);//from   w  w w . jav a 2s.c  o m

    return info;
}

From source file:org.sakaiproject.kernel.component.core.SharedClassLoaderContainer.java

/**
 * Create the the MBean Info for the Shared ClassLoader so that the methods
 * and properties are accessible via JMX.
 * //from   ww w .j  a  v  a2 s.  c o  m
 * @return a new MBeanInfo structure
 */
private ModelMBeanInfo createMBeanInfo() {
    Descriptor sharedClassLoader = new DescriptorSupport(
            new String[] { "name=SharedClassLoader", "descriptorType=attribute", "default=null",
                    "displayName=Shared Class Loader", "getMethod=getManagedObject" });

    ModelMBeanAttributeInfo[] mmbai = new ModelMBeanAttributeInfo[1];
    mmbai[0] = new ModelMBeanAttributeInfo("SharedClassLoader", ClassLoader.class.getName(),
            "Shared Class Loader", true, false, false, sharedClassLoader);

    ModelMBeanOperationInfo[] mmboi = new ModelMBeanOperationInfo[1];

    mmboi[0] = new ModelMBeanOperationInfo("getManagedObject", "Get the Shared Class Loader", null,
            ClassLoader.class.getName(), ModelMBeanOperationInfo.INFO);

    return new ModelMBeanInfoSupport(this.getClass().getName(), "Sakai Shared Classloader", mmbai, null, mmboi,
            null);
}

From source file:org.sakaiproject.kernel.component.KernelLifecycle.java

/**
 * Create the the MBean Info for the Kernel so that the methods and properties are accessable via
 * JMX.//from   w w w . jav a  2  s . c o  m
 *
 * @return a new MBeanInfo structure
 */
private ModelMBeanInfo createMBeanInfo() {
    Descriptor lastLoadDateDesc = new DescriptorSupport(
            new String[] { "name=LastLoadDate", "descriptorType=attribute", "default=0",
                    "displayName=Last Load Date", "getMethod=getLastLoadDate" });
    Descriptor lastLoadTimeDesc = new DescriptorSupport(new String[] { "name=LastLoadTime",
            "descriptorType=attribute", "default=0", "displayName=Last Load Time", "getMethod=getLoadTime" });

    ModelMBeanAttributeInfo[] mmbai = new ModelMBeanAttributeInfo[2];
    mmbai[0] = new ModelMBeanAttributeInfo("LastLoadDate", "java.util.Date", "Last Load Date", true, false,
            false, lastLoadDateDesc);

    mmbai[1] = new ModelMBeanAttributeInfo("LastLoadTime", "java.lang.Long", "Last Load Time", true, false,
            false, lastLoadTimeDesc);

    ModelMBeanOperationInfo[] mmboi = new ModelMBeanOperationInfo[7];

    mmboi[0] = new ModelMBeanOperationInfo("start", "Start the Kernel", null, "void",
            ModelMBeanOperationInfo.ACTION);
    mmboi[1] = new ModelMBeanOperationInfo("stop", "Stop the Kernel", null, "void",
            ModelMBeanOperationInfo.ACTION);
    mmboi[2] = new ModelMBeanOperationInfo("getManagedObject", "Get the Current Kernel", null,
            Kernel.class.getName(), ModelMBeanOperationInfo.INFO);

    mmboi[3] = new ModelMBeanOperationInfo("addKernelLifecycleListener",
            "Add a listener to the kernel lifecycle",
            new MBeanParameterInfo[] { new MBeanParameterInfo("Lifecycle Listener",
                    CommonLifecycleListener.class.getName(), "The Lifecycle Listener to be added") },
            "void", ModelMBeanOperationInfo.ACTION);
    mmboi[4] = new ModelMBeanOperationInfo("removeKernelLifecycleListener",
            "Remove a listener to the kernel lifecycle",
            new MBeanParameterInfo[] { new MBeanParameterInfo("Lifecycle Listener",
                    CommonLifecycleListener.class.getName(), "The Lifecycle Listener to be removed") },
            "void", ModelMBeanOperationInfo.ACTION);
    mmboi[5] = new ModelMBeanOperationInfo("getLastLoadDate", "The date the kernel was last loaded", null,
            "java.util.Date", ModelMBeanOperationInfo.INFO);
    mmboi[6] = new ModelMBeanOperationInfo("getLoadTime", "The time it took to load the kernel", null, "long",
            ModelMBeanOperationInfo.INFO);

    /*
     * mmboi[1] = new ModelMBeanOperationInfo("decPanelValue", "decrement the meter value", null,
     * "void", ModelMBeanOperationInfo.ACTION ); mmboi[2] = new
     * ModelMBeanOperationInfo("getPanelValue", "getter for PanelValue", null,"Integer",
     * ModelMBeanOperationInfo.INFO); MBeanParameterInfo [] mbpi = new MBeanParameterInfo[1];
     * mbpi[0] = new MBeanParameterInfo("inVal", "java.lang.Integer", "value to set"); mmboi[3] =
     * new ModelMBeanOperationInfo("setPanelValue", "setter for PanelValue", mbpi, "void",
     * ModelMBeanOperationInfo.ACTION); ModelMBeanConstructorInfo [] mmbci = new
     * ModelMBeanConstructorInfo[1]; mmbci[0] = new ModelMBeanConstructorInfo("ClickMeterMod",
     * "constructor for Model Bean Sample", null);
     */

    return new ModelMBeanInfoSupport(this.getClass().getName(), "Sakai Kernel", mmbai, null, mmboi, null);
}