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

Object
  extended by ResourceContextImpl
All Implemented Interfaces:
EventListener, ResourceContext, InvokeListener

public class ResourceContextImpl
extends Object
implements ResourceContext, InvokeListener

The ResourceContextImpl class provides an implementation of the ResourceContext service, as well as a simple singleton provider that can be used to obtain new instances.


Nested Class Summary
 
Nested classes/interfaces inherited from interface ResourceContext
ResourceContext.ResourceEvents
 
Constructor Summary
ResourceContextImpl(ControlContainerContext containerContext, ControlBean bean)
          Constructs a new ResourceContext service implementation to manage resources for a target ControlBean within a specific ControlContainerContext
 
Method Summary
 void acquire()
          The acquire method allows a Control implementation to manually request acquisition.
 void addResourceEventsListener(ResourceContext.ResourceEvents resourceListener)
          Registers a listener that implements the ResourceEvents interface for the ResourceContext.
 boolean hasResources()
          The hasResources method returns true if the control has currently acquired resources, false otherwise.
 void postInvoke(Object retval, Throwable t)
          Implements the InvokeListener.postInvoke method.
 void preInvoke(Method m, Object[] args)
          Implements the InvokeListener.preInvoke method.
 void release()
          The release method allows a Control implement to manually release resources immediately, instead of waiting until the end of the current resource scope.
 void removeResourceEventsListener(ResourceContext.ResourceEvents resourceListener)
          Unregisters a listener that implements the ResourceEvents interface for the ResourceContext.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResourceContextImpl

public ResourceContextImpl(ControlContainerContext containerContext,
                           ControlBean bean)
Constructs a new ResourceContext service implementation to manage resources for a target ControlBean within a specific ControlContainerContext

Method Detail

preInvoke

public void preInvoke(Method m,
                      Object[] args)
Implements the InvokeListener.preInvoke method. This hook will be called before the managed beans' operations are invoked

Specified by:
preInvoke in interface InvokeListener

postInvoke

public void postInvoke(Object retval,
                       Throwable t)
Implements the InvokeListener.postInvoke method.

Specified by:
postInvoke in interface InvokeListener

acquire

public void acquire()
Description copied from interface: ResourceContext
The acquire method allows a Control implementation to manually request acquisition. This is useful in contexts where the control needs access to associated resources from outside the scope of an operation. If invoked when the control has not currently acquired resources, the onAcquire event will be delivered to the control and it will be registered in the current resource scope as holding resources. If the control has previously acquired resources in the current resource scope, then calling acquire() will have no effect.

Specified by:
acquire in interface ResourceContext

release

public void release()
Description copied from interface: ResourceContext
The release method allows a Control implement to manually release resources immediately, instead of waiting until the end of the current resource scope. If invoked when the control has currently acquired resources, the onRelease event will be delivered immediately and the control will no longer be in the list of controls holding resources in the current resource scope. If the control has not previously acquired resources, then calling release() will have no effect.

Specified by:
release in interface ResourceContext

hasResources

public boolean hasResources()
Description copied from interface: ResourceContext
The hasResources method returns true if the control has currently acquired resources, false otherwise.

Specified by:
hasResources in interface ResourceContext

addResourceEventsListener

public void addResourceEventsListener(ResourceContext.ResourceEvents resourceListener)
Description copied from interface: ResourceContext
Registers a listener that implements the ResourceEvents interface for the ResourceContext.

Specified by:
addResourceEventsListener in interface ResourceContext

removeResourceEventsListener

public void removeResourceEventsListener(ResourceContext.ResourceEvents resourceListener)
Description copied from interface: ResourceContext
Unregisters a listener that implements the ResourceEvents interface for the ResourceContext.

Specified by:
removeResourceEventsListener in interface ResourceContext