本文整理汇总了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;
}
示例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);
}
示例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);
}
示例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);
}
示例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
}
示例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;
}
示例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;
}
示例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;
}
}
示例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;
}
示例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);
}
示例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);
}
示例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());
}
}
}
示例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());
}
}
}
}
示例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());
}
}
示例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());
}
}