|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.memphis.ccrg.lida.framework.initialization.AgentXmlFactory
public class AgentXmlFactory
Creates and returns a Agent
Object based on an XML file.
Each module that is created is instantiated using Class.forName(String)
.
Next its Initializable.init()
method is run. After all modules have been
created in this way, all associated modules are added for each module FullyInitializable.setAssociatedModule(FrameworkModule, String)
Finally each module's initializer is run if it has one. Thus associated modules should not be used by the init method of modules,
only constants and other variables should be set.
Nested Class Summary | |
---|---|
(package private) static class |
AgentXmlFactory.TaskData
Nested class for representing FrameworkTask definition |
Constructor Summary | |
---|---|
AgentXmlFactory()
|
Method Summary | |
---|---|
(package private) static void |
associateModules(java.util.List<java.lang.Object[]> toAssoc,
FrameworkModule topModule)
Iterates through the module/associated-module pairs and associates them |
Agent |
getAgent(java.util.Properties properties)
Creates and returns a Agent from specified Properties |
(package private) static void |
getAssociatedModules(org.w3c.dom.Element ele,
Initializable ini,
java.util.List<java.lang.Object[]> toAssoc)
Gets associated modules of the specified Initializable |
(package private) static java.util.Map<java.lang.String,java.lang.Object> |
getGlobalParameters(org.w3c.dom.Element element)
|
(package private) static void |
getListener(org.w3c.dom.Element moduleElement,
FrameworkModule topModule)
Reads and creates a listener specified in element. |
(package private) static void |
getListeners(org.w3c.dom.Element element,
FrameworkModule topModule)
Reads and creates all listeners specified in element. |
(package private) FrameworkModule |
getModule(org.w3c.dom.Element moduleElement,
java.util.List<java.lang.Object[]> toAssoc,
java.util.List<java.lang.Object[]> toInit,
java.util.Map<java.lang.String,TaskSpawner> spawners,
java.util.List<AgentXmlFactory.TaskData> toRun)
Reads and creates a FrameworkModule in specified moduleElement |
(package private) java.util.List<FrameworkModule> |
getModules(org.w3c.dom.Element element,
java.util.List<java.lang.Object[]> toAssoc,
java.util.List<java.lang.Object[]> toInit,
java.util.Map<java.lang.String,TaskSpawner> spawners,
java.util.List<AgentXmlFactory.TaskData> toRun)
Reads and creates all FrameworkModule s in specified element |
(package private) static AgentXmlFactory.TaskData |
getTask(org.w3c.dom.Element moduleElement,
java.lang.Integer defaultTicks)
Reads and creates FrameworkTask specified in element |
(package private) static TaskManager |
getTaskManager(org.w3c.dom.Element element)
|
(package private) static java.util.List<AgentXmlFactory.TaskData> |
getTasks(org.w3c.dom.Element element,
TaskSpawner ts)
Reads and creates FrameworkTask s specified in element |
(package private) static int |
getTasksDefaultTicksPerRun(org.w3c.dom.Element element)
Reads the default ticks per run for initial Tasks |
(package private) static void |
getTaskSpawner(org.w3c.dom.Element element,
TaskManager tm,
java.util.Map<java.lang.String,TaskSpawner> spawners)
Creates a TaskSpawner from specified Element and TaskManager |
(package private) static java.util.Map<java.lang.String,TaskSpawner> |
getTaskSpawners(org.w3c.dom.Element element,
TaskManager tm)
Reads in and creates all TaskSpawner s specified in Element |
(package private) static void |
initializeModules(Agent topModule,
java.util.List<java.lang.Object[]> toInit)
For all modules with an initializer, run the initializer passing in the specific module. |
(package private) static void |
initializeTasks(java.util.Map<ModuleName,FrameworkModule> moduleMap,
java.util.List<AgentXmlFactory.TaskData> toRun)
Creates the tasks specified and adds them to their associated TaskSpawner |
(package private) Agent |
parseDocument(org.w3c.dom.Document dom)
Parses the xml document creating the TaskManager, TaskSpawners, Modules, submodules. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AgentXmlFactory()
Method Detail |
---|
public Agent getAgent(java.util.Properties properties)
AgentFactory
Agent
from specified Properties
getAgent
in interface AgentFactory
properties
- Agent properties
Agent
objectAgent parseDocument(org.w3c.dom.Document dom)
Agent
.
dom
- the xml dom Document
static java.util.Map<java.lang.String,java.lang.Object> getGlobalParameters(org.w3c.dom.Element element)
element
- Element containing the global parameters
static TaskManager getTaskManager(org.w3c.dom.Element element)
element
- Element containing the task manager
TaskManager
static java.util.Map<java.lang.String,TaskSpawner> getTaskSpawners(org.w3c.dom.Element element, TaskManager tm)
TaskSpawner
s specified in Element
element
- Dom elementtm
- the TaskManager
TaskSpawner
indexed by namestatic void getTaskSpawner(org.w3c.dom.Element element, TaskManager tm, java.util.Map<java.lang.String,TaskSpawner> spawners)
TaskSpawner
from specified Element
and TaskManager
element
- Dom elementtm
- the TaskManager
spawners
- The msp of TaskSpawner
s where the new TaskSpawner
is includedjava.util.List<FrameworkModule> getModules(org.w3c.dom.Element element, java.util.List<java.lang.Object[]> toAssoc, java.util.List<java.lang.Object[]> toInit, java.util.Map<java.lang.String,TaskSpawner> spawners, java.util.List<AgentXmlFactory.TaskData> toRun)
FrameworkModule
s in specified element
element
- dom elementtoAssoc
- List of pending associationstoInit
- List of pending initializationsspawners
- Map of TaskSpawner
indexed by nametoRun
- List of pending task to run
FrameworkModule
sFrameworkModule getModule(org.w3c.dom.Element moduleElement, java.util.List<java.lang.Object[]> toAssoc, java.util.List<java.lang.Object[]> toInit, java.util.Map<java.lang.String,TaskSpawner> spawners, java.util.List<AgentXmlFactory.TaskData> toRun)
FrameworkModule
in specified moduleElement
moduleElement
- dom elementtoAssoc
- List of pending associationstoInit
- List of pending initializationsspawners
- Map of TaskSpawner
indexed by nametoRun
- List of pending task to run
FrameworkModule
static java.util.List<AgentXmlFactory.TaskData> getTasks(org.w3c.dom.Element element, TaskSpawner ts)
FrameworkTask
s specified in element
element
- dom elementts
- the TaskSpawner
that will run the tasks
FrameworkTask
sstatic AgentXmlFactory.TaskData getTask(org.w3c.dom.Element moduleElement, java.lang.Integer defaultTicks)
FrameworkTask
specified in element
moduleElement
- dom elementdefaultTicks
- the default ticks per run for these initial Tasks
static int getTasksDefaultTicksPerRun(org.w3c.dom.Element element)
element
- dom element
static void getAssociatedModules(org.w3c.dom.Element ele, Initializable ini, java.util.List<java.lang.Object[]> toAssoc)
Initializable
ele
- dom elementini
- the InitializabletoAssoc
- List of pending associationsstatic void getListeners(org.w3c.dom.Element element, FrameworkModule topModule)
element
- dom elementtopModule
- the root of the hierarchy of FrameworkModule
s,
in general, an Agent
static void getListener(org.w3c.dom.Element moduleElement, FrameworkModule topModule)
moduleElement
- dom elementtopModule
- the root of the hierarchy of FrameworkModule
s,
in general, an Agent
static void associateModules(java.util.List<java.lang.Object[]> toAssoc, FrameworkModule topModule)
toAssoc
- List of pending associationstopModule
- the root of the hierarchy of FrameworkModule
s,
in general, an Agent
static void initializeModules(Agent topModule, java.util.List<java.lang.Object[]> toInit)
topModule
- the root of the hierarchy of FrameworkModule
s,
in general, an Agent
toInit
- List of pending initializationsstatic void initializeTasks(java.util.Map<ModuleName,FrameworkModule> moduleMap, java.util.List<AgentXmlFactory.TaskData> toRun)
TaskSpawner
moduleMap
- Map of all FrameworkModule
indexed by ModuleName
toRun
- list of the FrameworkModule
to be created and run
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |