use of javax.management.NotCompliantMBeanException in project aries by apache.
the class ServiceStateMBeanHandler method open.
/**
* @see org.apache.aries.jmx.MBeanHandler#open()
*/
public void open() {
serviceStateMBean = new ServiceState(bundleContext, stateConfig, logger);
try {
mbean = new RegistrableStandardEmitterMBean(serviceStateMBean, ServiceStateMBean.class);
} catch (NotCompliantMBeanException e) {
logger.log(LogService.LOG_ERROR, "Failed to instantiate MBean for " + ServiceStateMBean.class.getName(), e);
}
agentContext.registerMBean(this);
}
use of javax.management.NotCompliantMBeanException in project aries by apache.
the class JMXAgentImpl method registerMBeans.
/**
* @see org.apache.aries.jmx.agent.JMXAgent#registerMBeans(javax.management.MBeanServer)
*/
public synchronized void registerMBeans(final MBeanServer server) {
for (MBeanHandler mbeanHandler : mbeansHandlers.keySet()) {
if (mbeansHandlers.get(mbeanHandler) == Boolean.TRUE) {
String name = mbeanHandler.getName();
StandardMBean mbean = mbeanHandler.getMbean();
if (mbean != null) {
try {
logger.log(LogService.LOG_INFO, "Registering " + mbean.getMBeanInterface().getName() + " to MBeanServer " + server + " with name " + name);
server.registerMBean(mbean, new ObjectName(name));
} catch (InstanceAlreadyExistsException e) {
logger.log(LogService.LOG_ERROR, "MBean is already registered", e);
} catch (MBeanRegistrationException e) {
logger.log(LogService.LOG_ERROR, "Can't register MBean", e);
} catch (NotCompliantMBeanException e) {
logger.log(LogService.LOG_ERROR, "MBean is not compliant MBean", e);
} catch (MalformedObjectNameException e) {
logger.log(LogService.LOG_ERROR, "Try to register with no valid objectname", e);
} catch (NullPointerException e) {
logger.log(LogService.LOG_ERROR, "Name of objectname can't be null", e);
}
}
}
}
mbeanServers.put(server, Boolean.TRUE);
}
use of javax.management.NotCompliantMBeanException in project aries by apache.
the class JMXAgentImpl method registerMBean.
/**
* @see org.apache.aries.jmx.agent.JMXAgent#registerMBean(org.apache.aries.jmx.MBeanHandler)
*/
public synchronized void registerMBean(final MBeanHandler mBeanHandler) {
for (MBeanServer server : mbeanServers.keySet()) {
String name = mBeanHandler.getName();
StandardMBean mbean = mBeanHandler.getMbean();
try {
logger.log(LogService.LOG_INFO, "Registering " + mbean.getMBeanInterface().getName() + " to MBeanServer " + server + " with name " + name);
server.registerMBean(mbean, new ObjectName(name));
} catch (InstanceAlreadyExistsException e) {
logger.log(LogService.LOG_ERROR, "MBean is already registered", e);
} catch (MBeanRegistrationException e) {
logger.log(LogService.LOG_ERROR, "Can't register MBean", e);
} catch (NotCompliantMBeanException e) {
logger.log(LogService.LOG_ERROR, "MBean is not compliant MBean, Stopping registration", e);
return;
} catch (MalformedObjectNameException e) {
logger.log(LogService.LOG_ERROR, "Try to register with no valid objectname, Stopping registration", e);
return;
} catch (NullPointerException e) {
logger.log(LogService.LOG_ERROR, "Name of objectname can't be null, Stopping registration", e);
return;
}
}
mbeansHandlers.put(mBeanHandler, Boolean.TRUE);
}
use of javax.management.NotCompliantMBeanException in project aries by apache.
the class BundleStateMBeanHandler method open.
/**
* @see org.apache.aries.jmx.MBeanHandler#open()
*/
public void open() {
packageAdminRef = bundleContext.getServiceReference(PackageAdmin.class.getName());
PackageAdmin packageAdmin = (PackageAdmin) bundleContext.getService(packageAdminRef);
startLevelRef = bundleContext.getServiceReference(StartLevel.class.getName());
StartLevel startLevel = (StartLevel) bundleContext.getService(startLevelRef);
bundleStateMBean = new BundleState(bundleContext, packageAdmin, startLevel, stateConfig, logger);
try {
mbean = new RegistrableStandardEmitterMBean(bundleStateMBean, BundleStateMBean.class);
} catch (NotCompliantMBeanException e) {
logger.log(LogService.LOG_ERROR, "Failed to instantiate MBean for " + BundleStateMBean.class.getName(), e);
}
agentContext.registerMBean(this);
}
use of javax.management.NotCompliantMBeanException 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);
}
Aggregations