當前位置: 首頁>>代碼示例>>Java>>正文


Java MBeanAttributeInfo類代碼示例

本文整理匯總了Java中javax.management.MBeanAttributeInfo的典型用法代碼示例。如果您正苦於以下問題:Java MBeanAttributeInfo類的具體用法?Java MBeanAttributeInfo怎麽用?Java MBeanAttributeInfo使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


MBeanAttributeInfo類屬於javax.management包,在下文中一共展示了MBeanAttributeInfo類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getType

import javax.management.MBeanAttributeInfo; //導入依賴的package包/類
/**
 * Get the type of an attribute of the object, from the metadata.
 *
 * @param oname
 * @param attName
 * @return null if metadata about the attribute is not found
 * @since 1.1
 */
public String getType(ObjectName oname, String attName) {
	String type = null;
	MBeanInfo info = null;
	try {
		info = server.getMBeanInfo(oname);
	} catch (Exception e) {
		log.info("Can't find metadata for object" + oname);
		return null;
	}

	MBeanAttributeInfo attInfo[] = info.getAttributes();
	for (int i = 0; i < attInfo.length; i++) {
		if (attName.equals(attInfo[i].getName())) {
			type = attInfo[i].getType();
			return type;
		}
	}
	return null;
}
 
開發者ID:how2j,項目名稱:lazycat,代碼行數:28,代碼來源:Registry.java

示例2: getMBeanInfo

import javax.management.MBeanAttributeInfo; //導入依賴的package包/類
@Override
public MBeanInfo getMBeanInfo() {

    MBeanAttributeInfo[] attributes = new MBeanAttributeInfo[] {

            new MBeanAttributeInfo("AutoEquipmentStatus", EquipmentStatusType.class.getName(), "EquipmentStatus parameter to be automatically send in CheckImeiResponse", true, true, false),
            new MBeanAttributeInfo("AutoEquipmentStatus_Value", String.class.getName(), "EquipmentStatus parameter to be automatically send in CheckImeiResponse", true, false, false),
            new MBeanAttributeInfo("OneNotificationFor100Dialogs", boolean.class.getName(),
                    "If true there will be only one notification per every 100 sent dialogs", true, true, true),
            new MBeanAttributeInfo("CurrentRequestDef", String.class.getName(), "Definition of the current request Dialog",
                    true, false, false),

    };

    MBeanParameterInfo[] putAutoEquipmentStatusParam = new MBeanParameterInfo[] { new MBeanParameterInfo("val", String.class.getName(), "EquipmentStatus value") };

    MBeanOperationInfo[] operations = new MBeanOperationInfo[] {
            new MBeanOperationInfo(
                    "putAutoEquipmentStatus",
                    "EquipmentStatus parameter to be automatically send in CheckImeiResponse: "
                            + "0:whiteListed,1:blackListed,2:greyListed",
                    putAutoEquipmentStatusParam, Void.TYPE.getName(), MBeanOperationInfo.ACTION),
            new MBeanOperationInfo("closeCurrentDialog", "Closing the current dialog", null, String.class.getName(), MBeanOperationInfo.ACTION)
    };
    return new MBeanInfo(TestCheckImeiServerMan.class.getName(), "CheckImeiServer test parameters management", attributes, null, operations, null);
}
 
開發者ID:RestComm,項目名稱:phone-simulator,代碼行數:27,代碼來源:TestCheckImeiServerStandardManMBean.java

示例3: getMBeanInfo

import javax.management.MBeanAttributeInfo; //導入依賴的package包/類
@Override
public MBeanInfo getMBeanInfo() {

    MBeanAttributeInfo[] attributes = new MBeanAttributeInfo[] {
            new MBeanAttributeInfo("NetworkNodeNumberAddress", String.class.getName(),
                                   "NetworkNodeNumber address parameter for response",
                                   true, true, false), };

    MBeanParameterInfo[] performSRIResponseParam = new MBeanParameterInfo[] { };

    MBeanOperationInfo[] operations = new MBeanOperationInfo[] {
            new MBeanOperationInfo("performSendRoutingInfoForLCSResponse", "Send Routing Information for LCS response",
                                   performSRIResponseParam, String.class.getName(), MBeanOperationInfo.ACTION),
             };

    return new MBeanInfo(TestMapLcsServerMan.class.getName(), "MapLcsServer test parameters management", attributes, null, operations, null);
}
 
開發者ID:RestComm,項目名稱:phone-simulator,代碼行數:18,代碼來源:TestMapLcsServerStandardManMBean.java

示例4: getMBeanInfo

import javax.management.MBeanAttributeInfo; //導入依賴的package包/類
@Override
public MBeanInfo getMBeanInfo() {

    // TODO: Put real attributes and operations

    MBeanAttributeInfo[] attributes = new MBeanAttributeInfo[] {
            new MBeanAttributeInfo("AddressNature", AddressNatureType.class.getName(),
                                   "AddressNature parameter for mlcNumber creating",
                                   true, true, false),
            new MBeanAttributeInfo("NumberingPlanType", NumberingPlanMapType.class.getName(),
                                   "NumberingPlanType parameter for mlcNumber creating",
                                   true, true, false),
            new MBeanAttributeInfo("NumberingPlan", String.class.getName(),
                                   "NumberingPlan parameter for mlcNumber creating",
                                   true, true, false), };

    MBeanParameterInfo[] performSRIRequestParam = new MBeanParameterInfo[] {
                   new MBeanParameterInfo("addressIMSI", String.class.getName(), "Address for IMSI") };

    MBeanOperationInfo[] operations = new MBeanOperationInfo[] {
            new MBeanOperationInfo("performSendRoutingInfoForLCSRequest", "Send Routing Information for LCS request",
                                   performSRIRequestParam, String.class.getName(), MBeanOperationInfo.ACTION),
             };

    return new MBeanInfo(TestMapLcsClientMan.class.getName(), "MapLcsClient test parameters management", attributes, null, operations, null);
}
 
開發者ID:RestComm,項目名稱:phone-simulator,代碼行數:27,代碼來源:TestMapLcsClientStandardManMBean.java

示例5: get

import javax.management.MBeanAttributeInfo; //導入依賴的package包/類
MBeanInfo get() {
  curRecNo = 0;
  for (MetricsRecordImpl rec : recs) {
    for (MetricsTag t : rec.tags()) {
      attrs.add(newAttrInfo("tag."+ t.name(), t.description(),
                "java.lang.String"));
    }
    for (AbstractMetric m : rec.metrics()) {
      m.visit(this);
    }
    ++curRecNo;
  }
  MetricsSystemImpl.LOG.debug(attrs);
  MBeanAttributeInfo[] attrsArray = new MBeanAttributeInfo[attrs.size()];
  return new MBeanInfo(name, description, attrs.toArray(attrsArray),
                       null, null, null); // no ops/ctors/notifications
}
 
開發者ID:nucypher,項目名稱:hadoop-oss,代碼行數:18,代碼來源:MBeanInfoBuilder.java

示例6: getName

import javax.management.MBeanAttributeInfo; //導入依賴的package包/類
@Override
public String getName() {
    if (_Name == null) {

        _Name = super.getName();

        if (_Name == null) {
            return _Name;
        }

        MBeanAttributeInfo info = getInfo();
        String prefix = NAME_PREFIX_GET;
        if (info.isIs()) {
            prefix = NAME_PREFIX_IS;
        }

        _Name = prefix + _Name;
    }

    return _Name;
}
 
開發者ID:baloise,項目名稱:eZooKeeper,代碼行數:22,代碼來源:MBeanAttributeDoc.java

示例7: getAttributes

import javax.management.MBeanAttributeInfo; //導入依賴的package包/類
public List<MBeanAttributeDoc> getAttributes() {

        if (_Attributes == null) {
            MBeanAttributeInfo[] attributeInfos = getInfo().getAttributes();

            if (attributeInfos == null || attributeInfos.length == 0) {
                return Collections.emptyList();
            }

            _Attributes = new ArrayList<MBeanAttributeDoc>(attributeInfos.length);

            for (MBeanAttributeInfo attributeInfo : attributeInfos) {
                MBeanAttributeDoc attributeDoc = new MBeanAttributeDoc(attributeInfo);
                _Attributes.add(attributeDoc);
            }
        }

        return _Attributes;
    }
 
開發者ID:baloise,項目名稱:eZooKeeper,代碼行數:20,代碼來源:MBeanDoc.java

示例8: getDescription

import javax.management.MBeanAttributeInfo; //導入依賴的package包/類
@Override
protected String getDescription(final MBeanAttributeInfo info) {
    switch (info.getName()) {
    case "Name":
        return "The name of this buffer.";
    case "SizeOfData":
        return "The data size of this buffer.";
    case "SizeOfStorage":
        return "The storage size of this buffer.";
    case "TimeCreatedDate":
        return "The time this buffer has been created.";
    case "TimeCreatedMillis":
        return "The time this buffer has been created in milliseconds.";
    case "TimeReadDate":
        return "The last time this buffer has been read or accessed.";
    case "TimeReadMillis":
        return "The last time this buffer has been read or accessed in milliseconds.";
    case "TimeWrittenDate":
        return "The last time this buffer has been written.";
    case "TimeWrittenMillis":
        return "The last time this buffer has been written in milliseconds.";
    default:
        return null;
    }
}
 
開發者ID:christian-schlichtherle,項目名稱:truevfs,代碼行數:26,代碼來源:JmxBufferView.java

示例9: getType

import javax.management.MBeanAttributeInfo; //導入依賴的package包/類
/** Get the type of an attribute of the object, from the metadata.
 *
 * @param oname
 * @param attName
 * @return null if metadata about the attribute is not found
 * @since 1.1
 */
public String getType( ObjectName oname, String attName )
{
    String type=null;
    MBeanInfo info=null;
    try {
        info=server.getMBeanInfo(oname);
    } catch (Exception e) {
        log.info( "Can't find metadata for object" + oname );
        return null;
    }

    MBeanAttributeInfo attInfo[]=info.getAttributes();
    for( int i=0; i<attInfo.length; i++ ) {
        if( attName.equals(attInfo[i].getName())) {
            type=attInfo[i].getType();
            return type;
        }
    }
    return null;
}
 
開發者ID:liaokailin,項目名稱:tomcat7,代碼行數:28,代碼來源:Registry.java

示例10: addAttributeChangeNotificationListener

import javax.management.MBeanAttributeInfo; //導入依賴的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

示例11: removeAttributeChangeNotificationListener

import javax.management.MBeanAttributeInfo; //導入依賴的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

示例12: printAllValues

import javax.management.MBeanAttributeInfo; //導入依賴的package包/類
/**
 * print all attributes' values
 */
public void printAllValues() throws Exception {
  err("List of all the available keys:");

  Object val = null;

  for (ObjectName oname : hadoopObjectNames) {
    err(">>>>>>>>jmx name: " + oname.getCanonicalKeyPropertyListString());
    MBeanInfo mbinfo = mbsc.getMBeanInfo(oname);
    MBeanAttributeInfo[] mbinfos = mbinfo.getAttributes();

    for (MBeanAttributeInfo mb : mbinfos) {
      val = mbsc.getAttribute(oname, mb.getName());
      System.out.format(format, mb.getName(), (val==null)?"":val.toString());
    }
  }
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:20,代碼來源:JMXGet.java

示例13: printAllMatchedAttributes

import javax.management.MBeanAttributeInfo; //導入依賴的package包/類
public void printAllMatchedAttributes(String attrRegExp) throws Exception {
  err("List of the keys matching " + attrRegExp + " :");
  Object val = null;
  Pattern p = Pattern.compile(attrRegExp);
  for (ObjectName oname : hadoopObjectNames) {
    err(">>>>>>>>jmx name: " + oname.getCanonicalKeyPropertyListString());
    MBeanInfo mbinfo = mbsc.getMBeanInfo(oname);
    MBeanAttributeInfo[] mbinfos = mbinfo.getAttributes();
    for (MBeanAttributeInfo mb : mbinfos) {
      if (p.matcher(mb.getName()).lookingAt()) {
        val = mbsc.getAttribute(oname, mb.getName());
        System.out.format(format, mb.getName(), (val == null) ? "" : val.toString());
      }
    }
  }
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:17,代碼來源:JMXGet.java

示例14: printMBeanInfo

import javax.management.MBeanAttributeInfo; //導入依賴的package包/類
private void printMBeanInfo(MBeanInfo mbInfo) {
    System.out.println("Description " + mbInfo.getDescription());

    for (MBeanConstructorInfo ctor : mbInfo.getConstructors()) {
        System.out.println("Constructor " + ctor.getName());
    }

    for (MBeanAttributeInfo att : mbInfo.getAttributes()) {
        System.out.println("Attribute " + att.getName()
        + " [" + att.getType() + "]");
    }

    for (MBeanOperationInfo oper : mbInfo.getOperations()) {
        System.out.println("Operation " + oper.getName());
    }

    for (MBeanNotificationInfo notif : mbInfo.getNotifications()) {
        System.out.println("Notification " + notif.getName());
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:21,代碼來源:MXBeanInteropTest2.java

示例15: fetchKafkaMetrics

import javax.management.MBeanAttributeInfo; //導入依賴的package包/類
private static void fetchKafkaMetrics(String host, String jmxPort, String metric)
    throws Exception {

  Map<String, String[]> env = new HashMap<>();
  JMXServiceURL address = new JMXServiceURL(
      "service:jmx:rmi://" + host + "/jndi/rmi://" + host + ":" + jmxPort + "/jmxrmi");
  JMXConnector connector = JMXConnectorFactory.connect(address, env);
  MBeanServerConnection mbs = connector.getMBeanServerConnection();


  ObjectName name = ObjectName.getInstance(metric);
  MBeanInfo beanInfo = mbs.getMBeanInfo(name);
  for (MBeanAttributeInfo attributeInfo : beanInfo.getAttributes()) {
    Object obj = mbs.getAttribute(name, attributeInfo.getName());
    System.out.println(" attributeName = " + attributeInfo.getName() + " " + obj.toString());
  }
}
 
開發者ID:pinterest,項目名稱:doctorkafka,代碼行數:18,代碼來源:MetricsFetcher.java


注:本文中的javax.management.MBeanAttributeInfo類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。