org.apache.beehive.controls.api.bean
Class Controls

Object
  extended by Controls

public class Controls
extends Object

Helper class for using controls. Includes static methods to help instantiate controls, and initialize declarative control clients.


Constructor Summary
Controls()
           
 
Method Summary
static void initializeClient(ClassLoader cl, Object client, ControlBeanContext cbc)
          Helper method for initializing instances of declarative control clients (objects that use controls via @Control and @EventHandler annotations).
static
<T extends ControlBean>
T
instantiate(Class<T> beanClass, PropertyMap props, ControlBeanContext context, String id)
          Factory method for instantiating controls.
static ControlBean instantiate(ClassLoader cl, String beanName, PropertyMap props)
          Factory method for instantiating controls.
static ControlBean instantiate(ClassLoader cl, String beanName, PropertyMap props, ControlBeanContext cbc, String id)
          Factory method for instantiating controls.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Controls

public Controls()
Method Detail

instantiate

public static ControlBean instantiate(ClassLoader cl,
                                      String beanName,
                                      PropertyMap props)
                               throws ClassNotFoundException
Factory method for instantiating controls. Controls instantiated using this method will be associated with the current thread-local ControlBeanContext (possibly none), and have an auto-generated ID.

Parameters:
cl - the classloader used to load the ControlBean. If null, the system classloader will be used.
beanName - the fully qualified name of the ControlBean class.
props - an optional PropertyMap containing initial property values for the control. May be null.
Returns:
an instance of the specified ControlBean.
Throws:
ClassNotFoundException

instantiate

public static ControlBean instantiate(ClassLoader cl,
                                      String beanName,
                                      PropertyMap props,
                                      ControlBeanContext cbc,
                                      String id)
                               throws ClassNotFoundException
Factory method for instantiating controls.

Parameters:
cl - the classloader used to load the ControlBean. If null, the system classloader will be used.
beanName - the fully qualified name of the ControlBean class.
props - an optional PropertyMap containing initial property values for the control. May be null.
cbc - the ControlBeanContext that will nest the created control. If null, the thread-local context (possibly none) will be used.
id - a unique ID for the created control. If null, an ID will be auto-generated.
Returns:
an instance of the specified ControlBean.
Throws:
ClassNotFoundException

instantiate

public static <T extends ControlBean> T instantiate(Class<T> beanClass,
                                                    PropertyMap props,
                                                    ControlBeanContext context,
                                                    String id)
Factory method for instantiating controls.

Parameters:
beanClass - the ControlBean class to instantiate
props - an optional PropertyMap containing initial property values for the control. may be null.
context - the ControlBeanContext that will nest the created control. If null, the thread-local context (possibly none) will be used.
id - a unique ID for the created control. If null, an ID will be auto-generated.
Returns:
an instance of the specified ControlBean.

initializeClient

public static void initializeClient(ClassLoader cl,
                                    Object client,
                                    ControlBeanContext cbc)
                             throws ClassNotFoundException
Helper method for initializing instances of declarative control clients (objects that use controls via @Control and @EventHandler annotations). This method runs the client-specific generated ClientInitializer class to do its initialization work.

Parameters:
cl - the classloader used to load the ClientInitializer. If null, defaults to the classloader used to load the client object being initialized.
client - the client object being initialized.
cbc - the ControlBeanContext to be associated with the client object (that will nest the controls the client defines). If null, the thread-local context (possibly none) will be used.
Throws:
ControlException
ClassNotFoundException