org.oddjob.jmx.general
Class MBeanDirectory

java.lang.Object
  extended by org.oddjob.jmx.general.MBeanDirectory
All Implemented Interfaces:
BeanDirectory

public class MBeanDirectory
extends Object
implements BeanDirectory

An implementation of an BeanDirectory for accessing MBeanNodes.

getIdFor(Object) and getAllByType(Class) are not currently supported.

Author:
rob

Constructor Summary
MBeanDirectory(MBeanSession session)
           
 
Method Summary
<T> Iterable<T>
getAllByType(Class<T> type)
          Get all objects in the directory of the required type.
 String getIdFor(Object bean)
          Find the id for the given component.
 Object lookup(String path)
          Get the value which is either a bean or the property of a bean.
<T> T
lookup(String path, Class<T> required)
          Get a value, as above, but also convert it into to given type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MBeanDirectory

public MBeanDirectory(MBeanSession session)
Method Detail

lookup

public Object lookup(String path)
              throws ArooaPropertyException
Description copied from interface: BeanDirectory
Get the value which is either a bean or the property of a bean.

The path can be either:

Specified by:
lookup in interface BeanDirectory
Returns:
The resultant value or null.
Throws:
ArooaPropertyException - If property access fails.

lookup

public <T> T lookup(String path,
                    Class<T> required)
         throws ArooaPropertyException,
                ArooaConversionException
Description copied from interface: BeanDirectory
Get a value, as above, but also convert it into to given type.

Conversion in the directory is required when the client code has no access to the converters required, for instance in a nested Oddjob.

Specified by:
lookup in interface BeanDirectory
Type Parameters:
T - The required type.
Parameters:
path - The full path
required - The required type.
Returns:
An object of the required type or null if none can be found.
Throws:
ArooaPropertyException - If property access fails.
ArooaConversionException - If an object can be found but it can't be converted into the required type.

getIdFor

public String getIdFor(Object bean)
Description copied from interface: BeanDirectory
Find the id for the given component.

Specified by:
getIdFor in interface BeanDirectory
Returns:
The id or null if none can be found.

getAllByType

public <T> Iterable<T> getAllByType(Class<T> type)
Description copied from interface: BeanDirectory
Get all objects in the directory of the required type.

Why an Iterable not a Collection or Set? It was thought that this would force read only use. Maybe it should be an array...

Specified by:
getAllByType in interface BeanDirectory
Type Parameters:
T - The required type.
Parameters:
type - The type.
Returns:
An Iterable for matches. Never null.