org.deduced.controller.implementation
Class CachedFlyWheelControllerProvider

java.lang.Object
  extended by org.deduced.controller.implementation.FlyWheelControllerProvider
      extended by org.deduced.controller.implementation.CachedFlyWheelControllerProvider
All Implemented Interfaces:
ControllerProvider

public class CachedFlyWheelControllerProvider
extends FlyWheelControllerProvider

CachedFlyWheelControllerProvider will attempt to provide controllers based on a cache that it holds generated by past requests. If the cache doesn't contain the required controller, then a new controller will be created an put in cache. The cache uses weak pointers to both the model and the controller so they may be reclaimed by the garbage collector if nobody else is using them.

Author:
Steve McDuff

Nested Class Summary
static class CachedFlyWheelControllerProvider.PropertyControllerKey
          PropertyControllerKey is used to create a unique key that references a model and a property key.
 
Field Summary
private  java.util.Map<PropertyCollection<?,?>,PropertyList<PropertyCollectionController>> childCollectionControllerMapMap
          map between the model and the map of child property collection controller
private  java.util.Map<PropertyCollection<?,?>,PropertyList<PropertyController>> childPropertyControllerMapMap
          map between the model and the map of child property controller
private  java.util.Map<PropertyCollection<?,?>,PropertyCollectionController> propertyCollectionControllerMap
          map between the model and the property collection controller
private  java.util.Map<CachedFlyWheelControllerProvider.PropertyControllerKey,PropertyController> propertyControllerMap
          map between the model+propertyKey and the property controller
 
Constructor Summary
CachedFlyWheelControllerProvider()
           
 
Method Summary
 PropertyList<PropertyCollectionController> getPropertyCollectionChildPropertyCollectionControllerList(PropertyCollection<?,?> model)
          (non-Javadoc)
 PropertyCollectionController getPropertyCollectionController(PropertyCollection<?,?> model)
          (non-Javadoc)
 PropertyList<PropertyController> getPropertyCollectionPropertyControllerList(PropertyCollection<?,?> model)
          (non-Javadoc)
 PropertyController getPropertyController(PropertyCollection<?,?> model, java.lang.Object propertyKey)
          (non-Javadoc)
 
Methods inherited from class org.deduced.controller.implementation.FlyWheelControllerProvider
createPropertyCollectionChildPropertyCollectionControllerList, createPropertyCollectionController, createPropertyCollectionPropertyControllerList, createPropertyController, getControllerFactory, setControllerFactory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

childCollectionControllerMapMap

private java.util.Map<PropertyCollection<?,?>,PropertyList<PropertyCollectionController>> childCollectionControllerMapMap
map between the model and the map of child property collection controller


childPropertyControllerMapMap

private java.util.Map<PropertyCollection<?,?>,PropertyList<PropertyController>> childPropertyControllerMapMap
map between the model and the map of child property controller


propertyCollectionControllerMap

private java.util.Map<PropertyCollection<?,?>,PropertyCollectionController> propertyCollectionControllerMap
map between the model and the property collection controller


propertyControllerMap

private java.util.Map<CachedFlyWheelControllerProvider.PropertyControllerKey,PropertyController> propertyControllerMap
map between the model+propertyKey and the property controller

Constructor Detail

CachedFlyWheelControllerProvider

public CachedFlyWheelControllerProvider()
Method Detail

getPropertyCollectionChildPropertyCollectionControllerList

public PropertyList<PropertyCollectionController> getPropertyCollectionChildPropertyCollectionControllerList(PropertyCollection<?,?> model)
(non-Javadoc)

Specified by:
getPropertyCollectionChildPropertyCollectionControllerList in interface ControllerProvider
Overrides:
getPropertyCollectionChildPropertyCollectionControllerList in class FlyWheelControllerProvider
Parameters:
model - the controlled model
Returns:
the Property Collection Child Property Collection Controller List
See Also:
FlyWheelControllerProvider.getPropertyCollectionChildPropertyCollectionControllerList(org.deduced.PropertyCollection)

getPropertyCollectionController

public PropertyCollectionController getPropertyCollectionController(PropertyCollection<?,?> model)
(non-Javadoc)

Specified by:
getPropertyCollectionController in interface ControllerProvider
Overrides:
getPropertyCollectionController in class FlyWheelControllerProvider
Parameters:
model - the model from which to fetch the controller
Returns:
the associated controller
See Also:
FlyWheelControllerProvider.getPropertyCollectionController(org.deduced.PropertyCollection)

getPropertyCollectionPropertyControllerList

public PropertyList<PropertyController> getPropertyCollectionPropertyControllerList(PropertyCollection<?,?> model)
(non-Javadoc)

Specified by:
getPropertyCollectionPropertyControllerList in interface ControllerProvider
Overrides:
getPropertyCollectionPropertyControllerList in class FlyWheelControllerProvider
Parameters:
model - the controlled model
Returns:
the Property Collection Property Controller List
See Also:
FlyWheelControllerProvider.getPropertyCollectionPropertyControllerList(org.deduced.PropertyCollection)

getPropertyController

public PropertyController getPropertyController(PropertyCollection<?,?> model,
                                                java.lang.Object propertyKey)
(non-Javadoc)

Specified by:
getPropertyController in interface ControllerProvider
Overrides:
getPropertyController in class FlyWheelControllerProvider
Parameters:
model - the controlled model
propertyKey - the key of the controlled property
Returns:
the property controller
See Also:
FlyWheelControllerProvider.getPropertyController(org.deduced.PropertyCollection, java.lang.Object)