org.oddjob.jmx.server
Class OddjobJMXFileAccessController

java.lang.Object
  extended by org.oddjob.jmx.server.OddjobJMXFileAccessController
All Implemented Interfaces:
OddjobJMXAccessController

public class OddjobJMXFileAccessController
extends Object
implements OddjobJMXAccessController

This is a big rip off of com.sun.jmx.remote.security.MBeanServerFileAccessController


Field Summary
static String READONLY
           
static String READWRITE
           
 
Constructor Summary
OddjobJMXFileAccessController(Properties accessFileProps)
          Create a new MBeanServerAccessController that forwards all the MBeanServer requests to the MBeanServer set by invoking the #setMBeanServer method after doing access checks based on read and write permissions.
OddjobJMXFileAccessController(String accessFileName)
          Create a new MBeanServerAccessController that forwards all the MBeanServer requests to the MBeanServer set by invoking the #setMBeanServer method after doing access checks based on read and write permissions.
 
Method Summary
 boolean isAccessable(MBeanOperationInfo opInfo)
           
 void refresh()
          Refresh the set of username/access level entries.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

READONLY

public static final String READONLY
See Also:
Constant Field Values

READWRITE

public static final String READWRITE
See Also:
Constant Field Values
Constructor Detail

OddjobJMXFileAccessController

public OddjobJMXFileAccessController(String accessFileName)
                              throws IOException

Create a new MBeanServerAccessController that forwards all the MBeanServer requests to the MBeanServer set by invoking the #setMBeanServer method after doing access checks based on read and write permissions.

This instance is initialized from the specified properties file.

Parameters:
accessFileName - name of the file which denotes a properties file on disk containing the username/access level entries.
Throws:
IOException - if the file does not exist, is a directory rather than a regular file, or for some other reason cannot be opened for reading.
IllegalArgumentException - if any of the supplied access level values differs from "readonly" or "readwrite".

OddjobJMXFileAccessController

public OddjobJMXFileAccessController(Properties accessFileProps)
                              throws IOException

Create a new MBeanServerAccessController that forwards all the MBeanServer requests to the MBeanServer set by invoking the #setMBeanServer method after doing access checks based on read and write permissions.

This instance is initialized from the specified properties instance. This constructor makes a copy of the properties instance using its clone method and it is the copy that is consulted to check the username and access level of an incoming connection. The original properties object can be modified without affecting the copy. If the refresh() method is then called, the MBeanServerFileAccessController will make a new copy of the properties object at that time.

Parameters:
accessFileProps - properties list containing the username/access level entries.
Throws:
IllegalArgumentException - if accessFileProps is null or if any of the supplied access level values differs from "readonly" or "readwrite".
IOException
Method Detail

isAccessable

public boolean isAccessable(MBeanOperationInfo opInfo)
Specified by:
isAccessable in interface OddjobJMXAccessController

refresh

public void refresh()
             throws IOException

Refresh the set of username/access level entries.

If this instance was created using the #MBeanServerFileAccessController(String) or #MBeanServerFileAccessController(String,MBeanServer) constructors to specify a file from which the entries are read, the file is re-read.

If this instance was created using the #MBeanServerFileAccessController(Properties) or #MBeanServerFileAccessController(Properties,MBeanServer) constructors then a new copy of the Properties object is made.

Throws:
IOException - if the file does not exist, is a directory rather than a regular file, or for some other reason cannot be opened for reading.
IllegalArgumentException - if any of the supplied access level values differs from "readonly" or "readwrite".