本文整理匯總了Java中javax.management.MBeanInfo類的典型用法代碼示例。如果您正苦於以下問題:Java MBeanInfo類的具體用法?Java MBeanInfo怎麽用?Java MBeanInfo使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
MBeanInfo類屬於javax.management包,在下文中一共展示了MBeanInfo類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getMBeanInfo
import javax.management.MBeanInfo; //導入依賴的package包/類
@Override
public MBeanInfo getMBeanInfo() {
MBeanAttributeInfo[] attributes = new MBeanAttributeInfo[] {
// new MBeanAttributeInfo("LocalSsn", int.class.getName(), "Local Ssn", true, true, false),
// new MBeanAttributeInfo("RemoteSsn", int.class.getName(), "Remote Ssn", true, true, false),
new MBeanAttributeInfo("RemoteAddressDigits", String.class.getName(),
"Remote address digits. If empty ROUTING_BASED_ON_DPC_AND_SSN is used for CalledPartyAddress (remoteSpc from SCCP), "
+ "if not empty ROUTING_BASED_ON_GLOBAL_TITLE is used (address and Ssn from CAP)", true, true, false), };
MBeanParameterInfo[] signString = new MBeanParameterInfo[] { new MBeanParameterInfo("val", String.class.getName(),
"Index number or value") };
MBeanOperationInfo[] operations = new MBeanOperationInfo[] {};
return new MBeanInfo(CapMan.class.getName(), "Cap Management", attributes, null, operations, null);
}
示例2: getMBeanInfo
import javax.management.MBeanInfo; //導入依賴的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: testReadAttributes
import javax.management.MBeanInfo; //導入依賴的package包/類
@Test
public void testReadAttributes() throws Exception {
DynamicMBean proxy = JMX.newMBeanProxy(platformMBeanServer, threadPoolDynamicWrapperON, DynamicMBean.class);
assertEquals(threadCount, proxy.getAttribute(THREAD_COUNT));
assertEquals(threadPoolConfigBean.isTriggerNewInstanceCreation(),
proxy.getAttribute(TRIGGER_NEW_INSTANCE_CREATION));
AttributeList attributes = proxy.getAttributes(new String[] { THREAD_COUNT, TRIGGER_NEW_INSTANCE_CREATION });
assertEquals(2, attributes.size());
Attribute threadCountAttr = (Attribute) attributes.get(0);
assertEquals(THREAD_COUNT, threadCountAttr.getName());
assertEquals(threadCount, threadCountAttr.getValue());
Attribute boolTestAttr = (Attribute) attributes.get(1);
assertEquals(TRIGGER_NEW_INSTANCE_CREATION, boolTestAttr.getName());
assertEquals(threadPoolConfigBean.isTriggerNewInstanceCreation(), boolTestAttr.getValue());
MBeanInfo beanInfo = proxy.getMBeanInfo();
assertEquals(2, beanInfo.getAttributes().length);
}
示例4: checkMBeanInfo
import javax.management.MBeanInfo; //導入依賴的package包/類
private int checkMBeanInfo(MBeanInfo mbi, Descriptor refDescr) {
MBeanNotificationInfo[] notifsInfo = mbi.getNotifications();
int res = 0;
for (MBeanNotificationInfo mbni : notifsInfo) {
if ( mbni.getDescriptor().equals(refDescr) ) {
System.out.println("(OK)");
} else {
System.out.println("(ERROR) Descriptor of the notification is "
+ mbni.getDescriptor()
+ " as we expect "
+ refDescr);
res++;
}
}
return res;
}
示例5: getMBeanInfo
import javax.management.MBeanInfo; //導入依賴的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);
}
示例6: getMBeanInfo
import javax.management.MBeanInfo; //導入依賴的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);
}
示例7: printAttrs
import javax.management.MBeanInfo; //導入依賴的package包/類
private static void printAttrs(
MBeanServerConnection mbsc1, Class<? extends Exception> expectX)
throws Exception {
Set<ObjectName> names = mbsc1.queryNames(null, null);
for (ObjectName name : names) {
System.out.println(name + ":");
MBeanInfo mbi = mbsc1.getMBeanInfo(name);
MBeanAttributeInfo[] mbais = mbi.getAttributes();
for (MBeanAttributeInfo mbai : mbais) {
String attr = mbai.getName();
Object value;
try {
value = mbsc1.getAttribute(name, attr);
} catch (Exception e) {
if (expectX != null && expectX.isInstance(e))
value = "<" + e + ">";
else
throw e;
}
String s = " " + attr + " = " + value;
if (s.length() > 80)
s = s.substring(0, 77) + "...";
System.out.println(s);
}
}
}
示例8: get
import javax.management.MBeanInfo; //導入依賴的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
}
示例9: getMBeanInfo
import javax.management.MBeanInfo; //導入依賴的package包/類
public MBeanInfo getMBeanInfo(ObjectName name)
throws InstanceNotFoundException,
IntrospectionException,
ReflectionException,
IOException {
if (logger.debugOn()) logger.debug("getMBeanInfo", "name=" + name);
final ClassLoader old = pushDefaultClassLoader();
try {
return connection.getMBeanInfo(name, delegationSubject);
} catch (IOException ioe) {
communicatorAdmin.gotIOException(ioe);
return connection.getMBeanInfo(name, delegationSubject);
} finally {
popDefaultClassLoader(old);
}
}
示例10: getType
import javax.management.MBeanInfo; //導入依賴的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;
}
示例11: test_simple
import javax.management.MBeanInfo; //導入依賴的package包/類
@Test
public void test_simple() {
MBeanServer mBeanServer = exporter.getServer();
try {
ObjectName objectName = new ObjectName("bean:name=otterControllor");
MBeanInfo nodeInfo = mBeanServer.getMBeanInfo(objectName);
System.out.println(nodeInfo);
Object result = mBeanServer.getAttribute(objectName, "HeapMemoryUsage");
System.out.println(result);
JMXServiceURL address = new JMXServiceURL("service:jmx:rmi://127.0.0.1/jndi/rmi://127.0.0.1:1099/mbean");
Map environment = null;
JMXConnector cntor = JMXConnectorFactory.connect(address, environment);
MBeanServerConnection mbsc = cntor.getMBeanServerConnection();
String domain = mbsc.getDefaultDomain();
System.out.println(domain);
result = mbsc.getAttribute(objectName, "HeapMemoryUsage");
System.out.println(result);
} catch (Exception e) {
want.fail(e.getMessage());
}
}
示例12: printMBeanInfo
import javax.management.MBeanInfo; //導入依賴的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());
}
}
示例13: getMethodInfo
import javax.management.MBeanInfo; //導入依賴的package包/類
/**
* Find the operation info for a method
*
* @param oname
* @param opName
* @return the operation info for the specified operation
*/
public MBeanOperationInfo getMethodInfo(ObjectName oname, String opName) {
MBeanInfo info = null;
try {
info = server.getMBeanInfo(oname);
} catch (Exception e) {
log.info("Can't find metadata " + oname);
return null;
}
MBeanOperationInfo attInfo[] = info.getOperations();
for (int i = 0; i < attInfo.length; i++) {
if (opName.equals(attInfo[i].getName())) {
return attInfo[i];
}
}
return null;
}
示例14: main
import javax.management.MBeanInfo; //導入依賴的package包/類
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!");
}
示例15: getPerInterface
import javax.management.MBeanInfo; //導入依賴的package包/類
final PerInterface<M> getPerInterface(Class<?> mbeanInterface)
throws NotCompliantMBeanException {
PerInterfaceMap<M> map = getPerInterfaceMap();
synchronized (map) {
WeakReference<PerInterface<M>> wr = map.get(mbeanInterface);
PerInterface<M> pi = (wr == null) ? null : wr.get();
if (pi == null) {
try {
MBeanAnalyzer<M> analyzer = getAnalyzer(mbeanInterface);
MBeanInfo mbeanInfo =
makeInterfaceMBeanInfo(mbeanInterface, analyzer);
pi = new PerInterface<M>(mbeanInterface, this, analyzer,
mbeanInfo);
wr = new WeakReference<PerInterface<M>>(pi);
map.put(mbeanInterface, wr);
} catch (Exception x) {
throw Introspector.throwException(mbeanInterface,x);
}
}
return pi;
}
}