本文整理汇总了Java中javax.management.modelmbean.ModelMBeanInfo类的典型用法代码示例。如果您正苦于以下问题:Java ModelMBeanInfo类的具体用法?Java ModelMBeanInfo怎么用?Java ModelMBeanInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ModelMBeanInfo类属于javax.management.modelmbean包,在下文中一共展示了ModelMBeanInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setModelMBeanInfo
import javax.management.modelmbean.ModelMBeanInfo; //导入依赖的package包/类
public void setModelMBeanInfo(ModelMBeanInfo modelMBeanInfo)
throws MBeanException, RuntimeOperationsException {
if (modelMBeanInfo == null)
throw new RuntimeOperationsException(new IllegalArgumentException(
LocalizedStrings.MX4JModelMBean_MODELMBEANINFO_CANNOT_BE_NULL.toLocalizedString()));
if (!isModelMBeanInfoValid(modelMBeanInfo))
throw new RuntimeOperationsException(new IllegalArgumentException(
LocalizedStrings.MX4JModelMBean_MODELMBEANINFO_IS_INVALID.toLocalizedString()));
m_modelMBeanInfo = (ModelMBeanInfo) modelMBeanInfo.clone();
Logger logger = getLogger();
if (logger.isEnabledFor(Logger.DEBUG))
logger.debug("ModelMBeanInfo successfully set to: " + m_modelMBeanInfo);
// Only now the MBean can be registered in the MBeanServer
m_canBeRegistered = true;
}
示例2: getModelMBeanLogger
import javax.management.modelmbean.ModelMBeanInfo; //导入依赖的package包/类
private Logger getModelMBeanLogger(String notificationType) throws MBeanException {
// Get a copy to avoid synchronization
ModelMBeanInfo info = getModelMBeanInfo();
// First look if there is a suitable notification descriptor, otherwise use MBean descriptor
Descriptor descriptor = null;
Logger modelMBeanLogger = null;
if (notificationType != null) {
descriptor = info.getDescriptor(notificationType, "notification");
modelMBeanLogger = findLogger(descriptor);
}
if (modelMBeanLogger == null) {
descriptor = info.getMBeanDescriptor();
modelMBeanLogger = findLogger(descriptor);
if (modelMBeanLogger != null)
return modelMBeanLogger;
}
return null;
}
示例3: testAttributeHasCorrespondingOperations
import javax.management.modelmbean.ModelMBeanInfo; //导入依赖的package包/类
@Test
public void testAttributeHasCorrespondingOperations() throws Exception {
ModelMBeanInfo info = getMBeanInfoFromAssembler();
ModelMBeanOperationInfo get = info.getOperation("getName");
assertNotNull("get operation should not be null", get);
assertEquals("get operation should have visibility of four",
get.getDescriptor().getFieldValue("visibility"),
new Integer(4));
assertEquals("get operation should have role \"getter\"", "getter", get.getDescriptor().getFieldValue("role"));
ModelMBeanOperationInfo set = info.getOperation("setName");
assertNotNull("set operation should not be null", set);
assertEquals("set operation should have visibility of four",
set.getDescriptor().getFieldValue("visibility"),
new Integer(4));
assertEquals("set operation should have role \"setter\"", "setter", set.getDescriptor().getFieldValue("role"));
}
示例4: getModelMBeanLogger
import javax.management.modelmbean.ModelMBeanInfo; //导入依赖的package包/类
private Logger getModelMBeanLogger(String notificationType) throws MBeanException
{
// Get a copy to avoid synchronization
ModelMBeanInfo info = getModelMBeanInfo();
// First look if there is a suitable notification descriptor, otherwise use MBean descriptor
Descriptor descriptor = null;
Logger modelMBeanLogger = null;
if (notificationType != null)
{
descriptor = info.getDescriptor(notificationType, "notification");
modelMBeanLogger = findLogger(descriptor);
}
if (modelMBeanLogger == null)
{
descriptor = info.getMBeanDescriptor();
modelMBeanLogger = findLogger(descriptor);
if (modelMBeanLogger != null) return modelMBeanLogger;
}
return null;
}
示例5: getMBeanInfo
import javax.management.modelmbean.ModelMBeanInfo; //导入依赖的package包/类
/**
* Gets the {@code ModelMBeanInfo} for the bean with the supplied key
* and of the supplied type.
*/
private ModelMBeanInfo getMBeanInfo(Object managedBean, String beanKey) throws JMException {
ModelMBeanInfo info = this.assembler.getMBeanInfo(managedBean, beanKey);
if (logger.isWarnEnabled() && ObjectUtils.isEmpty(info.getAttributes()) &&
ObjectUtils.isEmpty(info.getOperations())) {
logger.warn("Bean with key '" + beanKey +
"' has been registered as an MBean but has no exposed attributes or operations");
}
return info;
}
示例6: MX4JModelMBean
import javax.management.modelmbean.ModelMBeanInfo; //导入依赖的package包/类
public MX4JModelMBean(ModelMBeanInfo info) throws MBeanException, RuntimeOperationsException {
if (info == null)
throw new RuntimeOperationsException(new IllegalArgumentException(
LocalizedStrings.MX4JModelMBean_MODELMBEANINFO_PARAMETER_CANT_BE_NULL
.toLocalizedString()));
else
setModelMBeanInfo(info);
}
示例7: load
import javax.management.modelmbean.ModelMBeanInfo; //导入依赖的package包/类
public void load() throws MBeanException, RuntimeOperationsException, InstanceNotFoundException {
PersisterMBean persister = findPersister();
if (persister != null) {
ModelMBeanInfo info = (ModelMBeanInfo) persister.load();
setModelMBeanInfo(info);
}
}
示例8: store
import javax.management.modelmbean.ModelMBeanInfo; //导入依赖的package包/类
public void store() throws MBeanException, RuntimeOperationsException, InstanceNotFoundException {
PersisterMBean persister = findPersister();
if (persister != null) {
// Take a clone to avoid synchronization problems
ModelMBeanInfo info = (ModelMBeanInfo) getMBeanInfo();
persister.store(info);
}
}
示例9: testAttributeFromInterface
import javax.management.modelmbean.ModelMBeanInfo; //导入依赖的package包/类
@Test
public void testAttributeFromInterface() throws Exception {
ModelMBeanInfo inf = getMBeanInfoFromAssembler();
ModelMBeanAttributeInfo attr = inf.getAttribute("Colour");
assertTrue("The name attribute should be writable", attr.isWritable());
assertTrue("The name attribute should be readable", attr.isReadable());
}
示例10: testAttributeDescriptionOnSetter
import javax.management.modelmbean.ModelMBeanInfo; //导入依赖的package包/类
@Test
public void testAttributeDescriptionOnSetter() throws Exception {
ModelMBeanInfo inf = getMBeanInfoFromAssembler();
ModelMBeanAttributeInfo attr = inf.getAttribute(AGE_ATTRIBUTE);
assertEquals("The description for the age attribute is incorrect",
"The Age Attribute", attr.getDescription());
}
示例11: testAttributeDescriptionOnGetter
import javax.management.modelmbean.ModelMBeanInfo; //导入依赖的package包/类
@Test
public void testAttributeDescriptionOnGetter() throws Exception {
ModelMBeanInfo inf = getMBeanInfoFromAssembler();
ModelMBeanAttributeInfo attr = inf.getAttribute(NAME_ATTRIBUTE);
assertEquals("The description for the name attribute is incorrect",
"The Name Attribute", attr.getDescription());
}
示例12: testReadOnlyAttribute
import javax.management.modelmbean.ModelMBeanInfo; //导入依赖的package包/类
/**
* Tests the situation where the attribute is only defined on the getter.
*/
@Test
public void testReadOnlyAttribute() throws Exception {
ModelMBeanInfo inf = getMBeanInfoFromAssembler();
ModelMBeanAttributeInfo attr = inf.getAttribute(AGE_ATTRIBUTE);
assertFalse("The age attribute should not be writable", attr.isWritable());
}
示例13: testReadWriteAttribute
import javax.management.modelmbean.ModelMBeanInfo; //导入依赖的package包/类
@Test
public void testReadWriteAttribute() throws Exception {
ModelMBeanInfo inf = getMBeanInfoFromAssembler();
ModelMBeanAttributeInfo attr = inf.getAttribute(NAME_ATTRIBUTE);
assertTrue("The name attribute should be writable", attr.isWritable());
assertTrue("The name attribute should be readable", attr.isReadable());
}
示例14: testWithOnlySetter
import javax.management.modelmbean.ModelMBeanInfo; //导入依赖的package包/类
/**
* Tests the situation where the property only has a getter.
*/
@Test
public void testWithOnlySetter() throws Exception {
ModelMBeanInfo inf = getMBeanInfoFromAssembler();
ModelMBeanAttributeInfo attr = inf.getAttribute("NickName");
assertNotNull("Attribute should not be null", attr);
}
示例15: testWithOnlyGetter
import javax.management.modelmbean.ModelMBeanInfo; //导入依赖的package包/类
/**
* Tests the situation where the property only has a setter.
*/
@Test
public void testWithOnlyGetter() throws Exception {
ModelMBeanInfo info = getMBeanInfoFromAssembler();
ModelMBeanAttributeInfo attr = info.getAttribute("Superman");
assertNotNull("Attribute should not be null", attr);
}