Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

alma::acs::container::ContainerSealant Class Reference

List of all members.

Public Member Functions

Object invoke (Object proxy, Method method, Object[] args) throws Throwable

Package Functions

void setMethodsExcludedFromInvocationLogging (String[] excludedMethods)

Static Package Functions

Object createContainerSealant (Class corbaInterface, Object component, String name, boolean isOffShoot, Logger logger, ClassLoader componentContextCL, String[] methodNamesExcludedFromInvocationLogging) throws AcsJContainerEx

Private Member Functions

 ContainerSealant (Object componentImpl, String name, Logger logger, ClassLoader componentContextCL, boolean isOffShoot)
boolean isExcludedFromInvocationLogging (String methodName)
Throwable unwindThrowableHierarchy (Throwable thr)

Private Attributes

final String m_name
final Object m_component
final Logger m_logger
final ClassLoader componentContextCL
final boolean isOffShoot
final Set< String > methodNamesExcludedFromInvocationLogging

Detailed Description

Seals the container to make it a "tight container", as opposed to an "open container". There's one sealant instance per component instance. The sealant is placed between the CORBA POATie on the one side, and the component implementation class or the component interface translator (if present) on the other side. The sealant therefore intercepts all functional calls made to the component.

This sealant class is not only used for components, but also for offshoots from that component, if they follow the tie-approach.

Todo: let listeners register, and notify them of any intercepted call; they may either veto down the invocation, or simply trace the call. Any logging, security checks etc. should be done by such listeners in the future.

Author:
hsommer


Constructor & Destructor Documentation

alma::acs::container::ContainerSealant::ContainerSealant Object  componentImpl,
String  name,
Logger  logger,
ClassLoader  componentContextCL,
boolean  isOffShoot
[inline, private]
 


Member Function Documentation

Object alma::acs::container::ContainerSealant::createContainerSealant Class  corbaInterface,
Object  component,
String  name,
boolean  isOffShoot,
Logger  logger,
ClassLoader  componentContextCL,
String[]  methodNamesExcludedFromInvocationLogging
throws AcsJContainerEx [inline, static, package]
 

Creates a ContainerSealant and uses it as the invocation handler for the returned dynamic proxy which implements corbaInterface.

Parameters:
corbaInterface the interface that the created sealant will implement; this should be the component's xxxOperations interface.
component the component implementation class, or any translator class in front of the component implementation. componentImpl must implement corbaInterface so that the sealant can forward calls to the component.
name the component instance name (used for logging)
isOffShoot true if the component object is actually an offshoot of a component
logger logger to be used by this class
componentContextCL classloader used for Thread#setContextClassLoader(java.lang.ClassLoader setContextClassLoader) before component method gets invoked. (after the call, the old context CL will be restored.)
methodNamesExcludedFromInvocationLogging 
Returns:
an instance of corbaInterface that intercepts calls to componentImpl and forwards them if restrictions allow this.
Exceptions:
ContainerException if the given component Object does not implement the given corbaInterface.

Object alma::acs::container::ContainerSealant::invoke Object  proxy,
Method  method,
Object[]  args
throws Throwable [inline]
 

Receives functional calls to the component.

  1. Intercepts them to produce logs before and after the call.
  2. Sets the component classloader as the current thread's context classloader so that components can use Thread.currentThread().getContextClassLoader().
todo: add security and other container features here, especially check the component state!!!

See also:
java.lang.reflect.InvocationHandler#invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[])

boolean alma::acs::container::ContainerSealant::isExcludedFromInvocationLogging String  methodName  )  [inline, private]
 

Checks if an invoked method is known to be excluded from logging. This is always true for componentState, and for all methods that are set for no-logging.

void alma::acs::container::ContainerSealant::setMethodsExcludedFromInvocationLogging String[]  excludedMethods  )  [inline, package]
 

Disables automatic invocation logging for certain component or offshoot methods.

The method componentState gets always excluded, independently of excludedMethods. It is a hard-coded special case.

For components, the method name must be given directly. For offshoots, method names must be qualified, see comment for ComponentHelper where component developers can specify these strings.

TODO: check if calls to JBaci properties should be also excluded hard-coded. At the moment the component helper class must specify them explicitly, e.g. "OFFSHOOT::alma.ACS.ROstringSeq#get_sync". This is not intuitive because JBaci properties are not visibly offshoots for the user, this is only an ACS implementation choice.

Parameters:
excludedMethods the names of methods to exclude from automatic logging.
See also:
ComponentHelper::getComponentMethodsExcludedFromInvocationLogging()

Throwable alma::acs::container::ContainerSealant::unwindThrowableHierarchy Throwable  thr  )  [inline, private]
 

Pops InvocationTargetExceptions and UndeclaredThrowableExceptions off the exception cause stack, until a "real" exception is found.

Parameters:
thr 
Returns:


Member Data Documentation

final ClassLoader alma::acs::container::ContainerSealant::componentContextCL [private]
 

final boolean alma::acs::container::ContainerSealant::isOffShoot [private]
 

final Object alma::acs::container::ContainerSealant::m_component [private]
 

final Logger alma::acs::container::ContainerSealant::m_logger [private]
 

final String alma::acs::container::ContainerSealant::m_name [private]
 

final Set<String> alma::acs::container::ContainerSealant::methodNamesExcludedFromInvocationLogging [private]
 


The documentation for this class was generated from the following file:
Generated on Thu Apr 30 02:52:28 2009 for ACS Java API by doxygen 1.3.8