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


Java DescriptorSupport类代码示例

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


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

示例1: createAttributeInfo

import javax.management.modelmbean.DescriptorSupport; //导入依赖的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: createAttributeInfo

import javax.management.modelmbean.DescriptorSupport; //导入依赖的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

示例3: main

import javax.management.modelmbean.DescriptorSupport; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
    boolean failed = false;
    String xmlDesc = "<DESCRIPTOR>"
            + "<FIELD name=\"field1\" value=\"dummy\">"
            + "</FIELD>"
            + "</DESCRIPTOR>";
    Locale loc = Locale.getDefault();
    try {
        Locale.setDefault(new Locale("tr", "TR"));
        new DescriptorSupport(xmlDesc);
    } catch (Exception e) {
        e.printStackTrace(System.out);
        failed = true;
    }finally{
        Locale.setDefault(loc);
    }

    if (!failed) {
        System.out.println("OK: all tests passed");
    } else {
        System.out.println("TEST FAILED");
        throw new IllegalArgumentException("Test Failed");
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:25,代码来源:DescriptorSupportXMLLocaleTest.java

示例4: createAttributeInfo

import javax.management.modelmbean.DescriptorSupport; //导入依赖的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

示例5: createAttributeInfo

import javax.management.modelmbean.DescriptorSupport; //导入依赖的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

示例6: commonCheck

import javax.management.modelmbean.DescriptorSupport; //导入依赖的package包/类
/**
 * Test xml conversions, isValid() and toString() methods of
 * DescriptorSupport at end of each test case.
 */
public void commonCheck() throws Exception {
    assertTrue(descriptor.isValid());
    DescriptorSupport descriptorSupport = new DescriptorSupport(descriptor
        .getFields());
    // verify DescriptorSupport(String[]) constructor.
    compareArrays(descriptor.getFields(), descriptorSupport.getFields());
    // verify DescriptorSupport(String xmlString) constructor.
    // System.out.println(descriptorSupport.toXMLString());
    DescriptorSupport descriptorSupport2 = new DescriptorSupport(
        descriptorSupport.toXMLString());
    assertTrue(compareArrays(descriptor.getFields(), descriptorSupport2
        .getFields()));
    // verify toString()
    String[] fieldAndValues = trimForStringArrays(descriptorSupport
        .toString().split(","));
    String[] fieldAndValues2 = trimForStringArrays(descriptorSupport
        .getFields());
    assertTrue(compareArrays(fieldAndValues, fieldAndValues2));
}
 
开发者ID:freeVM,项目名称:freeVM,代码行数:24,代码来源:DefaultDescriptorTest.java

示例7: buildAttributeInfo

import javax.management.modelmbean.DescriptorSupport; //导入依赖的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

示例8: getMBeanInfo

import javax.management.modelmbean.DescriptorSupport; //导入依赖的package包/类
@Override
public MBeanInfo getMBeanInfo() {
    List<MBeanAttributeInfo> attributeInfos = new ArrayList<>();
    for (ConfigItem item : serverConfigurationService.getConfigData().getItems()) {
        String type = item.getType();
        switch (type) {
            case ServerConfigurationService.TYPE_BOOLEAN:
                type = "boolean";
                break;
            case ServerConfigurationService.TYPE_INT:
                type = "int";
                break;
            case ServerConfigurationService.TYPE_STRING:
                type = "java.lang.String";
                break;
        }
        attributeInfos.add(new MBeanAttributeInfo(item.getName(), type, item.getDescription(), !item.isSecured(), true, false));
    }
    List<MBeanOperationInfo> operationInfos = new ArrayList<>();
    try {
        Method method = getClass().getMethod("addAttribute", String.class, String.class);
        operationInfos.add(new MBeanOperationInfo("addAttribute", method));
    } catch (NoSuchMethodException e) {
        // Ignore
    }
    Descriptor descriptor = new DescriptorSupport();
    descriptor.setField("immutableInfo", "false");
    return new MBeanInfo(getClass().getName(), "Sakai Server Configuration",
        attributeInfos.toArray(new MBeanAttributeInfo[]{}),
        null,
        operationInfos.toArray(new MBeanOperationInfo[]{}),
        null,
        descriptor);
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:35,代码来源:ConfigurationMBean.java

示例9: testFieldValue

import javax.management.modelmbean.DescriptorSupport; //导入依赖的package包/类
/**
 * TODO: add comments.
 * 
 * @throws Exception
 */
private void testFieldValue() throws Exception {
    String fieldName = "simple field";
    ArrayList arrayList = new ArrayList();
    String valueOfElement = "value";
    arrayList.add(valueOfElement);
    DescriptorSupport descriptorSupport = new DescriptorSupport(
        new String[] { fieldName }, new Object[] { arrayList });
    assertEquals(((ArrayList)descriptorSupport.getFieldValue(fieldName))
        .get(0), valueOfElement);
    descriptor = descriptorSupport;
    // TODO: following line throws exception
    // descriptorSupport.toXMLString();
    // commonCheck();
}
 
开发者ID:freeVM,项目名称:freeVM,代码行数:20,代码来源:DefaultDescriptorTest.java

示例10: buildGetterDescriptor

import javax.management.modelmbean.DescriptorSupport; //导入依赖的package包/类
/**
 * Builds a default Descriptor object for getter operations
 * @param name the name of the getter
 * @param klass
 * @return the descriptor
 */
private static Descriptor buildGetterDescriptor(
	String name,
	String klass) {
	Descriptor resultDesc = new DescriptorSupport();
	resultDesc.setField("name", name);
	resultDesc.setField("descriptorType", "operation");
	resultDesc.setField("class", klass);
	resultDesc.setField("role", "getter");
	return resultDesc;
}
 
开发者ID:ibissource,项目名称:iaf,代码行数:17,代码来源:JmxUtils.java

示例11: main

import javax.management.modelmbean.DescriptorSupport; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
    ImmutableDescriptor immutableEmpty = new ImmutableDescriptor();
    DescriptorSupport mutableEmpty = new DescriptorSupport();

    checkEmpty(union());
    checkEmpty(union(immutableEmpty));
    checkEmpty(union(mutableEmpty));
    checkEmpty(union(EMPTY_DESCRIPTOR, immutableEmpty, mutableEmpty));
    checkEmpty(union(null, immutableEmpty, null));

    ImmutableDescriptor immutableNumbers =
        new ImmutableDescriptor(new String[] {"one", "two", "three"},
                                new Object[] {1, 2, 3});
    final String[] noNames = null;
    DescriptorSupport mutableNumbers =
        new DescriptorSupport(immutableNumbers.getFieldNames(),
                              immutableNumbers.getFieldValues(noNames));
    ImmutableDescriptor immutableOne =
        new ImmutableDescriptor(Collections.singletonMap("one", 1));
    DescriptorSupport mutableOne =
        new DescriptorSupport(new String[] {"one"}, new Object[] {1});
    ImmutableDescriptor immutableTwo =
        new ImmutableDescriptor(Collections.singletonMap("two", 2));
    DescriptorSupport mutableTwo =
        new DescriptorSupport(new String[] {"two"}, new Object[] {2});
    ImmutableDescriptor immutableOneTwo =
        new ImmutableDescriptor(new String[] {"one", "two"},
                                new Object[] {1, 2});


    checkEqual(union(immutableNumbers), immutableNumbers);
    checkEqual(union(immutableNumbers, mutableNumbers), immutableNumbers);
    checkEqual(union(mutableNumbers, immutableNumbers), immutableNumbers);
    checkEqual(union(mutableEmpty, immutableEmpty, immutableNumbers,
                     mutableNumbers, immutableOne), immutableNumbers);
    checkEqual(union(immutableOne, immutableTwo, immutableNumbers),
               immutableNumbers);
    checkEquivalent(union(immutableOne, mutableNumbers), immutableNumbers);
    checkEquivalent(union(immutableOne, immutableTwo), immutableOneTwo);
    checkEquivalent(union(mutableOne, mutableTwo), immutableOneTwo);

    if (failure != null)
        throw new Exception("TEST FAILED: " + failure);
    System.out.println("TEST PASSED");
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:46,代码来源:UnionTest.java


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