org.baswell.easybeans
Class EasyBeansRegistery

java.lang.Object
  extended by org.baswell.easybeans.EasyBeansRegistery

public class EasyBeansRegistery
extends java.lang.Object

Helper class for registering and unregistering Java beans and JMX MBeans. All beans are registered with ManagementFactory.getPlatformMBeanServer().


Constructor Summary
EasyBeansRegistery()
           
EasyBeansRegistery(javax.management.MBeanServer mBeanServer)
           
 
Method Summary
 void register(java.util.List beans)
          Registers each of the given beans.
 void register(java.lang.Object bean)
          If the given bean is already an instanceof of EasyBeanWrapper then the given bean will be registered directly with the MBean server.
 void unregister(java.lang.Object bean)
          Unregisters the given bean from the MBean server.
 void unregisterAll()
          Unregisters all previously registered beans.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EasyBeansRegistery

public EasyBeansRegistery()

EasyBeansRegistery

public EasyBeansRegistery(javax.management.MBeanServer mBeanServer)
Method Detail

register

public void register(java.lang.Object bean)
              throws InvalidEasyBeanNameException,
                     InvalidEasyBeanAnnotation,
                     InvalidEasyBeanOpenType,
                     ObjectNameAlreadyRegistered,
                     UnexpectedEasyBeanException
If the given bean is already an instanceof of EasyBeanWrapper then the given bean will be registered directly with the MBean server. Otherwise the object will be wrapped with either EasyBeanNotificationWrapper (if the bean implements EasyBeansNotifierUser or NotificationBroadcaster) or a EasyBeanWrapper.

Parameters:
bean - The bean to register.
Throws:
InvalidEasyBeanNameException - If the ObjectName used for this bean in invalid.
InvalidEasyBeanAnnotation - If an EasyBean annotation is used incorrectly.
InvalidEasyBeanOpenType - If the given object (or a descendant of this object) cannot be mapped to an OpenType.
ObjectNameAlreadyRegistered - If the object name used for this bean is already registered.
UnexpectedEasyBeanException - If something unexpected occurred.

register

public void register(java.util.List beans)
              throws InvalidEasyBeanNameException,
                     InvalidEasyBeanAnnotation,
                     InvalidEasyBeanOpenType,
                     ObjectNameAlreadyRegistered,
                     UnexpectedEasyBeanException
Registers each of the given beans.

Parameters:
beans -
Throws:
InvalidEasyBeanNameException - If the ObjectName used for this bean in invalid.
InvalidEasyBeanAnnotation - If an EasyBean annotation is used incorrectly.
InvalidEasyBeanOpenType - If the given object (or a descendant of this object) cannot be mapped to an OpenType.
ObjectNameAlreadyRegistered - If the object name used for this bean is already registered.
UnexpectedEasyBeanException - If something unexpected occurred.
See Also:
register(Object)

unregister

public void unregister(java.lang.Object bean)
                throws UnexpectedEasyBeanException
Unregisters the given bean from the MBean server.

Parameters:
bean -
Throws:
UnexpectedEasyBeanException - If something unexpected occurred.

unregisterAll

public void unregisterAll()
Unregisters all previously registered beans.