com.sun.jdmk
Class MBeanServerChecker

java.lang.Object
  extended by com.sun.jdmk.MBeanServerForwarder
      extended by com.sun.jdmk.MBeanServerChecker
All Implemented Interfaces:
MBeanServer, MBeanServerConnection

public abstract class MBeanServerChecker
extends MBeanServerForwarder

An object of this class implements the MBeanServer interface and, for each of its methods, calls an appropriate checking method and then forwards the request to a wrapped MBeanServer object. The checking method may throw a RuntimeException if the operation is not allowed; in this case the request is not forwarded to the wrapped object.

A typical use of this class is to insert it between a connector server such as the HTTP connector and the MBeanServer with which the connector is associated. Requests from the connector client can then be filtered and those operations that are not allowed, or not allowed in a particular context, can be rejected by throwing a SecurityException in the corresponding check* method.

A checking method can obtain the OperationContext associated with the request being handled, if there is one, by calling getOperationContext().

This is an abstract class, because in its implementation none of the checking methods does anything. To be useful, it must be subclassed and at least one of the checking methods overridden to do some checking. Some or all of the MBeanServer methods may also be overridden, for instance if the default checking behavior is inappropriate.

In effect, three levels of checking are possible:

The documentation of the individual check* methods describes what the value of the methodName parameter may be. Future versions of this class may extend these possible values to allow for new methods in the MBeanServer interface.


Constructor Summary
protected MBeanServerChecker(MBeanServer mbs)
          Make a new MBeanServerChecker that forwards each method from the MBeanServer interface to the given object, after calling an appropriate checking method.
 
Method Summary
 void addNotificationListener(ObjectName name, NotificationListener listener, NotificationFilter filter, Object handback)
          Call checkAny("addNotificationListener", name), then checkNotification("addNotificationListener", name), then forward this method to the wrapped object.
 void addNotificationListener(ObjectName name, ObjectName listener, NotificationFilter filter, Object handback)
          Call checkAny("addNotificationListener", name), then checkNotification("addNotificationListener", name), then forward this method to the wrapped object.
protected  void checkAny(String methodName, ObjectName objectName)
          Checking operation invoked by every method from the MBeanServer interface.
protected  void checkCreate(String methodName, String className, ObjectName objectName, ObjectName loaderName, Object[] params, String[] signature)
          Checking operation invoked by each of the overloaded forms of createMBean and by registerMBean.
protected  void checkDelete(String methodName, ObjectName objectName)
          Checking operation invoked by unregisterMBean.
protected  void checkDeserialize(String methodName, Object objectNameOrClass)
          Checking operation invoked by each of the overloaded forms of deserialize.
protected  void checkInstantiate(String methodName, String className, ObjectName loaderName, Object[] params, String[] signature)
          Checking operation invoked by each of the overloaded forms of instantiate.
protected  void checkInvoke(String methodName, ObjectName objectName, String operationName, Object[] params, String[] signature)
          Checking operation invoked by invoke.
protected  void checkNotification(String methodName, ObjectName objectName)
          Checking operation invoked by each of the overloaded forms of addNotificationListener and removeNotificationListener.
protected  void checkQuery(String methodName, ObjectName name, QueryExp query)
          Checking operation invoked by queryMBeans and queryNames.
protected  void checkRead(String methodName, ObjectName objectName)
          Checking operation invoked by getAttribute, getAttributes, getObjectInstance, isRegistered, getMBeanCount, getDefaultDomain, getMBeanInfo, and isInstanceOf.
protected  void checkWrite(String methodName, ObjectName objectName)
          Checking operation invoked by setAttribute and setAttributes.
 ObjectInstance createMBean(String className, ObjectName name, Object[] params, String[] signature)
          Call checkAny("createMBean", name), then checkCreate("createMBean", className, name, null, params, signature), then forward this method to the wrapped object.
 ObjectInstance createMBean(String className, ObjectName name, ObjectName loaderName, Object[] params, String[] signature)
          Call checkAny("createMBean", name), then checkCreate("createMBean", className, name, loaderName, params, signature), then forward this method to the wrapped object.
 ObjectInputStream deserialize(ObjectName name, byte[] data)
          Call checkAny("deserialize", name), then checkDeserialize("deserialize", name), then forward this method to the wrapped object.
 ObjectInputStream deserialize(String className, byte[] data)
          Call checkAny("deserialize", null), then checkDeserialize("deserialize", className), then forward this method to the wrapped object.
 ObjectInputStream deserialize(String className, ObjectName loaderName, byte[] data)
          Call checkAny("deserialize", null), then checkDeserialize("deserialize", className), then forward this method to the wrapped object.
 Object getAttribute(ObjectName name, String attribute)
          Call checkAny("getAttribute"), then checkRead("getAttribute", name), then forward this method to the wrapped object.
 AttributeList getAttributes(ObjectName name, String[] attributes)
          Call checkAny("getAttributes", name), then checkRead("getAttributes", name), then forward this method to the wrapped object.
 ClassLoader getClassLoader(ObjectName loaderName)
          Call checkAny("getClassLoader", loaderName), then checkRead("getClassLoader", loaderName), then forward this method to the wrapped object.
 ClassLoader getClassLoaderFor(ObjectName mbeanName)
          Call checkAny("getClassLoaderFor", mbeanName), then checkRead("getClassLoaderFor", mbeanName), then forward this method to the wrapped object.
 ClassLoaderRepository getClassLoaderRepository()
          Call checkAny("getClassLoaderRepository", null), then checkRead("getClassLoaderRepository", null), then forward this method to the wrapped object.
 String getDefaultDomain()
          Call checkAny("getDefaultDomain", null), then checkRead("getDefaultDomain", null), then forward this method to the wrapped object.
 String[] getDomains()
          Call checkAny("getDomains", null), then checkRead("getDomains", null), then forward this method to the wrapped object.
 Integer getMBeanCount()
          Call checkAny("getMBeanCount", null), then checkRead("getMBeanCount", null), then forward this method to the wrapped object.
 MBeanInfo getMBeanInfo(ObjectName name)
          Call checkAny("getMBeanInfo", name), then checkRead("getMBeanInfo", name), then forward this method to the wrapped object.
 ObjectInstance getObjectInstance(ObjectName name)
          Call checkAny("getObjectInstance", name), then checkRead("getObjectInstance", name), then forward this method to the wrapped object.
protected  OperationContext getOperationContext()
          Return the OperationContext associated with the request being handled.
 Object instantiate(String className, Object[] params, String[] signature)
          Call checkAny("instantiate", null), then checkInstantiate("instantiate", className, null, params, signature), then forward this method to the wrapped object.
 Object instantiate(String className, ObjectName loaderName, Object[] params, String[] signature)
          Call checkAny("instantiate", null), then checkInstantiate("instantiate", className, loaderName, params, signature), then forward this method to the wrapped object.
 Object invoke(ObjectName name, String operationName, Object[] params, String[] signature)
          Call checkAny("invoke", name), then checkInvoke("invoke", name, operationName, params, signature), then forward this method to the wrapped object.
 boolean isInstanceOf(ObjectName name, String className)
          Call checkAny("isInstanceOf", name), then checkRead("isInstanceOf", name), then forward this method to the wrapped object.
 boolean isRegistered(ObjectName name)
          Call checkAny("isRegistered", name), then checkRead("isRegistered", name), then forward this method to the wrapped object.
 Set queryMBeans(ObjectName name, QueryExp query)
          Call checkAny("queryMBeans", name), then checkQuery("queryMBeans", name, query), then forward this method to the wrapped object.
 Set queryNames(ObjectName name, QueryExp query)
          Call checkAny("queryNames", name), then checkQuery("queryNames", name, query), then forward this method to the wrapped object.
 ObjectInstance registerMBean(Object object, ObjectName name)
          Call checkAny("registerMBean", name), then checkCreate("registerMBean", object.getClass().getName(), name, null, null, null), then forward this method to the wrapped object.
 void removeNotificationListener(ObjectName name, NotificationListener listener)
          Call checkAny("removeNotificationListener", name), then checkNotification("removeNotificationListener", name), then forward this method to the wrapped object.
 void removeNotificationListener(ObjectName name, NotificationListener listener, NotificationFilter filter, Object handback)
          Call checkAny("removeNotificationListener", name), then checkNotification("removeNotificationListener", name), then forward this method to the wrapped object.
 void removeNotificationListener(ObjectName name, ObjectName listener)
          Call checkAny("removeNotificationListener", name), then checkNotification("removeNotificationListener", name), then forward this method to the wrapped object.
 void removeNotificationListener(ObjectName name, ObjectName listener, NotificationFilter filter, Object handback)
          Call checkAny("removeNotificationListener", name), then checkNotification("removeNotificationListener", name), then forward this method to the wrapped object.
 void setAttribute(ObjectName name, Attribute attribute)
          Call checkAny("setAttribute", name), then checkWrite("setAttribute", name), then forward this method to the wrapped object.
 AttributeList setAttributes(ObjectName name, AttributeList attributes)
          Call checkAny("setAttributes", name), then checkWrite("setAttributes", name), then forward this method to the wrapped object.
 void unregisterMBean(ObjectName name)
          Call checkAny("unregisterMBean", name), then checkDelete("unregisterMBean", name), then forward this method to the wrapped object.
 
Methods inherited from class com.sun.jdmk.MBeanServerForwarder
createMBean, createMBean, getMBeanServer, instantiate, instantiate, setMBeanServer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MBeanServerChecker

protected MBeanServerChecker(MBeanServer mbs)

Make a new MBeanServerChecker that forwards each method from the MBeanServer interface to the given object, after calling an appropriate checking method.

Parameters:
mbs - the object implementing the MBeanServer interface to which methods should be forwarded.
Method Detail

instantiate

public Object instantiate(String className,
                          Object[] params,
                          String[] signature)
                   throws ReflectionException,
                          MBeanException
Call checkAny("instantiate", null), then checkInstantiate("instantiate", className, null, params, signature), then forward this method to the wrapped object.

Specified by:
instantiate in interface MBeanServer
Overrides:
instantiate in class MBeanServerForwarder
Throws:
ReflectionException
MBeanException

instantiate

public Object instantiate(String className,
                          ObjectName loaderName,
                          Object[] params,
                          String[] signature)
                   throws ReflectionException,
                          MBeanException,
                          InstanceNotFoundException
Call checkAny("instantiate", null), then checkInstantiate("instantiate", className, loaderName, params, signature), then forward this method to the wrapped object.

Specified by:
instantiate in interface MBeanServer
Overrides:
instantiate in class MBeanServerForwarder
Throws:
ReflectionException
MBeanException
InstanceNotFoundException

createMBean

public ObjectInstance createMBean(String className,
                                  ObjectName name,
                                  Object[] params,
                                  String[] signature)
                           throws ReflectionException,
                                  InstanceAlreadyExistsException,
                                  MBeanRegistrationException,
                                  MBeanException,
                                  NotCompliantMBeanException
Call checkAny("createMBean", name), then checkCreate("createMBean", className, name, null, params, signature), then forward this method to the wrapped object.

Specified by:
createMBean in interface MBeanServer
Specified by:
createMBean in interface MBeanServerConnection
Overrides:
createMBean in class MBeanServerForwarder
Throws:
ReflectionException
InstanceAlreadyExistsException
MBeanRegistrationException
MBeanException
NotCompliantMBeanException

createMBean

public ObjectInstance createMBean(String className,
                                  ObjectName name,
                                  ObjectName loaderName,
                                  Object[] params,
                                  String[] signature)
                           throws ReflectionException,
                                  InstanceAlreadyExistsException,
                                  MBeanRegistrationException,
                                  MBeanException,
                                  NotCompliantMBeanException,
                                  InstanceNotFoundException
Call checkAny("createMBean", name), then checkCreate("createMBean", className, name, loaderName, params, signature), then forward this method to the wrapped object.

Specified by:
createMBean in interface MBeanServer
Specified by:
createMBean in interface MBeanServerConnection
Overrides:
createMBean in class MBeanServerForwarder
Throws:
ReflectionException
InstanceAlreadyExistsException
MBeanRegistrationException
MBeanException
NotCompliantMBeanException
InstanceNotFoundException

registerMBean

public ObjectInstance registerMBean(Object object,
                                    ObjectName name)
                             throws InstanceAlreadyExistsException,
                                    MBeanRegistrationException,
                                    NotCompliantMBeanException
Call checkAny("registerMBean", name), then checkCreate("registerMBean", object.getClass().getName(), name, null, null, null), then forward this method to the wrapped object.

Specified by:
registerMBean in interface MBeanServer
Overrides:
registerMBean in class MBeanServerForwarder
Throws:
InstanceAlreadyExistsException
MBeanRegistrationException
NotCompliantMBeanException

unregisterMBean

public void unregisterMBean(ObjectName name)
                     throws InstanceNotFoundException,
                            MBeanRegistrationException
Call checkAny("unregisterMBean", name), then checkDelete("unregisterMBean", name), then forward this method to the wrapped object.

Specified by:
unregisterMBean in interface MBeanServer
Specified by:
unregisterMBean in interface MBeanServerConnection
Overrides:
unregisterMBean in class MBeanServerForwarder
Throws:
InstanceNotFoundException
MBeanRegistrationException

getObjectInstance

public ObjectInstance getObjectInstance(ObjectName name)
                                 throws InstanceNotFoundException
Call checkAny("getObjectInstance", name), then checkRead("getObjectInstance", name), then forward this method to the wrapped object.

Specified by:
getObjectInstance in interface MBeanServer
Specified by:
getObjectInstance in interface MBeanServerConnection
Overrides:
getObjectInstance in class MBeanServerForwarder
Throws:
InstanceNotFoundException

queryMBeans

public Set queryMBeans(ObjectName name,
                       QueryExp query)
Call checkAny("queryMBeans", name), then checkQuery("queryMBeans", name, query), then forward this method to the wrapped object.

Specified by:
queryMBeans in interface MBeanServer
Specified by:
queryMBeans in interface MBeanServerConnection
Overrides:
queryMBeans in class MBeanServerForwarder

queryNames

public Set queryNames(ObjectName name,
                      QueryExp query)
Call checkAny("queryNames", name), then checkQuery("queryNames", name, query), then forward this method to the wrapped object.

Specified by:
queryNames in interface MBeanServer
Specified by:
queryNames in interface MBeanServerConnection
Overrides:
queryNames in class MBeanServerForwarder

isRegistered

public boolean isRegistered(ObjectName name)
Call checkAny("isRegistered", name), then checkRead("isRegistered", name), then forward this method to the wrapped object.

Specified by:
isRegistered in interface MBeanServer
Specified by:
isRegistered in interface MBeanServerConnection
Overrides:
isRegistered in class MBeanServerForwarder

getMBeanCount

public Integer getMBeanCount()
Call checkAny("getMBeanCount", null), then checkRead("getMBeanCount", null), then forward this method to the wrapped object.

Specified by:
getMBeanCount in interface MBeanServer
Specified by:
getMBeanCount in interface MBeanServerConnection
Overrides:
getMBeanCount in class MBeanServerForwarder

getAttribute

public Object getAttribute(ObjectName name,
                           String attribute)
                    throws MBeanException,
                           AttributeNotFoundException,
                           InstanceNotFoundException,
                           ReflectionException
Call checkAny("getAttribute"), then checkRead("getAttribute", name), then forward this method to the wrapped object.

Specified by:
getAttribute in interface MBeanServer
Specified by:
getAttribute in interface MBeanServerConnection
Overrides:
getAttribute in class MBeanServerForwarder
Throws:
MBeanException
AttributeNotFoundException
InstanceNotFoundException
ReflectionException

getAttributes

public AttributeList getAttributes(ObjectName name,
                                   String[] attributes)
                            throws InstanceNotFoundException,
                                   ReflectionException
Call checkAny("getAttributes", name), then checkRead("getAttributes", name), then forward this method to the wrapped object.

Specified by:
getAttributes in interface MBeanServer
Specified by:
getAttributes in interface MBeanServerConnection
Overrides:
getAttributes in class MBeanServerForwarder
Throws:
InstanceNotFoundException
ReflectionException

setAttribute

public void setAttribute(ObjectName name,
                         Attribute attribute)
                  throws InstanceNotFoundException,
                         AttributeNotFoundException,
                         InvalidAttributeValueException,
                         MBeanException,
                         ReflectionException
Call checkAny("setAttribute", name), then checkWrite("setAttribute", name), then forward this method to the wrapped object.

Specified by:
setAttribute in interface MBeanServer
Specified by:
setAttribute in interface MBeanServerConnection
Overrides:
setAttribute in class MBeanServerForwarder
Throws:
InstanceNotFoundException
AttributeNotFoundException
InvalidAttributeValueException
MBeanException
ReflectionException

setAttributes

public AttributeList setAttributes(ObjectName name,
                                   AttributeList attributes)
                            throws InstanceNotFoundException,
                                   ReflectionException
Call checkAny("setAttributes", name), then checkWrite("setAttributes", name), then forward this method to the wrapped object.

Specified by:
setAttributes in interface MBeanServer
Specified by:
setAttributes in interface MBeanServerConnection
Overrides:
setAttributes in class MBeanServerForwarder
Throws:
InstanceNotFoundException
ReflectionException

invoke

public Object invoke(ObjectName name,
                     String operationName,
                     Object[] params,
                     String[] signature)
              throws InstanceNotFoundException,
                     MBeanException,
                     ReflectionException
Call checkAny("invoke", name), then checkInvoke("invoke", name, operationName, params, signature), then forward this method to the wrapped object.

Specified by:
invoke in interface MBeanServer
Specified by:
invoke in interface MBeanServerConnection
Overrides:
invoke in class MBeanServerForwarder
Throws:
InstanceNotFoundException
MBeanException
ReflectionException

getDefaultDomain

public String getDefaultDomain()
Call checkAny("getDefaultDomain", null), then checkRead("getDefaultDomain", null), then forward this method to the wrapped object.

Specified by:
getDefaultDomain in interface MBeanServer
Specified by:
getDefaultDomain in interface MBeanServerConnection
Overrides:
getDefaultDomain in class MBeanServerForwarder

getDomains

public String[] getDomains()
Call checkAny("getDomains", null), then checkRead("getDomains", null), then forward this method to the wrapped object.

Specified by:
getDomains in interface MBeanServer
Specified by:
getDomains in interface MBeanServerConnection
Overrides:
getDomains in class MBeanServerForwarder

addNotificationListener

public void addNotificationListener(ObjectName name,
                                    NotificationListener listener,
                                    NotificationFilter filter,
                                    Object handback)
                             throws InstanceNotFoundException
Call checkAny("addNotificationListener", name), then checkNotification("addNotificationListener", name), then forward this method to the wrapped object.

Specified by:
addNotificationListener in interface MBeanServer
Specified by:
addNotificationListener in interface MBeanServerConnection
Overrides:
addNotificationListener in class MBeanServerForwarder
Throws:
InstanceNotFoundException

addNotificationListener

public void addNotificationListener(ObjectName name,
                                    ObjectName listener,
                                    NotificationFilter filter,
                                    Object handback)
                             throws InstanceNotFoundException
Call checkAny("addNotificationListener", name), then checkNotification("addNotificationListener", name), then forward this method to the wrapped object.

Specified by:
addNotificationListener in interface MBeanServer
Specified by:
addNotificationListener in interface MBeanServerConnection
Overrides:
addNotificationListener in class MBeanServerForwarder
Throws:
InstanceNotFoundException

removeNotificationListener

public void removeNotificationListener(ObjectName name,
                                       NotificationListener listener)
                                throws InstanceNotFoundException,
                                       ListenerNotFoundException
Call checkAny("removeNotificationListener", name), then checkNotification("removeNotificationListener", name), then forward this method to the wrapped object.

Specified by:
removeNotificationListener in interface MBeanServer
Specified by:
removeNotificationListener in interface MBeanServerConnection
Overrides:
removeNotificationListener in class MBeanServerForwarder
Throws:
InstanceNotFoundException
ListenerNotFoundException

removeNotificationListener

public void removeNotificationListener(ObjectName name,
                                       NotificationListener listener,
                                       NotificationFilter filter,
                                       Object handback)
                                throws InstanceNotFoundException,
                                       ListenerNotFoundException
Call checkAny("removeNotificationListener", name), then checkNotification("removeNotificationListener", name), then forward this method to the wrapped object.

Specified by:
removeNotificationListener in interface MBeanServer
Specified by:
removeNotificationListener in interface MBeanServerConnection
Overrides:
removeNotificationListener in class MBeanServerForwarder
Throws:
InstanceNotFoundException
ListenerNotFoundException

removeNotificationListener

public void removeNotificationListener(ObjectName name,
                                       ObjectName listener)
                                throws InstanceNotFoundException,
                                       ListenerNotFoundException
Call checkAny("removeNotificationListener", name), then checkNotification("removeNotificationListener", name), then forward this method to the wrapped object.

Specified by:
removeNotificationListener in interface MBeanServer
Specified by:
removeNotificationListener in interface MBeanServerConnection
Overrides:
removeNotificationListener in class MBeanServerForwarder
Throws:
InstanceNotFoundException
ListenerNotFoundException

removeNotificationListener

public void removeNotificationListener(ObjectName name,
                                       ObjectName listener,
                                       NotificationFilter filter,
                                       Object handback)
                                throws InstanceNotFoundException,
                                       ListenerNotFoundException
Call checkAny("removeNotificationListener", name), then checkNotification("removeNotificationListener", name), then forward this method to the wrapped object.

Specified by:
removeNotificationListener in interface MBeanServer
Specified by:
removeNotificationListener in interface MBeanServerConnection
Overrides:
removeNotificationListener in class MBeanServerForwarder
Throws:
InstanceNotFoundException
ListenerNotFoundException

getMBeanInfo

public MBeanInfo getMBeanInfo(ObjectName name)
                       throws InstanceNotFoundException,
                              IntrospectionException,
                              ReflectionException
Call checkAny("getMBeanInfo", name), then checkRead("getMBeanInfo", name), then forward this method to the wrapped object.

Specified by:
getMBeanInfo in interface MBeanServer
Specified by:
getMBeanInfo in interface MBeanServerConnection
Overrides:
getMBeanInfo in class MBeanServerForwarder
Throws:
InstanceNotFoundException
IntrospectionException
ReflectionException

isInstanceOf

public boolean isInstanceOf(ObjectName name,
                            String className)
                     throws InstanceNotFoundException
Call checkAny("isInstanceOf", name), then checkRead("isInstanceOf", name), then forward this method to the wrapped object.

Specified by:
isInstanceOf in interface MBeanServer
Specified by:
isInstanceOf in interface MBeanServerConnection
Overrides:
isInstanceOf in class MBeanServerForwarder
Throws:
InstanceNotFoundException

deserialize

public ObjectInputStream deserialize(ObjectName name,
                                     byte[] data)
                              throws InstanceNotFoundException,
                                     OperationsException
Call checkAny("deserialize", name), then checkDeserialize("deserialize", name), then forward this method to the wrapped object.

Specified by:
deserialize in interface MBeanServer
Overrides:
deserialize in class MBeanServerForwarder
Throws:
InstanceNotFoundException
OperationsException

deserialize

public ObjectInputStream deserialize(String className,
                                     byte[] data)
                              throws OperationsException,
                                     ReflectionException
Call checkAny("deserialize", null), then checkDeserialize("deserialize", className), then forward this method to the wrapped object.

Specified by:
deserialize in interface MBeanServer
Overrides:
deserialize in class MBeanServerForwarder
Throws:
OperationsException
ReflectionException

deserialize

public ObjectInputStream deserialize(String className,
                                     ObjectName loaderName,
                                     byte[] data)
                              throws InstanceNotFoundException,
                                     OperationsException,
                                     ReflectionException
Call checkAny("deserialize", null), then checkDeserialize("deserialize", className), then forward this method to the wrapped object.

Specified by:
deserialize in interface MBeanServer
Overrides:
deserialize in class MBeanServerForwarder
Throws:
InstanceNotFoundException
OperationsException
ReflectionException

getClassLoaderFor

public ClassLoader getClassLoaderFor(ObjectName mbeanName)
                              throws InstanceNotFoundException
Call checkAny("getClassLoaderFor", mbeanName), then checkRead("getClassLoaderFor", mbeanName), then forward this method to the wrapped object.

Specified by:
getClassLoaderFor in interface MBeanServer
Overrides:
getClassLoaderFor in class MBeanServerForwarder
Throws:
InstanceNotFoundException

getClassLoader

public ClassLoader getClassLoader(ObjectName loaderName)
                           throws InstanceNotFoundException
Call checkAny("getClassLoader", loaderName), then checkRead("getClassLoader", loaderName), then forward this method to the wrapped object.

Specified by:
getClassLoader in interface MBeanServer
Overrides:
getClassLoader in class MBeanServerForwarder
Throws:
InstanceNotFoundException

getClassLoaderRepository

public ClassLoaderRepository getClassLoaderRepository()
Call checkAny("getClassLoaderRepository", null), then checkRead("getClassLoaderRepository", null), then forward this method to the wrapped object.

Specified by:
getClassLoaderRepository in interface MBeanServer
Overrides:
getClassLoaderRepository in class MBeanServerForwarder

getOperationContext

protected OperationContext getOperationContext()
                                        throws ClassCastException

Return the OperationContext associated with the request being handled.

Returns:
the OperationContext associated with the request being handled, or null if there is none.
Throws:
ClassCastException

checkAny

protected void checkAny(String methodName,
                        ObjectName objectName)

Checking operation invoked by every method from the MBeanServer interface.

The default implementation does nothing. A subclass may override this method to throw a RuntimeException (or a subclass of it) if the operation is not to be allowed.

Parameters:
methodName - the calling method in the MBeanServer interface. This string is just the method name, e.g., "createMBean".
objectName - the ObjectName of the MBean referenced by the operation, or null if there is none.

checkCreate

protected void checkCreate(String methodName,
                           String className,
                           ObjectName objectName,
                           ObjectName loaderName,
                           Object[] params,
                           String[] signature)

Checking operation invoked by each of the overloaded forms of createMBean and by registerMBean.

The default implementation does nothing. A subclass may override this method to throw a RuntimeException (or a subclass of it) if the operation is not to be allowed.

Parameters:
methodName - the calling method in the MBeanServer interface. This string is just the method name, "createMBean" or "registerMBean".
className - the className parameter of the createMBean operation.
objectName - the name parameter of the createMBean operation.
loaderName - the loaderName parameter of the createMBean operation, or null for those forms of the operation that do not have one.
params - the params parameter of the createMBean operation, or null for those forms of the operation that do not have one.
signature - the signature parameter of the createMBean operation, or null for those forms of the operation that do not have one.

checkInstantiate

protected void checkInstantiate(String methodName,
                                String className,
                                ObjectName loaderName,
                                Object[] params,
                                String[] signature)

Checking operation invoked by each of the overloaded forms of instantiate.

The default implementation does nothing. A subclass may override this method to throw a RuntimeException (or a subclass of it) if the operation is not to be allowed.

Parameters:
methodName - the calling method in the MBeanServer interface. This string is just the method name, "instantiate".
className - the className parameter of the instantiate operation.
loaderName - the loaderName parameter of the instantiate operation, or null for those forms of the operation that do not have one.
params - the params parameter of the instantiate operation, or null for those forms of the operation that do not have one.
signature - the signature parameter of the instantiate operation, or null for those forms of the operation that do not have one.

checkDelete

protected void checkDelete(String methodName,
                           ObjectName objectName)

Checking operation invoked by unregisterMBean.

The default implementation does nothing. A subclass may override this method to throw a RuntimeException (or a subclass of it) if the operation is not to be allowed.

Parameters:
methodName - the calling method in the MBeanServer interface. This string is just the method name, "unregisterMBean".
objectName - the name parameter of the unregisterMBean operation.

checkRead

protected void checkRead(String methodName,
                         ObjectName objectName)

Checking operation invoked by getAttribute, getAttributes, getObjectInstance, isRegistered, getMBeanCount, getDefaultDomain, getMBeanInfo, and isInstanceOf.

The default implementation does nothing. A subclass may override this method to throw a RuntimeException (or a subclass of it) if the operation is not to be allowed.

Parameters:
methodName - the calling method in the MBeanServer interface. This string is just the method name, e.g., "getAttribute".
objectName - the ObjectName of the object being accessed, for those operations where there is one, or null otherwise.

checkWrite

protected void checkWrite(String methodName,
                          ObjectName objectName)

Checking operation invoked by setAttribute and setAttributes.

The default implementation does nothing. A subclass may override this method to throw a RuntimeException (or a subclass of it) if the operation is not to be allowed.

Parameters:
methodName - the calling method in the MBeanServer interface. This string is just the method name, e.g., "setAttribute".
objectName - the ObjectName of the object being accessed.

checkQuery

protected void checkQuery(String methodName,
                          ObjectName name,
                          QueryExp query)

Checking operation invoked by queryMBeans and queryNames.

The default implementation does nothing. A subclass may override this method to throw a RuntimeException (or a subclass of it) if the operation is not to be allowed.

Parameters:
methodName - the calling method in the MBeanServer interface. This string is just the method name, e.g., "queryMBeans".
name - the name parameter of the operation.
query - the query parameter of the operation.

checkInvoke

protected void checkInvoke(String methodName,
                           ObjectName objectName,
                           String operationName,
                           Object[] params,
                           String[] signature)

Checking operation invoked by invoke.

The default implementation does nothing. A subclass may override this method to throw a RuntimeException (or a subclass of it) if the operation is not to be allowed.

Parameters:
methodName - the calling method in the MBeanServer interface. This string is just the method name, "invoke".
objectName - the name parameter of the invoke operation.
operationName - the operationName parameter of the invoke operation.
params - the params parameter of the invoke operation.
signature - the signature parameter of the invoke operation.

checkNotification

protected void checkNotification(String methodName,
                                 ObjectName objectName)

Checking operation invoked by each of the overloaded forms of addNotificationListener and removeNotificationListener.

The default implementation does nothing. A subclass may override this method to throw a RuntimeException (or a subclass of it) if the operation is not to be allowed.

Parameters:
methodName - the calling method in the MBeanServer interface. This string is just the method name, e.g., "addNotificationListener".
objectName - the name parameter of the operation.

checkDeserialize

protected void checkDeserialize(String methodName,
                                Object objectNameOrClass)

Checking operation invoked by each of the overloaded forms of deserialize.

The default implementation does nothing. A subclass may override this method to throw a RuntimeException (or a subclass of it) if the operation is not to be allowed.

Parameters:
methodName - the calling method in the MBeanServer interface. This string is just the method name, "deserialize".
objectNameOrClass - a String for those forms of the deserialize operation that have a className parameter, or an ObjectName for those forms that do not.

Open Source build 02
opendmk-1.0-b02 2007.10.01_19:17:46_MEST

Copyright 1998-2007 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.