org.apache.beehive.controls.runtime.bean
Class ControlBean

Object
  extended by ControlBean
All Implemented Interfaces:
BeanContextProxy, Serializable, ControlBean

public abstract class ControlBean
extends Object
implements ControlBean, BeanContextProxy, Serializable

The ControlBean class is an abstract base class for the JavaBean classes generated to support Workshop controls. The ControlBean class extends the BeanContextServicesSupport class, meaning it is capable of being a container and service provider for itself and other nested JavaBeans. All support APIs (which may be called from derived derived subclasses or contextual services are generally marked as protected and have names that start with an underscore. This avoids the possibility that the name might conflict with a user-defined method on a control's public or extended (JCX) interface.

See Also:
Serialized Form

Field Summary
static char FactorySeparator
           
static char IDSeparator
           
 
Constructor Summary
protected ControlBean(ControlBeanContext context, String id, PropertyMap initProperties, Class controlClass)
           
 
Method Summary
 void addInvokeListener(InvokeListener invokeListener)
          Registers a new InvokeListener for this ControlBean.
protected  Object ensureControl()
          Returns the target control instance associated with this ControlBean, performing lazy instantiation and initialization of the instance.
protected  PropertyMap getAnnotationMap(AnnotatedElement annotElem)
          Returns the PropertyMap containing values associated with an AnnotatedElement.
 BeanContext getBeanContext()
          Returns the nesting BeanContext for this ControlBean.
 ControlBeanContext getBeanContextProxy()
          Return the BeanContextService proxy associated with this bean instance
 ControlBeanContext getControlBeanContext()
          Returns the bean context instance associated with the this bean, as opposed to the parent context returned by the public getBeanContext() API.
 String getControlID()
          Returns the control ID for this control
 Class getControlInterface()
          Returns the public interface for this control.
protected  Object getControlProperty(PropertyKey key)
          Returns a property on the ControlBean instance.
protected  Object getControlService(Class serviceClass, Object selector)
          Locates and obtains a context service from the BeanContextServices instance supporting this bean.
protected  EventNotifier getEventNotifier(Class eventSet)
          Returns the EventNotifier for this ControlBean
 ImplInitializer getImplInitializer()
          Obtains an instance of the appropriate ImplInitializer class
protected  String getLocalID()
          Returns the local (parent-relative) ID for this ControlBean
protected  String[] getParameterNames(Method m)
          Returns the parameter names for a method on the ControlBean.
protected abstract  Map getPropertyMapCache()
          Returns the local cache for ControlBean property maps.
 boolean isSingleThreadedBean()
          Returns true if the ControlBean instance is running in an environment that guarantees single-threaded behvior, false otherwise
protected  void postInvoke(Object retval, Throwable t)
          The postInvoke method is called after all operations on the control.
protected  void preInvoke(Method m, Object[] args)
          The preinvoke method is called before all operations on the control.
 void removeInvokeListener(InvokeListener invokeListener)
          Deregisters an existing InvokeListener for this ControlBean.
 void setBeanContext(BeanContext bc)
          Called by the BeanContextProxy whenever the context associated with this control bean is changed.
 void setControlID(String id)
          Sets the absolute controlID for this ControlBean.
protected  void setControlProperty(PropertyKey key, boolean b)
           
protected  void setControlProperty(PropertyKey key, byte b)
           
protected  void setControlProperty(PropertyKey key, char c)
           
protected  void setControlProperty(PropertyKey key, double d)
           
protected  void setControlProperty(PropertyKey key, float f)
           
protected  void setControlProperty(PropertyKey key, int i)
           
protected  void setControlProperty(PropertyKey key, long l)
           
protected  void setControlProperty(PropertyKey key, Object o)
          Sets a property on the ControlBean instance.
protected  void setControlProperty(PropertyKey key, short s)
           
protected  void setEventNotifier(Class eventSet, EventNotifier notifier)
          Sets the EventNotifier for this ControlBean
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

IDSeparator

public static final char IDSeparator
See Also:
Constant Field Values

FactorySeparator

public static final char FactorySeparator
See Also:
Constant Field Values
Constructor Detail

ControlBean

protected ControlBean(ControlBeanContext context,
                      String id,
                      PropertyMap initProperties,
                      Class controlClass)
Method Detail

getBeanContextProxy

public final ControlBeanContext getBeanContextProxy()
Return the BeanContextService proxy associated with this bean instance

Specified by:
getBeanContextProxy in interface BeanContextProxy

getBeanContext

public final BeanContext getBeanContext()
Returns the nesting BeanContext for this ControlBean.

Specified by:
getBeanContext in interface ControlBean
Returns:
the containing BeanContext for the Java ControlBean.
See Also:
BeanContext

setBeanContext

public final void setBeanContext(BeanContext bc)
Called by the BeanContextProxy whenever the context associated with this control bean is changed. This is the place to do any initialization (or reinitialization) that is dependent upon attributes of the container for the ControlBean


getControlID

public final String getControlID()
Returns the control ID for this control

Specified by:
getControlID in interface ControlBean
Returns:
the control ID

getControlInterface

public final Class getControlInterface()
Returns the public interface for this control.

Specified by:
getControlInterface in interface ControlBean
Returns:
the control public interface

isSingleThreadedBean

public boolean isSingleThreadedBean()
Returns true if the ControlBean instance is running in an environment that guarantees single-threaded behvior, false otherwise


getImplInitializer

public ImplInitializer getImplInitializer()
Obtains an instance of the appropriate ImplInitializer class


ensureControl

protected Object ensureControl()
Returns the target control instance associated with this ControlBean, performing lazy instantiation and initialization of the instance.


preInvoke

protected void preInvoke(Method m,
                         Object[] args)
The preinvoke method is called before all operations on the control. It is the basic hook for logging, context initialization, resource management, and other common services


postInvoke

protected void postInvoke(Object retval,
                          Throwable t)
The postInvoke method is called after all operations on the control. It is the basic hook for logging, context initialization, resource management, and other common services.


setEventNotifier

protected void setEventNotifier(Class eventSet,
                                EventNotifier notifier)
Sets the EventNotifier for this ControlBean


getEventNotifier

protected EventNotifier getEventNotifier(Class eventSet)
Returns the EventNotifier for this ControlBean


addInvokeListener

public void addInvokeListener(InvokeListener invokeListener)
Registers a new InvokeListener for this ControlBean.


removeInvokeListener

public void removeInvokeListener(InvokeListener invokeListener)
Deregisters an existing InvokeListener for this ControlBean.


getLocalID

protected String getLocalID()
Returns the local (parent-relative) ID for this ControlBean


getControlBeanContext

public ControlBeanContext getControlBeanContext()
Returns the bean context instance associated with the this bean, as opposed to the parent context returned by the public getBeanContext() API.

Specified by:
getControlBeanContext in interface ControlBean

getControlService

protected Object getControlService(Class serviceClass,
                                   Object selector)
                            throws TooManyListenersException
Locates and obtains a context service from the BeanContextServices instance supporting this bean. The base design for the BeanContextServicesSupport is that it will delegate up to peers in a nesting context, so a nested control bean will look 'up' to find a service provider.

Throws:
TooManyListenersException

setControlID

public void setControlID(String id)
Sets the absolute controlID for this ControlBean. This is called from the associated BeanContextChild instance when the bean is associated with a new context.


setControlProperty

protected void setControlProperty(PropertyKey key,
                                  Object o)
Sets a property on the ControlBean instance. All generated property setter methods will delegate down to this method.


setControlProperty

protected void setControlProperty(PropertyKey key,
                                  int i)

setControlProperty

protected void setControlProperty(PropertyKey key,
                                  short s)

setControlProperty

protected void setControlProperty(PropertyKey key,
                                  long l)

setControlProperty

protected void setControlProperty(PropertyKey key,
                                  byte b)

setControlProperty

protected void setControlProperty(PropertyKey key,
                                  char c)

setControlProperty

protected void setControlProperty(PropertyKey key,
                                  float f)

setControlProperty

protected void setControlProperty(PropertyKey key,
                                  double d)

setControlProperty

protected void setControlProperty(PropertyKey key,
                                  boolean b)

getControlProperty

protected Object getControlProperty(PropertyKey key)
Returns a property on the ControlBean instance. All generated property getter methods will delegate down to this method


getPropertyMapCache

protected abstract Map getPropertyMapCache()
Returns the local cache for ControlBean property maps.


getAnnotationMap

protected PropertyMap getAnnotationMap(AnnotatedElement annotElem)
Returns the PropertyMap containing values associated with an AnnotatedElement. Elements that are associated with the bean's Control interface will be locally cached.


getParameterNames

protected String[] getParameterNames(Method m)
Returns the parameter names for a method on the ControlBean. Actual mapping is done by generated subclasses, so if we reach the base ControlBean implementation, then no parameter names are available for the target method.