org.apache.beehive.controls.runtime.bean
Class ControlContainerContext
Object
ControlBeanContext
ControlContainerContext
- All Implemented Interfaces:
- BeanContext, BeanContextChild, BeanContextServiceRevokedListener, BeanContextServices, BeanContextServicesListener, DesignMode, PropertyChangeListener, VetoableChangeListener, Visibility, Serializable, Iterable, Collection, EventListener, ControlBeanContext, ControlContainerContext, EventDispatcher
- Direct Known Subclasses:
- ControlTestContainerContext, ServletBeanContext
public class ControlContainerContext
- extends ControlBeanContext
- implements EventDispatcher, ControlContainerContext
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
Fields inherited from interface BeanContext |
globalHierarchyLock |
Fields inherited from interface DesignMode |
PROPERTYNAME |
Methods inherited from class ControlBeanContext |
add, addAll, addBeanContextMembershipListener, addBeanContextServicesListener, addLifeCycleListener, addPropertyChangeListener, addService, addVetoableChangeListener, avoidingGui, clear, contains, containsAll, dontUseGui, equals, generateUniqueID, getAnnotationMap, getBean, getBeanAnnotationMap, getBeanContext, getBeanContextServicesFactory, getClassLoader, getControlBean, getControlHandle, getControlInterface, getControlPropertyMap, getControlPropertySet, getCurrentServiceClasses, getCurrentServiceSelectors, getDefaultControlBinding, getMethodPropertySet, getParameterNames, getParameterPropertySet, getParameterValue, getResource, getResourceAsStream, getService, getService, hashCode, hasService, hasSingleThreadedParent, initializeControl, instantiateChild, isDesignTime, isEmpty, iterator, needsGui, okToUseGui, prioritizeInterceptors, propertyChange, releaseService, remove, removeAll, removeBeanContextMembershipListener, removeBeanContextServicesListener, removeLifeCycleListener, removePropertyChangeListener, removeVetoableChangeListener, resolveDefaultBinding, retainAll, revokeService, serviceAvailable, serviceRevoked, setBeanContext, setDelegateMap, setDesignTime, size, toArray, toArray, vetoableChange |
Methods inherited from class Object |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface ControlBeanContext |
addLifeCycleListener, getAnnotationMap, getBean, getClassLoader, getControlBean, getControlHandle, getControlInterface, getControlPropertyMap, getControlPropertySet, getMethodPropertySet, getParameterNames, getParameterPropertySet, getParameterValue, getService, removeLifeCycleListener |
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, setBeanContext |
Methods inherited from interface Collection |
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, 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 |
Methods inherited from interface BeanContextServiceRevokedListener |
serviceRevoked |
ControlContainerContext
public ControlContainerContext()
ControlContainerContext
protected ControlContainerContext(ControlBeanContext.BeanContextServicesFactory beanContextServicesFactory)
beginContext
public void beginContext()
- Defines the beginning of a new control container execution context.
- Specified by:
beginContext
in interface ControlContainerContext
endContext
public void endContext()
- Ends the current control container execution context
- Specified by:
endContext
in interface ControlContainerContext
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,
ControlBean bean)
- 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 resourcesbean
- the acquiring ControlBean. Unused by the base implementation, but
available so subclassed containers can have access to the bean.
removeResourceContext
protected void removeResourceContext(ResourceContext resourceContext,
ControlBean bean)
- 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 removedbean
- the acquiring ControlBean. Unused by the base implementation, but
available so subclassed containers can have access to the bean.
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.
dispatchEvent
public Object dispatchEvent(ControlHandle handle,
EventRef event,
Object[] args)
throws IllegalArgumentException,
IllegalAccessException,
InvocationTargetException
- Dispatch an operation or an event to a bean within this container bean context.
- Specified by:
dispatchEvent
in interface EventDispatcher
- Parameters:
handle
- the control handle identifying the target beanevent
- the event to be invoked on the target beanargs
- the arguments to be passed to the target method invocation
- Throws:
IllegalArgumentException
- the target is not valid, the event is not a valid event
type for the requested target, or the argument types do not match the event
signature.
IllegalAccessException
- the underlying event method is not accessible due to
access control.
InvocationTargetException
- wraps any exception thrown by the underlying event
handler.
getControlHandle
public 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.
- Specified by:
getControlHandle
in interface ControlContainerContext
- Parameters:
bean
- the target control bean
isSingleThreadedContainer
public boolean isSingleThreadedContainer()
- Returns true if this container guarantees single-threaded behaviour. By default, top-level
containers are assumed to NOT guarantee this; specific container implementations (for example,
for EJB containers) should override this appropriately.
- Specified by:
isSingleThreadedContainer
in interface ControlBeanContext
- Overrides:
isSingleThreadedContainer
in class ControlBeanContext