use of javax.management.StandardMBean in project aries by apache.
the class FrameworkMBeanHandler method open.
/**
* @see org.apache.aries.jmx.MBeanHandler#open()
*/
public void open() {
ServiceReference adminRef = context.getServiceReference(PackageAdmin.class.getCanonicalName());
PackageAdmin packageAdmin = (PackageAdmin) context.getService(adminRef);
ServiceReference startLevelRef = context.getServiceReference(StartLevel.class.getCanonicalName());
StartLevel startLevel = (StartLevel) context.getService(startLevelRef);
FrameworkMBean framework = new Framework(context, startLevel, packageAdmin);
try {
mbean = new StandardMBean(framework, FrameworkMBean.class);
} catch (NotCompliantMBeanException e) {
logger.log(LogService.LOG_ERROR, "Not compliant MBean", e);
}
agentContext.registerMBean(this);
}
use of javax.management.StandardMBean in project aries by apache.
the class ProvisioningServiceMBeanHandler method constructInjectMBean.
/**
* @see org.apache.aries.jmx.AbstractCompendiumHandler#constructInjectMBean(java.lang.Object)
*/
@Override
protected StandardMBean constructInjectMBean(Object targetService) {
ProvisioningService psMBean = new ProvisioningService((org.osgi.service.provisioning.ProvisioningService) targetService);
StandardMBean mbean = null;
try {
mbean = new StandardMBean(psMBean, ProvisioningServiceMBean.class);
} catch (NotCompliantMBeanException e) {
Logger logger = agentContext.getLogger();
logger.log(LogService.LOG_ERROR, "Failed to instantiate MBean for " + ProvisioningServiceMBean.class.getName(), e);
}
return mbean;
}
use of javax.management.StandardMBean in project aries by apache.
the class ConfigurationAdminMBeanHandler method constructInjectMBean.
/**
* @see org.apache.aries.jmx.AbstractCompendiumHandler#constructInjectMBean(java.lang.Object)
*/
@Override
protected StandardMBean constructInjectMBean(Object targetService) {
ConfigurationAdminMBean caMBean = new org.apache.aries.jmx.cm.ConfigurationAdmin((org.osgi.service.cm.ConfigurationAdmin) targetService);
StandardMBean mbean = null;
try {
mbean = new StandardMBean(caMBean, ConfigurationAdminMBean.class);
} catch (NotCompliantMBeanException e) {
Logger logger = agentContext.getLogger();
logger.log(LogService.LOG_ERROR, "Failed to instantiate MBean for " + ConfigurationAdminMBean.class.getName(), e);
}
return mbean;
}
use of javax.management.StandardMBean in project ignite by apache.
the class GridMBeanSelfTest method testMissedDescriptionMBeanInfo.
/**
* Tests correct MBean interface.
*
* @throws Exception Thrown if test fails.
*/
@Test
public void testMissedDescriptionMBeanInfo() throws Exception {
try {
StandardMBean mbean = new IgniteStandardMXBean(new GridMBeanImplementation(), GridMBeanInterfaceBadAgain.class);
mbean.getMBeanInfo();
} catch (AssertionError ignored) {
return;
}
assert false;
}
use of javax.management.StandardMBean in project ignite by apache.
the class GridMBeanSelfTest method testMissedNameMBeanInfo.
/**
* Tests correct MBean interface.
*
* @throws Exception Thrown if test fails.
*/
@Test
public void testMissedNameMBeanInfo() throws Exception {
try {
StandardMBean mbean = new IgniteStandardMXBean(new GridMBeanImplementation(), GridMBeanInterfaceBad.class);
mbean.getMBeanInfo();
} catch (AssertionError ignored) {
return;
}
assert false;
}
Aggregations