OpenCOM
Class CFInterceptors

java.lang.Object
  extended by OpenCOM.CFInterceptors

public class CFInterceptors
extends java.lang.Object

This class holds generic interceptors for the component framework model. Each CF will create an instance of this object; this is because the interceptors directly access individual locks of the component framework. The interceptors are used to create a readers-writers solution for framework access, with priority given to readers.


Constructor Summary
CFInterceptors(ICFMetaInterface ThisComponentFramework)
          Creates a new instance of CFInterceptors and sets the reference to the CF's API.
 
Method Summary
 java.lang.Object Post0(java.lang.String method, java.lang.Object[] args)
          Post0 is inserted onto every exposed interface of the component framework automatically.
 int Pre0(java.lang.String method, java.lang.Object[] args)
          Pre0 is inserted onto every exposed interface of the component framework automatically.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CFInterceptors

public CFInterceptors(ICFMetaInterface ThisComponentFramework)
Creates a new instance of CFInterceptors and sets the reference to the CF's API.

Method Detail

Pre0

public int Pre0(java.lang.String method,
                java.lang.Object[] args)
Pre0 is inserted onto every exposed interface of the component framework automatically. If you are using fixed functional interfaces from your framework then you may wish to add these interceptors yourself. Every operation invoked on the interface forces the readers count to be incremented. If we are the first reader we also get the write lock to prevent write access while there are readers.

Parameters:
method - The method intercepted - we don't utilise.
args - The list of paramaters of the invocation - not utilised.
Returns:
An integer telling the runtime how to proceed. 0 tells the run-time we can continue with calling the actual operation.

Post0

public java.lang.Object Post0(java.lang.String method,
                              java.lang.Object[] args)
Post0 is inserted onto every exposed interface of the component framework automatically. It is executed after every operation of the intercepted interface. It first decrements the readers count as we've finished read access. The write lock is released if we are the last reader.

Parameters:
method - The method intercepted - we don't utilise.
args - The list of paramaters of the invocation - not utilised.
Returns:
An Object holding the result of the intercepted operation.