net.sourceforge.jabm.spring
Class SimulationScope

java.lang.Object
  extended by net.sourceforge.jabm.spring.SimulationScope
All Implemented Interfaces:
org.springframework.beans.factory.config.Scope

public class SimulationScope
extends java.lang.Object
implements org.springframework.beans.factory.config.Scope

A custom Spring bean scope used to manage objects which persist throughout a single simulation, but are re-instantiated on each new independent simulation run.

 

Field Summary
static java.lang.String ATTRIBUTE_VALUE
          The string that appears in the scope attribute of a bean definition.
protected  java.util.HashMap<java.lang.String,java.lang.Object> boundObjects
          A mapping from bean names to objects that are bound in this scope.
protected  int simulationId
           
protected static SimulationScope singletonInstance
           
 
Constructor Summary
SimulationScope()
           
 
Method Summary
 java.lang.Object get(java.lang.String name, org.springframework.beans.factory.ObjectFactory<?> objectFactory)
           
 java.lang.String getConversationId()
           
static SimulationScope getSingletonInstance()
           
 void registerDestructionCallback(java.lang.String name, java.lang.Runnable callback)
           
 java.lang.Object remove(java.lang.String name)
           
 java.lang.Object resolveContextualObject(java.lang.String key)
           
 void startNewSimulation()
          Invoked to indicate that a new simulation has begun and that a fresh scope is required.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

boundObjects

protected java.util.HashMap<java.lang.String,java.lang.Object> boundObjects
A mapping from bean names to objects that are bound in this scope.


simulationId

protected int simulationId

singletonInstance

protected static SimulationScope singletonInstance

ATTRIBUTE_VALUE

public static final java.lang.String ATTRIBUTE_VALUE
The string that appears in the scope attribute of a bean definition.

See Also:
Constant Field Values
Constructor Detail

SimulationScope

public SimulationScope()
Method Detail

get

public java.lang.Object get(java.lang.String name,
                            org.springframework.beans.factory.ObjectFactory<?> objectFactory)
Specified by:
get in interface org.springframework.beans.factory.config.Scope

remove

public java.lang.Object remove(java.lang.String name)
Specified by:
remove in interface org.springframework.beans.factory.config.Scope

registerDestructionCallback

public void registerDestructionCallback(java.lang.String name,
                                        java.lang.Runnable callback)
Specified by:
registerDestructionCallback in interface org.springframework.beans.factory.config.Scope

resolveContextualObject

public java.lang.Object resolveContextualObject(java.lang.String key)
Specified by:
resolveContextualObject in interface org.springframework.beans.factory.config.Scope

getConversationId

public java.lang.String getConversationId()
Specified by:
getConversationId in interface org.springframework.beans.factory.config.Scope

startNewSimulation

public void startNewSimulation()
Invoked to indicate that a new simulation has begun and that a fresh scope is required.


getSingletonInstance

public static SimulationScope getSingletonInstance()