@Override public String getDefaultDomain() { Throwable error = null; MBeanServerPlugin delegate = rootMBeanServer; final boolean readOnly = true; try { //No authorization needed to get the name of the default domain return delegate.getDefaultDomain(); } catch (Exception e) { error = e; throw makeRuntimeException(e); } finally { if (shouldAuditLog(delegate, readOnly)) { new MBeanServerAuditLogRecordFormatter(this, error, readOnly).getDefaultDomain(); } } }
@Override public String[] getDomains() { Throwable error = null; final boolean readOnly = true; try { //No authorization needed to get the names of the domains ArrayList<String> result = new ArrayList<String>(); if (delegates.size() > 0) { for (MBeanServerPlugin delegate : delegates) { String[] domains = delegate.getDomains(); if (domains.length > 0) { result.addAll(Arrays.asList(domains)); } } } result.addAll(Arrays.asList(rootMBeanServer.getDomains())); return result.toArray(new String[result.size()]); } catch (Exception e) { error = e; throw makeRuntimeException(e); } finally { //This should always audit log new MBeanServerAuditLogRecordFormatter(this, error, readOnly).getDomains(); } }
@Override public String getDefaultDomain() { Throwable error = null; MBeanServerPlugin delegate = rootMBeanServer; final boolean readOnly = true; try { //No authorization needed to get the name of the default domain return delegate.getDefaultDomain(); } catch (Exception e) { error = e; throw makeRuntimeException(e); } finally { if (shouldAuditLog(delegate, readOnly)) { new MBeanServerAuditLogRecordFormatter(this, error, readOnly).getDefaultDomain(); } } }
@Override public String[] getDomains() { Throwable error = null; final boolean readOnly = true; try { //No authorization needed to get the names of the domains ArrayList<String> result = new ArrayList<String>(); if (delegates.size() > 0) { for (MBeanServerPlugin delegate : delegates) { String[] domains = delegate.getDomains(); if (domains.length > 0) { result.addAll(Arrays.asList(domains)); } } } result.addAll(Arrays.asList(rootMBeanServer.getDomains())); return result.toArray(new String[result.size()]); } catch (Exception e) { error = e; throw makeRuntimeException(e); } finally { //This should always audit log new MBeanServerAuditLogRecordFormatter(this, error, readOnly).getDomains(); } }
@Override @Deprecated public ObjectInputStream deserialize(String className, byte[] data) throws OperationsException, ReflectionException { Throwable error = null; MBeanServerPlugin delegate = rootMBeanServer; final boolean readOnly = true; try { //Special authorization authorizeClassloadingOperation(delegate, DESERIALIZE); return delegate.deserialize(className, data); } catch (Exception e) { error = e; if (e instanceof OperationsException) throw (OperationsException)e; if (e instanceof ReflectionException) throw (ReflectionException)e; throw makeRuntimeException(e); } finally { if (shouldAuditLog(delegate, readOnly)) { new MBeanServerAuditLogRecordFormatter(this, error, readOnly).deserialize(className, data); } } }
} catch (Exception e) { error = e; throw makeRuntimeException(e); } finally { if (error != null || shouldAuditLog) { new MBeanServerAuditLogRecordFormatter(this, error, readOnly).queryNames(name, query);
@Override @Deprecated public ObjectInputStream deserialize(String className, ObjectName loaderName, byte[] data) throws OperationsException, ReflectionException { Throwable error = null; MBeanServerPlugin delegate = rootMBeanServer; final boolean readOnly = true; try { //Special authorization authorizeClassloadingOperation(delegate, loaderName, DESERIALIZE); return delegate.deserialize(className, loaderName, data); } catch (Exception e) { error = e; if (e instanceof OperationsException) throw (OperationsException)e; if (e instanceof ReflectionException) throw (ReflectionException)e; throw makeRuntimeException(e); } finally { if (shouldAuditLog(delegate, readOnly)) { new MBeanServerAuditLogRecordFormatter(this, error, readOnly).deserialize(className, loaderName, data); } } }
} catch (Exception e) { error = e; throw makeRuntimeException(e); } finally { if (error != null || shouldAuditLog) { new MBeanServerAuditLogRecordFormatter(this, error, readOnly).queryMBeans(name, query);
@Override public ClassLoaderRepository getClassLoaderRepository() { Throwable error = null; MBeanServerPlugin delegate = rootMBeanServer; final boolean readOnly = true; try { //Special authorization authorizeClassloadingOperation(delegate, GET_CLASSLOADER_REPOSITORY); return delegate.getClassLoaderRepository(); } catch (Exception e) { error = e; throw makeRuntimeException(e); } finally { if (shouldAuditLog(delegate, readOnly)) { new MBeanServerAuditLogRecordFormatter(this, error, readOnly).getClassLoaderRepository(); } } }
} catch (Exception e) { error = e; throw makeRuntimeException(e); } finally { if (error != null || shouldAuditLog) { new MBeanServerAuditLogRecordFormatter(this, error, readOnly).queryNames(name, query);
@Override public Object instantiate(String className) throws ReflectionException, MBeanException { Throwable error = null; MBeanServerPlugin delegate = rootMBeanServer; final boolean readOnly = false; try { //Special authorization authorizeClassloadingOperation(delegate, INSTANTIATE); return delegate.instantiate(className); } catch (Exception e) { error = e; if (e instanceof ReflectionException) throw (ReflectionException)e; if (e instanceof MBeanException) throw (MBeanException)e; throw makeRuntimeException(e); } finally { if (shouldAuditLog(delegate, readOnly)) { new MBeanServerAuditLogRecordFormatter(this, error, readOnly).instantiate(className); } } }
} catch (Exception e) { error = e; throw makeRuntimeException(e); } finally { if (error != null || shouldAuditLog) { new MBeanServerAuditLogRecordFormatter(this, error, readOnly).queryMBeans(name, query);
@Override public Object instantiate(String className, ObjectName loaderName) throws ReflectionException, MBeanException, InstanceNotFoundException { Throwable error = null; MBeanServerPlugin delegate = rootMBeanServer; final boolean readOnly = false; try { //Special authorization authorizeClassloadingOperation(delegate, INSTANTIATE); return delegate.instantiate(className, loaderName); } catch (Exception e) { error = e; if (e instanceof ReflectionException) throw (ReflectionException)e; if (e instanceof MBeanException) throw (MBeanException)e; if (e instanceof InstanceNotFoundException) throw (InstanceNotFoundException)e; throw makeRuntimeException(e); } finally { if (shouldAuditLog(delegate, readOnly)) { new MBeanServerAuditLogRecordFormatter(this, error, readOnly).instantiate(className, loaderName); } } }
} catch (Exception e) { error = e; throw makeRuntimeException(e); } finally { if (error != null || shouldLog) { new MBeanServerAuditLogRecordFormatter(this, error, readOnly).getMBeanCount();
@Override @Deprecated public ObjectInputStream deserialize(ObjectName name, byte[] data) throws OperationsException { Throwable error = null; MBeanServerPlugin delegate = null; final boolean readOnly = true; try { delegate = findDelegate(name); //Special authorization authorizeClassloadingOperation(delegate, name, DESERIALIZE); return delegate.deserialize(name, data); } catch (Exception e) { error = e; if (e instanceof OperationsException) throw (OperationsException)e; throw makeRuntimeException(e); } finally { if (shouldAuditLog(delegate, readOnly)) { new MBeanServerAuditLogRecordFormatter(this, error, readOnly).deserialize(name, data); } } }
@Override public boolean isRegistered(ObjectName name) { Throwable error = null; Boolean shouldAuditLog = null; final boolean readOnly = true; try { if (delegates.size() > 0) { for (MBeanServerPlugin delegate : delegates) { if (delegate.accepts(name) && delegate.isRegistered(name)) { authorizeMBeanOperation(delegate, name, IS_REGISTERED, null, JmxAction.Impact.READ_ONLY); if (delegate.shouldAuditLog()) { shouldAuditLog = true; } return true; } } } // check if it's registered with the root (a.k.a platform) MBean server shouldAuditLog = true; authorizeMBeanOperation(rootMBeanServer, name, IS_REGISTERED, null, JmxAction.Impact.READ_ONLY); return rootMBeanServer.isRegistered(name); } catch (Exception e) { error = e; throw makeRuntimeException(e); } finally { if (shouldAuditLog == null || shouldAuditLog) { new MBeanServerAuditLogRecordFormatter(this, error, readOnly).isRegistered(name); } } }
@Override public void setAttribute(ObjectName name, Attribute attribute) throws InstanceNotFoundException, AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException { Throwable error = null; MBeanServerPlugin delegate = null; final boolean readOnly = false; try { delegate = findDelegate(name); authorizeMBeanOperation(delegate, name, SET_ATTRIBUTE, attribute.getName(), JmxAction.Impact.WRITE); delegate.setAttribute(name, attribute); } catch (Exception e) { error = e; if (e instanceof InstanceNotFoundException) throw (InstanceNotFoundException)e; if (e instanceof AttributeNotFoundException) throw (AttributeNotFoundException)e; if (e instanceof InvalidAttributeValueException) throw (InvalidAttributeValueException)e; if (e instanceof MBeanException) throw (MBeanException)e; if (e instanceof ReflectionException) throw (ReflectionException)e; throw makeRuntimeException(e); } finally { if (shouldAuditLog(delegate, readOnly)) { new MBeanServerAuditLogRecordFormatter(this, error, readOnly).setAttribute(name, attribute); } } }
} catch (Exception e) { error = e; throw makeRuntimeException(e); } finally { if (error != null || shouldLog) { new MBeanServerAuditLogRecordFormatter(this, error, readOnly).getMBeanCount();
@Override public ObjectInstance getObjectInstance(ObjectName name) throws InstanceNotFoundException { Throwable error = null; MBeanServerPlugin delegate = null; final boolean readOnly = true; try { delegate = findDelegate(name); authorizeMBeanOperation(delegate, name, GET_OBJECT_INSTANCE, null, JmxAction.Impact.READ_ONLY); return delegate.getObjectInstance(name); } catch (Exception e) { error = e; if (e instanceof InstanceNotFoundException) throw (InstanceNotFoundException)e; throw makeRuntimeException(e); } finally { if (shouldAuditLog(delegate, readOnly)) { new MBeanServerAuditLogRecordFormatter(this, error, readOnly).getObjectInstance(name); } } }
} catch (Exception e) { error = e; throw makeRuntimeException(e); } finally { if (shouldAuditLog == null || shouldAuditLog) { new MBeanServerAuditLogRecordFormatter(this, error, readOnly).isRegistered(name);