Java Code Examples for javax.management.modelmbean.ModelMBeanInfo#getMBeanDescriptor()

The following examples show how to use javax.management.modelmbean.ModelMBeanInfo#getMBeanDescriptor() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MX4JModelMBean.java    From gemfirexd-oss with Apache License 2.0 6 votes vote down vote up
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;
}
 
Example 2
Source File: MX4JModelMBean.java    From gemfirexd-oss with Apache License 2.0 6 votes vote down vote up
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;
}
 
Example 3
Source File: AbstractMetadataAssemblerTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Test
public void testManagedResourceDescriptor() throws Exception {
	ModelMBeanInfo info = getMBeanInfoFromAssembler();
	Descriptor desc = info.getMBeanDescriptor();

	assertEquals("Logging should be set to true", "true", desc.getFieldValue("log"));
	assertEquals("Log file should be jmx.log", "jmx.log", desc.getFieldValue("logFile"));
	assertEquals("Currency Time Limit should be 15", "15", desc.getFieldValue("currencyTimeLimit"));
	assertEquals("Persist Policy should be OnUpdate", "OnUpdate", desc.getFieldValue("persistPolicy"));
	assertEquals("Persist Period should be 200", "200", desc.getFieldValue("persistPeriod"));
	assertEquals("Persist Location should be foo", "./foo", desc.getFieldValue("persistLocation"));
	assertEquals("Persist Name should be bar", "bar.jmx", desc.getFieldValue("persistName"));
}
 
Example 4
Source File: AbstractMetadataAssemblerTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Test
public void testManagedResourceDescriptor() throws Exception {
	ModelMBeanInfo info = getMBeanInfoFromAssembler();
	Descriptor desc = info.getMBeanDescriptor();

	assertEquals("Logging should be set to true", "true", desc.getFieldValue("log"));
	assertEquals("Log file should be jmx.log", "jmx.log", desc.getFieldValue("logFile"));
	assertEquals("Currency Time Limit should be 15", "15", desc.getFieldValue("currencyTimeLimit"));
	assertEquals("Persist Policy should be OnUpdate", "OnUpdate", desc.getFieldValue("persistPolicy"));
	assertEquals("Persist Period should be 200", "200", desc.getFieldValue("persistPeriod"));
	assertEquals("Persist Location should be foo", "./foo", desc.getFieldValue("persistLocation"));
	assertEquals("Persist Name should be bar", "bar.jmx", desc.getFieldValue("persistName"));
}
 
Example 5
Source File: AbstractMetadataAssemblerTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Test
public void testManagedResourceDescriptor() throws Exception {
	ModelMBeanInfo info = getMBeanInfoFromAssembler();
	Descriptor desc = info.getMBeanDescriptor();

	assertEquals("Logging should be set to true", "true", desc.getFieldValue("log"));
	assertEquals("Log file should be jmx.log", "jmx.log", desc.getFieldValue("logFile"));
	assertEquals("Currency Time Limit should be 15", "15", desc.getFieldValue("currencyTimeLimit"));
	assertEquals("Persist Policy should be OnUpdate", "OnUpdate", desc.getFieldValue("persistPolicy"));
	assertEquals("Persist Period should be 200", "200", desc.getFieldValue("persistPeriod"));
	assertEquals("Persist Location should be foo", "./foo", desc.getFieldValue("persistLocation"));
	assertEquals("Persist Name should be bar", "bar.jmx", desc.getFieldValue("persistName"));
}
 
Example 6
Source File: AbstractMBeanInfoAssembler.java    From spring-analysis-note with MIT License 3 votes vote down vote up
/**
 * Create an instance of the {@code ModelMBeanInfoSupport} class supplied with all
 * JMX implementations and populates the metadata through calls to the subclass.
 * @param managedBean the bean that will be exposed (might be an AOP proxy)
 * @param beanKey the key associated with the managed bean
 * @return the populated ModelMBeanInfo instance
 * @throws JMException in case of errors
 * @see #getDescription(Object, String)
 * @see #getAttributeInfo(Object, String)
 * @see #getConstructorInfo(Object, String)
 * @see #getOperationInfo(Object, String)
 * @see #getNotificationInfo(Object, String)
 * @see #populateMBeanDescriptor(javax.management.Descriptor, Object, String)
 */
@Override
public ModelMBeanInfo getMBeanInfo(Object managedBean, String beanKey) throws JMException {
	checkManagedBean(managedBean);
	ModelMBeanInfo info = new ModelMBeanInfoSupport(
			getClassName(managedBean, beanKey), getDescription(managedBean, beanKey),
			getAttributeInfo(managedBean, beanKey), getConstructorInfo(managedBean, beanKey),
			getOperationInfo(managedBean, beanKey), getNotificationInfo(managedBean, beanKey));
	Descriptor desc = info.getMBeanDescriptor();
	populateMBeanDescriptor(desc, managedBean, beanKey);
	info.setMBeanDescriptor(desc);
	return info;
}
 
Example 7
Source File: AbstractMBeanInfoAssembler.java    From java-technology-stack with MIT License 3 votes vote down vote up
/**
 * Create an instance of the {@code ModelMBeanInfoSupport} class supplied with all
 * JMX implementations and populates the metadata through calls to the subclass.
 * @param managedBean the bean that will be exposed (might be an AOP proxy)
 * @param beanKey the key associated with the managed bean
 * @return the populated ModelMBeanInfo instance
 * @throws JMException in case of errors
 * @see #getDescription(Object, String)
 * @see #getAttributeInfo(Object, String)
 * @see #getConstructorInfo(Object, String)
 * @see #getOperationInfo(Object, String)
 * @see #getNotificationInfo(Object, String)
 * @see #populateMBeanDescriptor(javax.management.Descriptor, Object, String)
 */
@Override
public ModelMBeanInfo getMBeanInfo(Object managedBean, String beanKey) throws JMException {
	checkManagedBean(managedBean);
	ModelMBeanInfo info = new ModelMBeanInfoSupport(
			getClassName(managedBean, beanKey), getDescription(managedBean, beanKey),
			getAttributeInfo(managedBean, beanKey), getConstructorInfo(managedBean, beanKey),
			getOperationInfo(managedBean, beanKey), getNotificationInfo(managedBean, beanKey));
	Descriptor desc = info.getMBeanDescriptor();
	populateMBeanDescriptor(desc, managedBean, beanKey);
	info.setMBeanDescriptor(desc);
	return info;
}
 
Example 8
Source File: AbstractMBeanInfoAssembler.java    From lams with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Create an instance of the {@code ModelMBeanInfoSupport} class supplied with all
 * JMX implementations and populates the metadata through calls to the subclass.
 * @param managedBean the bean that will be exposed (might be an AOP proxy)
 * @param beanKey the key associated with the managed bean
 * @return the populated ModelMBeanInfo instance
 * @throws JMException in case of errors
 * @see #getDescription(Object, String)
 * @see #getAttributeInfo(Object, String)
 * @see #getConstructorInfo(Object, String)
 * @see #getOperationInfo(Object, String)
 * @see #getNotificationInfo(Object, String)
 * @see #populateMBeanDescriptor(javax.management.Descriptor, Object, String)
 */
@Override
public ModelMBeanInfo getMBeanInfo(Object managedBean, String beanKey) throws JMException {
	checkManagedBean(managedBean);
	ModelMBeanInfo info = new ModelMBeanInfoSupport(
			getClassName(managedBean, beanKey), getDescription(managedBean, beanKey),
			getAttributeInfo(managedBean, beanKey), getConstructorInfo(managedBean, beanKey),
			getOperationInfo(managedBean, beanKey), getNotificationInfo(managedBean, beanKey));
	Descriptor desc = info.getMBeanDescriptor();
	populateMBeanDescriptor(desc, managedBean, beanKey);
	info.setMBeanDescriptor(desc);
	return info;
}
 
Example 9
Source File: AbstractMBeanInfoAssembler.java    From spring4-understanding with Apache License 2.0 3 votes vote down vote up
/**
 * Create an instance of the {@code ModelMBeanInfoSupport} class supplied with all
 * JMX implementations and populates the metadata through calls to the subclass.
 * @param managedBean the bean that will be exposed (might be an AOP proxy)
 * @param beanKey the key associated with the managed bean
 * @return the populated ModelMBeanInfo instance
 * @throws JMException in case of errors
 * @see #getDescription(Object, String)
 * @see #getAttributeInfo(Object, String)
 * @see #getConstructorInfo(Object, String)
 * @see #getOperationInfo(Object, String)
 * @see #getNotificationInfo(Object, String)
 * @see #populateMBeanDescriptor(javax.management.Descriptor, Object, String)
 */
@Override
public ModelMBeanInfo getMBeanInfo(Object managedBean, String beanKey) throws JMException {
	checkManagedBean(managedBean);
	ModelMBeanInfo info = new ModelMBeanInfoSupport(
			getClassName(managedBean, beanKey), getDescription(managedBean, beanKey),
			getAttributeInfo(managedBean, beanKey), getConstructorInfo(managedBean, beanKey),
			getOperationInfo(managedBean, beanKey), getNotificationInfo(managedBean, beanKey));
	Descriptor desc = info.getMBeanDescriptor();
	populateMBeanDescriptor(desc, managedBean, beanKey);
	info.setMBeanDescriptor(desc);
	return info;
}