当前位置: 首页>>代码示例>>Java>>正文


Java ModelMBeanAttributeInfo类代码示例

本文整理汇总了Java中javax.management.modelmbean.ModelMBeanAttributeInfo的典型用法代码示例。如果您正苦于以下问题:Java ModelMBeanAttributeInfo类的具体用法?Java ModelMBeanAttributeInfo怎么用?Java ModelMBeanAttributeInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ModelMBeanAttributeInfo类属于javax.management.modelmbean包,在下文中一共展示了ModelMBeanAttributeInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createAttributeInfo

import javax.management.modelmbean.ModelMBeanAttributeInfo; //导入依赖的package包/类
@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);

  return info;
}
 
开发者ID:ampool,项目名称:monarch,代码行数:20,代码来源:ConfigAttributeInfo.java

示例2: addAttributeChangeNotificationListener

import javax.management.modelmbean.ModelMBeanAttributeInfo; //导入依赖的package包/类
public void addAttributeChangeNotificationListener(NotificationListener listener,
    String attributeName, Object handback)
    throws MBeanException, RuntimeOperationsException, IllegalArgumentException {
  if (listener == null)
    throw new RuntimeOperationsException(new IllegalArgumentException(
        LocalizedStrings.MX4JModelMBean_LISTENER_CANNOT_BE_NULL.toLocalizedString()));
  AttributeChangeNotificationFilter filter = new AttributeChangeNotificationFilter();
  if (attributeName != null) {
    filter.enableAttribute(attributeName);
  } else {
    MBeanAttributeInfo[] ai = m_modelMBeanInfo.getAttributes();
    for (int i = 0; i < ai.length; i++) {
      Descriptor d = ((ModelMBeanAttributeInfo) ai[i]).getDescriptor();
      filter.enableAttribute((String) d.getFieldValue("name"));
    }
  }

  getAttributeChangeBroadcaster().addNotificationListener(listener, filter, handback);

  Logger logger = getLogger();
  if (logger.isEnabledFor(Logger.DEBUG))
    logger.debug("Listener " + listener + " for attribute " + attributeName
        + " added successfully, handback is " + handback);
}
 
开发者ID:ampool,项目名称:monarch,代码行数:25,代码来源:MX4JModelMBean.java

示例3: removeAttributeChangeNotificationListener

import javax.management.modelmbean.ModelMBeanAttributeInfo; //导入依赖的package包/类
private void removeAttributeChangeNotificationListener(NotificationListener listener,
    String attributeName, Object handback)
    throws MBeanException, RuntimeOperationsException, ListenerNotFoundException {
  if (listener == null)
    throw new RuntimeOperationsException(new IllegalArgumentException(
        LocalizedStrings.MX4JModelMBean_LISTENER_CANNOT_BE_NULL.toLocalizedString()));
  AttributeChangeNotificationFilter filter = new AttributeChangeNotificationFilter();
  if (attributeName != null) {
    filter.enableAttribute(attributeName);
  } else {
    MBeanAttributeInfo[] ai = m_modelMBeanInfo.getAttributes();
    for (int i = 0; i < ai.length; i++) {
      Descriptor d = ((ModelMBeanAttributeInfo) ai[i]).getDescriptor();
      filter.enableAttribute((String) d.getFieldValue("name"));
    }
  }

  getAttributeChangeBroadcaster().removeNotificationListener(listener, filter, handback);

  Logger logger = getLogger();
  if (logger.isEnabledFor(Logger.DEBUG))
    logger.debug("Listener " + listener + " for attribute " + attributeName
        + " removed successfully, handback is " + handback);
}
 
开发者ID:ampool,项目名称:monarch,代码行数:25,代码来源:MX4JModelMBean.java

示例4: createAttributeInfo

import javax.management.modelmbean.ModelMBeanAttributeInfo; //导入依赖的package包/类
@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);

  return info;
}
 
开发者ID:ampool,项目名称:monarch,代码行数:20,代码来源:StatisticAttributeInfo.java

示例5: createAttributeInfo

import javax.management.modelmbean.ModelMBeanAttributeInfo; //导入依赖的package包/类
@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);
      
  return info;
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:27,代码来源:ConfigAttributeInfo.java

示例6: addAttributeChangeNotificationListener

import javax.management.modelmbean.ModelMBeanAttributeInfo; //导入依赖的package包/类
public void addAttributeChangeNotificationListener(NotificationListener listener, String attributeName, Object handback) throws MBeanException, RuntimeOperationsException, IllegalArgumentException
{
   if (listener == null) throw new RuntimeOperationsException(new IllegalArgumentException(LocalizedStrings.MX4JModelMBean_LISTENER_CANNOT_BE_NULL.toLocalizedString()));
   AttributeChangeNotificationFilter filter = new AttributeChangeNotificationFilter();
   if (attributeName != null)
   {
      filter.enableAttribute(attributeName);
   }
   else
   {
      MBeanAttributeInfo[] ai = m_modelMBeanInfo.getAttributes();
      for (int i = 0; i < ai.length; i++)
      {
         Descriptor d = ((ModelMBeanAttributeInfo)ai[i]).getDescriptor();
         filter.enableAttribute((String)d.getFieldValue("name"));
      }
   }

   getAttributeChangeBroadcaster().addNotificationListener(listener, filter, handback);

   Logger logger = getLogger();
   if (logger.isEnabledFor(Logger.DEBUG)) logger.debug("Listener " + listener + " for attribute " + attributeName + " added successfully, handback is " + handback);
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:24,代码来源:MX4JModelMBean.java

示例7: removeAttributeChangeNotificationListener

import javax.management.modelmbean.ModelMBeanAttributeInfo; //导入依赖的package包/类
private void removeAttributeChangeNotificationListener(NotificationListener listener, String attributeName, Object handback) throws MBeanException, RuntimeOperationsException, ListenerNotFoundException
{
   if (listener == null) throw new RuntimeOperationsException(new IllegalArgumentException(LocalizedStrings.MX4JModelMBean_LISTENER_CANNOT_BE_NULL.toLocalizedString()));
   AttributeChangeNotificationFilter filter = new AttributeChangeNotificationFilter();
   if (attributeName != null)
   {
      filter.enableAttribute(attributeName);
   }
   else
   {
      MBeanAttributeInfo[] ai = m_modelMBeanInfo.getAttributes();
      for (int i = 0; i < ai.length; i++)
      {
         Descriptor d = ((ModelMBeanAttributeInfo)ai[i]).getDescriptor();
         filter.enableAttribute((String)d.getFieldValue("name"));
      }
   }

   getAttributeChangeBroadcaster().removeNotificationListener(listener, filter, handback);

   Logger logger = getLogger();
   if (logger.isEnabledFor(Logger.DEBUG)) logger.debug("Listener " + listener + " for attribute " + attributeName + " removed successfully, handback is " + handback);
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:24,代码来源:MX4JModelMBean.java

示例8: createAttributeInfo

import javax.management.modelmbean.ModelMBeanAttributeInfo; //导入依赖的package包/类
@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);
      
  return info;
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:25,代码来源:StatisticAttributeInfo.java

示例9: getMBeanInfo

import javax.management.modelmbean.ModelMBeanAttributeInfo; //导入依赖的package包/类
@Override
public MBeanInfo getMBeanInfo() {
    try {
        ModelMBeanAttributeInfo[] attributes = new ModelMBeanAttributeInfo[0];
        ModelMBeanConstructorInfo[] constructors = new ModelMBeanConstructorInfo[] {
                new ModelMBeanConstructorInfo("-", this.getClass().getConstructor())
        };
        ModelMBeanOperationInfo[] operations = new ModelMBeanOperationInfo[] {
                new ModelMBeanOperationInfo("info", "-", new MBeanParameterInfo[0], Void.class.getName(), ModelMBeanOperationInfo.INFO),
                new ModelMBeanOperationInfo("action", "-", new MBeanParameterInfo[0], Void.class.getName(), ModelMBeanOperationInfo.ACTION),
                new ModelMBeanOperationInfo("actionInfo", "-", new MBeanParameterInfo[0], Void.class.getName(), ModelMBeanOperationInfo.ACTION_INFO),
                new ModelMBeanOperationInfo("unknown", "-", new MBeanParameterInfo[0], Void.class.getName(), ModelMBeanOperationInfo.UNKNOWN)
        };
        ModelMBeanNotificationInfo[] notifications = new ModelMBeanNotificationInfo[0];
        return new ModelMBeanInfoSupport(this.getClass().getName(), "-", attributes, constructors, operations, notifications);
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:20,代码来源:TestModelMBean.java

示例10: verifyNotifivation

import javax.management.modelmbean.ModelMBeanAttributeInfo; //导入依赖的package包/类
/**
 * Verify that notification which RequiredModelMBean is emitted is correct.
 */
private void verifyNotifivation(
    AttributeChangeNotification attributeChangeNotification,
    ModelMBeanAttributeInfo attributeInfo) {
    assertEquals(attributeChangeNotification.getAttributeName(),
        attributeInfo.getName());
    assertEquals(attributeChangeNotification.getAttributeType(),
        attributeInfo.getType());
    assertEquals(attributeChangeNotification.getNewValue(), "new value");
    assertNull(attributeChangeNotification.getOldValue());
    assertEquals(attributeChangeNotification.getType(),
        "jmx.attribute.change");
    assertEquals(attributeChangeNotification.getMessage(),
        "AttributeChangeDetected");
    assertEquals(attributeChangeNotification.getSequenceNumber(), 1);
}
 
开发者ID:freeVM,项目名称:freeVM,代码行数:19,代码来源:NotificationLoggingTest.java

示例11: testModelMBeanAttributeInfo

import javax.management.modelmbean.ModelMBeanAttributeInfo; //导入依赖的package包/类
/**
 * Verify default fields of descriptor from ModelMBeanAttributeInfo:
 * name=nameUsedInConstructor, displayName=nameUsedInConstructor and
 * descriptorType=attribute.
 */
public Result testModelMBeanAttributeInfo() throws Exception {
    Method getter = sampleClass.getMethod("getH", null);
    Method setter = sampleClass.getMethod("setH",
        new Class[] { String.class });
    final String name = "attribute name";
    ModelMBeanAttributeInfo attributeInfo = new ModelMBeanAttributeInfo(
        name, "description", getter, setter);
    descriptor = attributeInfo.getDescriptor();
    //descriptor.getFieldNames();
    assertEquals(descriptor.getFieldValue("name"), name);
    assertEquals(descriptor.getFieldValue("displayName"), name);
    assertEquals(descriptor.getFieldValue("descriptorType"), "attribute");
    assertEquals(descriptor.getFields().length, 3);
    commonCheck();
    return result();
}
 
开发者ID:freeVM,项目名称:freeVM,代码行数:22,代码来源:DefaultDescriptorTest.java

示例12: buildAttributeInfo

import javax.management.modelmbean.ModelMBeanAttributeInfo; //导入依赖的package包/类
/**
 * Builds an AttributeInfo in a default way
 * @param name
 * @param displayName
 * @param description
 * @param deflt
 * @param operName
 * @param signature
 * @return the default modelMBeanAttributeInfo object
 */
public static ModelMBeanAttributeInfo buildAttributeInfo(String name, String displayName, String description, String deflt, String operName, String signature){
	Descriptor attrDesc = new DescriptorSupport();
	attrDesc.setField("name", name);
	attrDesc.setField("descriptorType", "attribute");
	attrDesc.setField("default", deflt);
	attrDesc.setField("displayName", displayName);
	attrDesc.setField(
		"getMethod",
		operName);

	ModelMBeanAttributeInfo result=new ModelMBeanAttributeInfo(name,
	signature,
	description,
	true,
	false,
	false,
	attrDesc);
	return result;
}
 
开发者ID:ibissource,项目名称:iaf,代码行数:30,代码来源:JmxUtils.java

示例13: testAttributeFromInterface

import javax.management.modelmbean.ModelMBeanAttributeInfo; //导入依赖的package包/类
@Test
public void testAttributeFromInterface() throws Exception {
	ModelMBeanInfo inf = getMBeanInfoFromAssembler();
	ModelMBeanAttributeInfo attr = inf.getAttribute("Colour");
	assertTrue("The name attribute should be writable", attr.isWritable());
	assertTrue("The name attribute should be readable", attr.isReadable());
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:8,代码来源:AnnotationMetadataAssemblerTests.java

示例14: testAttributeDescriptionOnSetter

import javax.management.modelmbean.ModelMBeanAttributeInfo; //导入依赖的package包/类
@Test
public void testAttributeDescriptionOnSetter() throws Exception {
	ModelMBeanInfo inf = getMBeanInfoFromAssembler();
	ModelMBeanAttributeInfo attr = inf.getAttribute(AGE_ATTRIBUTE);
	assertEquals("The description for the age attribute is incorrect",
			"The Age Attribute", attr.getDescription());
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:8,代码来源:AbstractMetadataAssemblerTests.java

示例15: testAttributeDescriptionOnGetter

import javax.management.modelmbean.ModelMBeanAttributeInfo; //导入依赖的package包/类
@Test
public void testAttributeDescriptionOnGetter() throws Exception {
	ModelMBeanInfo inf = getMBeanInfoFromAssembler();
	ModelMBeanAttributeInfo attr = inf.getAttribute(NAME_ATTRIBUTE);
	assertEquals("The description for the name attribute is incorrect",
			"The Name Attribute", attr.getDescription());
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:8,代码来源:AbstractMetadataAssemblerTests.java


注:本文中的javax.management.modelmbean.ModelMBeanAttributeInfo类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。