use of javax.management.NotCompliantMBeanException in project aries by apache.
the class PermissionAdminMBeanHandler method constructInjectMBean.
/**
* @see org.apache.aries.jmx.AbstractCompendiumHandler#constructInjectMBean(java.lang.Object)
*/
@Override
protected StandardMBean constructInjectMBean(Object targetService) {
PermissionAdminMBean paMBean = new PermissionAdmin((org.osgi.service.permissionadmin.PermissionAdmin) targetService);
StandardMBean mbean = null;
try {
mbean = new StandardMBean(paMBean, PermissionAdminMBean.class);
} catch (NotCompliantMBeanException e) {
Logger logger = agentContext.getLogger();
logger.log(LogService.LOG_ERROR, "Not compliant MBean", e);
}
return mbean;
}
use of javax.management.NotCompliantMBeanException in project aries by apache.
the class UserAdminMBeanHandler method constructInjectMBean.
/**
* @see org.apache.aries.jmx.AbstractCompendiumHandler#constructInjectMBean(java.lang.Object)
*/
@Override
protected StandardMBean constructInjectMBean(Object targetService) {
UserAdminMBean uaMBean = new UserAdmin((org.osgi.service.useradmin.UserAdmin) targetService);
StandardMBean mbean = null;
try {
mbean = new StandardMBean(uaMBean, UserAdminMBean.class);
} catch (NotCompliantMBeanException e) {
Logger logger = agentContext.getLogger();
logger.log(LogService.LOG_ERROR, "Not compliant MBean", e);
}
return mbean;
}
use of javax.management.NotCompliantMBeanException in project uPortal by Jasig.
the class RequestCacheAspect method getCacheStatistics.
protected final CacheStatistics getCacheStatistics(ProceedingJoinPoint pjp, RequestCache requestCache) {
final Signature signature = pjp.getSignature();
final String signatureString = signature.toString();
CacheStatistics cacheStatistics = this.methodStats.get(signatureString);
if (cacheStatistics == null) {
final CacheStatistics newStats = new CacheStatistics();
cacheStatistics = ConcurrentMapUtils.putIfAbsent(this.methodStats, signatureString, newStats);
if (this.mBeanExportOperations != null && cacheStatistics == newStats) {
final String nameString = "uPortal:section=Cache,RequestCache=RequestCache,name=" + EhcacheHibernateMbeanNames.mbeanSafe(signatureString);
try {
final ObjectName name = new ObjectName(nameString);
registerMbean(cacheStatistics, name);
} catch (MalformedObjectNameException e) {
logger.warn("Failed to create ObjectName {} the corresponding CacheStatistics will not be registered with JMX", nameString, e);
} catch (NullPointerException e) {
logger.warn("Failed to create ObjectName {} the corresponding CacheStatistics will not be registered with JMX", nameString, e);
} catch (InstanceAlreadyExistsException e) {
logger.warn("ObjectName {} is already registered, the corresponding CacheStatistics will not be registered with JMX", nameString, e);
} catch (MBeanRegistrationException e) {
logger.warn("Failed to register ObjectName {} the corresponding CacheStatistics will not be registered with JMX", nameString, e);
} catch (NotCompliantMBeanException e) {
logger.warn("Failed to register ObjectName {} the corresponding CacheStatistics will not be registered with JMX", nameString, e);
}
}
}
return cacheStatistics;
}
use of javax.management.NotCompliantMBeanException in project jdk8u_jdk by JetBrains.
the class DefaultMBeanServerInterceptor method getNewMBeanClassName.
private static String getNewMBeanClassName(Object mbeanToRegister) throws NotCompliantMBeanException {
if (mbeanToRegister instanceof DynamicMBean) {
DynamicMBean mbean = (DynamicMBean) mbeanToRegister;
final String name;
try {
name = mbean.getMBeanInfo().getClassName();
} catch (Exception e) {
// Includes case where getMBeanInfo() returns null
NotCompliantMBeanException ncmbe = new NotCompliantMBeanException("Bad getMBeanInfo()");
ncmbe.initCause(e);
throw ncmbe;
}
if (name == null) {
final String msg = "MBeanInfo has null class name";
throw new NotCompliantMBeanException(msg);
}
return name;
} else
return mbeanToRegister.getClass().getName();
}
use of javax.management.NotCompliantMBeanException in project jdk8u_jdk by JetBrains.
the class Introspector method throwException.
/**
* Throws a NotCompliantMBeanException or a SecurityException.
* @param notCompliant the class which was under examination
* @param cause the raeson why NotCompliantMBeanException should
* be thrown.
* @return nothing - this method always throw an exception.
* The return type makes it possible to write
* <pre> throw throwException(clazz,cause); </pre>
* @throws SecurityException - if cause is a SecurityException
* @throws NotCompliantMBeanException otherwise.
**/
static NotCompliantMBeanException throwException(Class<?> notCompliant, Throwable cause) throws NotCompliantMBeanException, SecurityException {
if (cause instanceof SecurityException)
throw (SecurityException) cause;
if (cause instanceof NotCompliantMBeanException)
throw (NotCompliantMBeanException) cause;
final String classname = (notCompliant == null) ? "null class" : notCompliant.getName();
final String reason = (cause == null) ? "Not compliant" : cause.getMessage();
final NotCompliantMBeanException res = new NotCompliantMBeanException(classname + ": " + reason);
res.initCause(cause);
throw res;
}
Aggregations