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

Object
  extended by BeanContextChildSupport
      extended by BeanContextSupport
          extended by BeanContextServicesSupport
              extended by ControlBeanContext
                  extended by ControlContainerContext
All Implemented Interfaces:
BeanContext, BeanContextChild, BeanContextServiceRevokedListener, BeanContextServices, BeanContextServicesListener, DesignMode, PropertyChangeListener, VetoableChangeListener, Visibility, Serializable, Iterable, Collection, EventListener, ControlBeanContext
Direct Known Subclasses:
ServletBeanContext

public class ControlContainerContext
extends ControlBeanContext

The ControlContainerContext class provides a base class implementation for external containers of ControlBeans. It provides additional services, such as: - defines a contextual service provider for the ResourceManager interface - defines a simplified contract for the external container to interact with resource management (beginContext/endContext)

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class BeanContextServicesSupport
BeanContextServicesSupport.BCSSChild, BeanContextServicesSupport.BCSSProxyServiceProvider, BeanContextServicesSupport.BCSSServiceProvider
 
Nested classes/interfaces inherited from class BeanContextSupport
BeanContextSupport.BCSChild, BeanContextSupport.BCSIterator
 
Nested classes/interfaces inherited from interface ControlBeanContext
ControlBeanContext.LifeCycle
 
Field Summary
 
Fields inherited from class BeanContextServicesSupport
bcsListeners, proxy, serializable, services
 
Fields inherited from class BeanContextSupport
bcmListeners, children, designTime, locale, okToUseGui
 
Fields inherited from class BeanContextChildSupport
beanContext, beanContextChildPeer, pcSupport, rejectedSetBCOnce, vcSupport
 
Fields inherited from interface BeanContext
globalHierarchyLock
 
Fields inherited from interface DesignMode
PROPERTYNAME
 
Constructor Summary
ControlContainerContext()
           
 
Method Summary
protected  void addResourceContext(ResourceContext resourceContext)
          Adds a new managed ResourceContext to the ControlContainerContext.
 void beginContext()
          Defines the beginning of a new control container execution context.
 Object dispatch(String targetID, Method method, Object[] args)
          Dispatch an operation or an event to a bean within this container bean context.
 void endContext()
          Ends the current control container execution context
static ControlContainerContext getContext()
          Returns the active ControlContainerContext for the current thread, or null if no context is currently active.
protected  Class getControlBinding(Class controlClass)
          Returns the binding from a control interface to a control implementation for the current container context.
protected  ControlHandle getControlHandle(ControlBean bean)
          Returns a ControlHandle to the component containing the control.
 void initialize()
          Called by BeanContextSupport superclass during construction and deserialization to initialize subclass transient state
protected  void releaseResources()
          Releases all ResourceContexts associated with the current ControlContainerContext.
protected  void removeResourceContext(ResourceContext resourceContext)
          Removes a managed ResourceContext from the ControlContainerContext.
 
Methods inherited from class ControlBeanContext
add, addLifeCycleListener, generateUniqueID, getAnnotationMap, getBean, getBeanAnnotationMap, getClassLoader, getControlHandle, getControlInterface, getControlPropertyMap, getControlPropertySet, getDefaultControlBinding, getMethodPropertySet, getParameterNames, getParameterPropertySet, getParameterValue, getService, initializeControl, isSingleThreadedContainer, remove, removeLifeCycleListener, resolveDefaultBinding, serviceRevoked, setBeanContext, setDelegateMap
 
Methods inherited from class BeanContextServicesSupport
addBeanContextServicesListener, addService, addService, bcsPreDeserializationHook, bcsPreSerializationHook, childJustRemovedHook, createBCSChild, createBCSSServiceProvider, fireServiceAdded, fireServiceAdded, fireServiceRevoked, fireServiceRevoked, getBeanContextServicesPeer, getChildBeanContextServicesListener, getCurrentServiceClasses, getCurrentServiceSelectors, getService, hasService, initializeBeanContextResources, releaseBeanContextResources, releaseService, removeBeanContextServicesListener, revokeService, serviceAvailable
 
Methods inherited from class BeanContextSupport
addAll, addBeanContextMembershipListener, avoidingGui, bcsChildren, childDeserializedHook, childJustAddedHook, classEquals, clear, contains, containsAll, containsKey, copyChildren, deserialize, dontUseGui, fireChildrenAdded, fireChildrenRemoved, getBeanContextPeer, getChildBeanContextChild, getChildBeanContextMembershipListener, getChildPropertyChangeListener, getChildSerializable, getChildVetoableChangeListener, getChildVisibility, getLocale, getResource, getResourceAsStream, instantiateChild, isDesignTime, isEmpty, isSerializing, iterator, needsGui, okToUseGui, propertyChange, readChildren, remove, removeAll, removeBeanContextMembershipListener, retainAll, serialize, setDesignTime, setLocale, size, toArray, toArray, validatePendingAdd, validatePendingRemove, vetoableChange, writeChildren
 
Methods inherited from class BeanContextChildSupport
addPropertyChangeListener, addVetoableChangeListener, firePropertyChange, fireVetoableChange, getBeanContext, getBeanContextChildPeer, isDelegated, removePropertyChangeListener, removeVetoableChangeListener, validatePendingSetBeanContext
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface BeanContextServices
addBeanContextServicesListener, addService, getCurrentServiceClasses, getCurrentServiceSelectors, getService, hasService, releaseService, removeBeanContextServicesListener, revokeService
 
Methods inherited from interface BeanContext
addBeanContextMembershipListener, getResource, getResourceAsStream, instantiateChild, removeBeanContextMembershipListener
 
Methods inherited from interface BeanContextChild
addPropertyChangeListener, addVetoableChangeListener, getBeanContext, removePropertyChangeListener, removeVetoableChangeListener
 
Methods inherited from interface Collection
addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, removeAll, retainAll, size, toArray, toArray
 
Methods inherited from interface DesignMode
isDesignTime, setDesignTime
 
Methods inherited from interface Visibility
avoidingGui, dontUseGui, needsGui, okToUseGui
 
Methods inherited from interface BeanContextServicesListener
serviceAvailable
 

Constructor Detail

ControlContainerContext

public ControlContainerContext()
Method Detail

getContext

public static ControlContainerContext getContext()
Returns the active ControlContainerContext for the current thread, or null if no context is currently active.


beginContext

public void beginContext()
Defines the beginning of a new control container execution context.


endContext

public void endContext()
Ends the current control container execution context


initialize

public void initialize()
Called by BeanContextSupport superclass during construction and deserialization to initialize subclass transient state

Overrides:
initialize in class ControlBeanContext

addResourceContext

protected void addResourceContext(ResourceContext resourceContext)
Adds a new managed ResourceContext to the ControlContainerContext. This method is used to register a resource context that has just acquired resources

Parameters:
resourceContext - the ResourceContext service that has acquired resources

removeResourceContext

protected void removeResourceContext(ResourceContext resourceContext)
Removes a managed ResourceContext from the ControlContainerContext. This method is used to unregister a resource context that has already acquired resources

Parameters:
resourceContext - the ResourceContext service to be removed

releaseResources

protected void releaseResources()
Releases all ResourceContexts associated with the current ControlContainerContext. This method is called by the associated container whenever all managed ResourceContexts that have acquired resources should release them.


dispatch

public Object dispatch(String targetID,
                       Method method,
                       Object[] args)
                throws IllegalArgumentException,
                       IllegalAccessException,
                       InvocationTargetException
Dispatch an operation or an event to a bean within this container bean context.

Parameters:
targetID - the composite ID of the target control bean
method - the method to be invoked on the target bean
args - the arguments to be passed to the target method invocation
Throws:
IllegalArgumentException
IllegalAccessException
InvocationTargetException

getControlHandle

protected ControlHandle getControlHandle(ControlBean bean)
Returns a ControlHandle to the component containing the control. This handle can be used to dispatch events and operations to a control instance. This method will return null if the containing component does not support direct dispatch.

Parameters:
targetID - the composite ID of the target control bean

getControlBinding

protected Class getControlBinding(Class controlClass)
Returns the binding from a control interface to a control implementation for the current container context.

Overrides:
getControlBinding in class ControlBeanContext