org.objectweb.jac.aspects.session
Class PerSessionObjectWrapper

java.lang.Object
  extended byorg.objectweb.jac.core.Wrapper
      extended byorg.objectweb.jac.aspects.session.PerSessionObjectWrapper
All Implemented Interfaces:
Advice, ConstructorInterceptor, Interceptor, MethodInterceptor, Serializable

public class PerSessionObjectWrapper
extends Wrapper

This wrapper handles per-session objects within the JAC system.

For each session, it uses a different copy of the original object so that each client see a different state.

Author:
Renaud Pawlak
See Also:
handlePerSessionObject(Interaction), Serialized Form

Field Summary
 
Fields inherited from class org.objectweb.jac.core.Wrapper
ac, cr
 
Constructor Summary
PerSessionObjectWrapper(AspectComponent ac)
           
 
Method Summary
 Object construct(ConstructorInvocation invocation)
           
 Object handlePerSessionObject(Interaction interaction)
          This wrapping method handles an hashtable of copied objects.
 Object invoke(MethodInvocation invocation)
           
 
Methods inherited from class org.objectweb.jac.core.Wrapper
attr, attrdef, defines, getAspectComponent, getAspectComponentName, getExceptionHandlers, proceed, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PerSessionObjectWrapper

public PerSessionObjectWrapper(AspectComponent ac)
Method Detail

handlePerSessionObject

public Object handlePerSessionObject(Interaction interaction)
This wrapping method handles an hashtable of copied objects.

There is one copied object per session with possibly a different state from the original. The call is thus forwarded to the copy that corresponds to the session.

The first time, the original object is cloned so that its state is that same as the original.

Returns:
the result given by the per-session copy

invoke

public Object invoke(MethodInvocation invocation)
              throws Throwable
Specified by:
invoke in interface MethodInterceptor
Overrides:
invoke in class Wrapper
Throws:
Throwable

construct

public Object construct(ConstructorInvocation invocation)
                 throws Throwable
Specified by:
construct in interface ConstructorInterceptor
Overrides:
construct in class Wrapper
Throws:
Throwable