org.objectweb.speedo.pm.lib
Class POManagerSwitchImpl

java.lang.Object
  extended by org.objectweb.speedo.pm.lib.POManagerSwitchImpl
All Implemented Interfaces:
POManagerSwitchItf

public class POManagerSwitchImpl
extends java.lang.Object
implements POManagerSwitchItf

This class is an implementation of the POManagerSwitchItf based on the use of a ThreadLocal field. This field contains an instance of POManagerItf of an ArrayList of POManagerItf. A POManagerSwitch is a fractal component without bindings.

Author:
S.Chassande-Barrioz

Field Summary
static java.lang.String BIND_ERROR_MSG
           
protected  java.lang.ThreadLocal pms
           
 
Constructor Summary
POManagerSwitchImpl()
           
 
Method Summary
 void bind(POManagerItf pm)
          It assignes a POManagerItf to the current context.
 void clear()
          It clears the list of POManagerItf for the current context.
 java.util.Collection entries()
           
 POManagerItf lookup(POManagerFactoryItf pmf)
           
 boolean unbind(POManagerFactoryItf pmf)
          It clears the POManagerItf associated to a POManagerFactoryItf for the current context
 boolean unbind(POManagerItf pm)
          It clears a POManagerItf for the current context.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

pms

protected java.lang.ThreadLocal pms

BIND_ERROR_MSG

public static final java.lang.String BIND_ERROR_MSG
See Also:
Constant Field Values
Constructor Detail

POManagerSwitchImpl

public POManagerSwitchImpl()
Method Detail

lookup

public POManagerItf lookup(POManagerFactoryItf pmf)
Specified by:
lookup in interface POManagerSwitchItf
Parameters:
pmf - is persistent manager factory which manages the returned po manager.
Returns:
the POManagerItf managed by the given persistence manager factory and bound to current the context, or the null value if there is no POManagerItf.

bind

public void bind(POManagerItf pm)
It assignes a POManagerItf to the current context.

Specified by:
bind in interface POManagerSwitchItf
Parameters:
pm - is the POManagerItf

clear

public void clear()
It clears the list of POManagerItf for the current context.

Specified by:
clear in interface POManagerSwitchItf

unbind

public boolean unbind(POManagerItf pm)
It clears a POManagerItf for the current context.

Specified by:
unbind in interface POManagerSwitchItf
Returns:
true if the specified pm has been unbound from the context/thread

unbind

public boolean unbind(POManagerFactoryItf pmf)
Description copied from interface: POManagerSwitchItf
It clears the POManagerItf associated to a POManagerFactoryItf for the current context

Specified by:
unbind in interface POManagerSwitchItf
Returns:
true if a pm associated to the specified PMF, has been unbound from the context/thread

entries

public java.util.Collection entries()
Specified by:
entries in interface POManagerSwitchItf
Returns:
all POManagerItf instances bound with the current context