/**
* 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;
}
java类javax.management.MBeanAttributeInfo的实例源码
Registry.java 文件源码
项目:lazycat
阅读 29
收藏 0
点赞 0
评论 0
TestCheckImeiServerStandardManMBean.java 文件源码
项目:phone-simulator
阅读 28
收藏 0
点赞 0
评论 0
@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);
}
TestMapLcsServerStandardManMBean.java 文件源码
项目:phone-simulator
阅读 24
收藏 0
点赞 0
评论 0
@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);
}
TestMapLcsClientStandardManMBean.java 文件源码
项目:phone-simulator
阅读 24
收藏 0
点赞 0
评论 0
@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);
}
MBeanInfoBuilder.java 文件源码
项目:hadoop-oss
阅读 25
收藏 0
点赞 0
评论 0
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
}
MBeanAttributeDoc.java 文件源码
项目:eZooKeeper
阅读 23
收藏 0
点赞 0
评论 0
@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;
}
MBeanDoc.java 文件源码
项目:eZooKeeper
阅读 27
收藏 0
点赞 0
评论 0
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;
}
JmxBufferView.java 文件源码
项目:truevfs
阅读 31
收藏 0
点赞 0
评论 0
@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;
}
}
Registry.java 文件源码
项目:tomcat7
阅读 30
收藏 0
点赞 0
评论 0
/** 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;
}
MX4JModelMBean.java 文件源码
项目:monarch
阅读 27
收藏 0
点赞 0
评论 0
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);
}
MX4JModelMBean.java 文件源码
项目:monarch
阅读 25
收藏 0
点赞 0
评论 0
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);
}
Registry.java 文件源码
项目:apache-tomcat-7.0.73-with-comment
阅读 32
收藏 0
点赞 0
评论 0
/** 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;
}
JMXGet.java 文件源码
项目:hadoop
阅读 26
收藏 0
点赞 0
评论 0
/**
* 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());
}
}
}
JMXGet.java 文件源码
项目:hadoop
阅读 25
收藏 0
点赞 0
评论 0
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());
}
}
}
}
MXBeanInteropTest2.java 文件源码
项目:openjdk-jdk10
阅读 28
收藏 0
点赞 0
评论 0
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());
}
}
MBeanInfoBuilder.java 文件源码
项目:hadoop
阅读 27
收藏 0
点赞 0
评论 0
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
}
MetricsFetcher.java 文件源码
项目:doctorkafka
阅读 22
收藏 0
点赞 0
评论 0
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());
}
}
MustBeValidCommand.java 文件源码
项目:jdk8u-jdk
阅读 28
收藏 0
点赞 0
评论 0
public static void main(String[] args) throws Exception {
// Instantiate the MBean server
//
final MBeanAttributeInfo[] atts = makeAttInfos(attributes);
final MBeanConstructorInfo[] ctors = makeCtorInfos(constructors);
final MBeanOperationInfo[] ops = makeOpInfos(operations);
final MBeanNotificationInfo[] notifs =
makeNotifInfos(notificationclasses);
for (int i=0; i<mbeanclasses.length;i++) {
System.out.println("Create an MBeanInfo: " + mbeanclasses[i][0]);
final MBeanInfo mbi =
new MBeanInfo(mbeanclasses[i][1],mbeanclasses[i][0],
atts, ctors, ops, notifs);
}
// Test OK!
//
System.out.println("All MBeanInfo successfuly created!");
System.out.println("Bye! Bye!");
}
MXBeanInteropTest2.java 文件源码
项目:jdk8u-jdk
阅读 32
收藏 0
点赞 0
评论 0
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());
}
}
AnnotatedStandardMBean.java 文件源码
项目:metrics-tomcat
阅读 24
收藏 0
点赞 0
评论 0
/** {@inheritDoc} */
@Override
protected String getDescription(final MBeanAttributeInfo info) {
String descr = info.getDescription();
Method m = getMethod(getMBeanInterface(),
"get" + info.getName().substring(0, 1).toUpperCase() + info.getName().substring(1));
if (m == null) {
m = getMethod(getMBeanInterface(),
"is" + info.getName().substring(0, 1).toUpperCase() + info.getName().substring(1));
}
if (m == null) {
m = getMethod(getMBeanInterface(),
"does" + info.getName().substring(0, 1).toUpperCase() + info.getName().substring(1));
}
if (m != null) {
Description d = m.getAnnotation(Description.class);
if (d != null) {
descr = d.value();
}
}
return descr;
}
AnnotationTest.java 文件源码
项目:openjdk-jdk10
阅读 33
收藏 0
点赞 0
评论 0
private static void check(MBeanServer mbs, ObjectName on) throws Exception {
MBeanInfo mbi = mbs.getMBeanInfo(on);
// check the MBean itself
check(mbi);
// check attributes
MBeanAttributeInfo[] attrs = mbi.getAttributes();
for (MBeanAttributeInfo attr : attrs) {
check(attr);
if (attr.getName().equals("ReadOnly"))
check("@Full", attr.getDescriptor(), expectedFullDescriptor);
}
// check operations
MBeanOperationInfo[] ops = mbi.getOperations();
for (MBeanOperationInfo op : ops) {
check(op);
check(op.getSignature());
}
MBeanConstructorInfo[] constrs = mbi.getConstructors();
for (MBeanConstructorInfo constr : constrs) {
check(constr);
check(constr.getSignature());
}
}
TestCheckImeiClientStandardManMBean.java 文件源码
项目:phone-simulator
阅读 24
收藏 0
点赞 0
评论 0
@Override
public MBeanInfo getMBeanInfo() {
MBeanAttributeInfo[] attributes = new MBeanAttributeInfo[] {
// TODO mnowa: add/correct attributes here
new MBeanAttributeInfo("Imei", String.class.getName(), "IMEI's digits string", true, true, false),
new MBeanAttributeInfo("MapProtocolVersion", MapProtocolVersion.class.getName(), "MAP protocol version", true, true, false),
new MBeanAttributeInfo("MapProtocolVersion_Value", String.class.getName(), "MAP protocol version", true, false, false),
new MBeanAttributeInfo(
"CheckImeiClientAction",
CheckImeiClientAction.class.getName(),
"The mode of CheckImeiClient work. When manual response user can manually send CheckImei request, when VAL_AUTO_SendCheckImeiRequest the tester sends CheckImei requests without dealay (load test)",
true, true, false),
new MBeanAttributeInfo(
"CheckImeiClientAction_Value",
String.class.getName(),
"The mode of CheckImeiClient work. When manual response user can manually send CheckImei request, when VAL_AUTO_SendCheckImeiRequest the tester sends CheckImei requests without dealay (load test)",
true, false, false),
new MBeanAttributeInfo("MaxConcurrentDialogs", int.class.getName(), "The count of maximum active MAP dialogs when the auto sending mode", true,
true, false),
new MBeanAttributeInfo("OneNotificationFor100Dialogs", boolean.class.getName(),
"If true there will be only one notification per every 100 sent dialogs (recommended for the auto sending mode)", true, true, true),
};
MBeanParameterInfo[] performCheckImeiParam = new MBeanParameterInfo[] { new MBeanParameterInfo("imei", String.class.getName(), "IMEI's digits string")};
MBeanParameterInfo[] signString = new MBeanParameterInfo[] { new MBeanParameterInfo("val", String.class.getName(), "Index number or value") };
MBeanOperationInfo[] operations = new MBeanOperationInfo[] {
new MBeanOperationInfo("performCheckImeiRequest", "Send CheckIMEI request for provided IMEI", performCheckImeiParam/*signString*/ , String.class.getName(), MBeanOperationInfo.ACTION),
new MBeanOperationInfo("putMapProtocolVersion", "MAP protocol version: " + "1, 2 or 3", signString, Void.TYPE.getName(),
MBeanOperationInfo.ACTION),
new MBeanOperationInfo("closeCurrentDialog", "Closing the current dialog", null, String.class.getName(), MBeanOperationInfo.ACTION),
new MBeanOperationInfo("putCheckImeiClientAction",
"The mode of CheckImeiClient work. 1:VAL_MANUAL_OPERATION,2:VAL_AUTO_SendCheckImeiRequest", signString, Void.TYPE.getName(),
MBeanOperationInfo.ACTION),
};
return new MBeanInfo(TestCheckImeiClientMan.class.getName(), "CheckImeiClient test parameters management", attributes, null, operations, null);
}
DynamicMBeanToFolderAdapter.java 文件源码
项目:Pogamut3
阅读 23
收藏 0
点赞 0
评论 0
@Override
protected Property[] computeProperties(DynamicProxy object) {
MBeanInfo nfo = object.getMBeanInfo();
MBeanAttributeInfo[] attrs = nfo.getAttributes();
List<Property> props = new ArrayList<Property>();
for (MBeanAttributeInfo attr : attrs) {
props.add(new AttributeToPropertyAdapter(attr, object));
}
return props.toArray(new Property[0]);
}
MustBeValidCommand.java 文件源码
项目:openjdk-jdk10
阅读 32
收藏 0
点赞 0
评论 0
static private MBeanAttributeInfo[] makeAttInfos(String[][] spec) {
final MBeanAttributeInfo[] result =
new MBeanAttributeInfo[spec.length];
for (int i=0;i<result.length;i++) {
System.out.println("\tCreate an MBeanAttributeInfo: " +
spec[i][0]);
final MBeanAttributeInfo item =
new MBeanAttributeInfo(spec[i][2],spec[i][1],spec[i][0],
true,true,false);
result[i]=item;
}
return result;
}
TestMetricsSourceAdapter.java 文件源码
项目:hadoop-oss
阅读 24
收藏 0
点赞 0
评论 0
@Override
public void run() {
try {
// This will trigger updateJmxCache().
MBeanInfo info = sa.getMBeanInfo();
final String key = src.getKey();
for (MBeanAttributeInfo mBeanAttributeInfo : info.getAttributes()) {
// Found the new key, update the metric source and move on.
if (mBeanAttributeInfo.getName().equals(key)) {
LOG.info("found key/val=" + cnt + "/" + cnt);
cnt++;
src.setKV("key" + cnt, cnt);
return;
}
}
LOG.error("key=" + key + " not found. Stopping now.");
hasError.set(true);
} catch (Exception e) {
// catch other errors
hasError.set(true);
LOG.error(e.getStackTrace());
} finally {
if (hasError.get()) {
future.cancel(false);
}
}
}
JmxConnection.java 文件源码
项目:eZooKeeper
阅读 28
收藏 0
点赞 0
评论 0
public MBeanAttribute getMBeanAttribute(MBean mbean, String attributeName) {
if (mbean == null) {
throw new IllegalArgumentException("null MBean");
}
if (attributeName == null) {
throw new IllegalArgumentException("null attributeName");
}
// TODO: Handle connection errors and try to reconnect.
MBeanAttributeInfo attributeInfo = mbean.getAttributeInfo(attributeName);
MBeanAttribute mbeanAttribute = new MBeanAttribute(attributeName);
mbeanAttribute.setInfo(attributeInfo);
Object value = null;
try {
value = _MBeanServerConnection.getAttribute(mbean.getObjectName(), attributeName);
}
catch (Throwable t) {
String errorMessage = t.getLocalizedMessage();
mbeanAttribute.setValueRetrievalErrorMessage(errorMessage);
}
mbeanAttribute.setValue(value);
return mbeanAttribute;
}
MBean.java 文件源码
项目:eZooKeeper
阅读 29
收藏 0
点赞 0
评论 0
/**
* TODO: Comment.
*
* @param attributeName
* @return
*/
public MBeanAttributeInfo getAttributeInfo(String attributeName) {
if (_AttributeInfoMap == null) {
initAttributeCollections();
}
return _AttributeInfoMap.get(attributeName);
}
JMXAccessorSetTask.java 文件源码
项目:lazycat
阅读 30
收藏 0
点赞 0
评论 0
/**
* Get MBean Attribute from Mbean Server
*
* @param jmxServerConnection
* @param name
* @param attribute
* @return The type
* @throws Exception
*/
protected String getMBeanAttributeType(MBeanServerConnection jmxServerConnection, String name, String attribute)
throws Exception {
ObjectName oname = new ObjectName(name);
String mattrType = null;
MBeanInfo minfo = jmxServerConnection.getMBeanInfo(oname);
MBeanAttributeInfo attrs[] = minfo.getAttributes();
for (int i = 0; mattrType == null && i < attrs.length; i++) {
if (attribute.equals(attrs[i].getName()))
mattrType = attrs[i].getType();
}
return mattrType;
}
ModelMBeanInfoSupport.java 文件源码
项目:openjdk-jdk10
阅读 28
收藏 0
点赞 0
评论 0
/**
* Deserializes a {@link ModelMBeanInfoSupport} from an {@link ObjectInputStream}.
*/
private void readObject(ObjectInputStream in)
throws IOException, ClassNotFoundException {
if (compat) {
// Read an object serialized in the old serial form
//
ObjectInputStream.GetField fields = in.readFields();
modelMBeanDescriptor =
(Descriptor) fields.get("modelMBeanDescriptor", null);
if (fields.defaulted("modelMBeanDescriptor")) {
throw new NullPointerException("modelMBeanDescriptor");
}
modelMBeanAttributes =
(MBeanAttributeInfo[]) fields.get("mmbAttributes", null);
if (fields.defaulted("mmbAttributes")) {
throw new NullPointerException("mmbAttributes");
}
modelMBeanConstructors =
(MBeanConstructorInfo[]) fields.get("mmbConstructors", null);
if (fields.defaulted("mmbConstructors")) {
throw new NullPointerException("mmbConstructors");
}
modelMBeanNotifications =
(MBeanNotificationInfo[]) fields.get("mmbNotifications", null);
if (fields.defaulted("mmbNotifications")) {
throw new NullPointerException("mmbNotifications");
}
modelMBeanOperations =
(MBeanOperationInfo[]) fields.get("mmbOperations", null);
if (fields.defaulted("mmbOperations")) {
throw new NullPointerException("mmbOperations");
}
} else {
// Read an object serialized in the new serial form
//
in.defaultReadObject();
}
}
MBeanAttributeModelElementType.java 文件源码
项目:eZooKeeper
阅读 24
收藏 0
点赞 0
评论 0
@Override
public String getColumnText(Object element, int columnIndex) {
// 0:Name | 1:Value | 2:Type | 3:Description
MBeanAttributeModel model = (MBeanAttributeModel) element;
MBeanAttribute mbeanAttribute = model.getData();
MBeanAttributeInfo info = mbeanAttribute.getInfo();
switch (columnIndex) {
case 0:
return mbeanAttribute.getName();
case 1:
String valueError = mbeanAttribute.getValueRetrievalErrorMessage();
if (valueError != null) {
return valueError;
}
else {
return mbeanAttribute.getValueAsString();
}
case 2:
return info.getType();
case 3:
return info.getDescription();
}
return null;
}