Package repast.simphony.scenario
Class ScenarioFileLoader
- java.lang.Object
-
- org.xml.sax.helpers.DefaultHandler
-
- org.xml.sax.ext.DefaultHandler2
-
- repast.simphony.scenario.ScenarioFileLoader
-
- All Implemented Interfaces:
ContentHandler
,DTDHandler
,EntityResolver
,ErrorHandler
,DeclHandler
,EntityResolver2
,LexicalHandler
public class ScenarioFileLoader extends DefaultHandler2
Parses a scenario.xml file and loads the serialized controller actions into a ControllerRegistry. This also reads the other info in a scenario file as well.- Version:
- $Revision$ $Date$
- Author:
- Nick Collier
-
-
Field Summary
Fields Modifier and Type Field Description static String
MODEL_INITIALIZER_XML
static String
MODEL_PLUGIN_XML
-
Constructor Summary
Constructors Constructor Description ScenarioFileLoader(ControllerActionIOExtensions ext)
Creates a ScenarioFileLoader that will load actions using the specified ControllerActionIOExtensions to do the loading.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ControllerRegistry
load(File scenarioDir, Scenario scenario, ControllerRegistry registry)
Loads serialized actions into the specified ControllerRegistry and returns that registry.void
startElement(String uri, String localName, String qName, Attributes attributes)
Receive notification of the start of an element.-
Methods inherited from class org.xml.sax.ext.DefaultHandler2
attributeDecl, comment, elementDecl, endCDATA, endDTD, endEntity, externalEntityDecl, getExternalSubset, internalEntityDecl, resolveEntity, resolveEntity, startCDATA, startDTD, startEntity
-
Methods inherited from class org.xml.sax.helpers.DefaultHandler
characters, endDocument, endElement, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning
-
-
-
-
Field Detail
-
MODEL_INITIALIZER_XML
public static final String MODEL_INITIALIZER_XML
- See Also:
- Constant Field Values
-
MODEL_PLUGIN_XML
public static final String MODEL_PLUGIN_XML
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ScenarioFileLoader
public ScenarioFileLoader(ControllerActionIOExtensions ext)
Creates a ScenarioFileLoader that will load actions using the specified ControllerActionIOExtensions to do the loading.- Parameters:
ext
- the extensions used to the loading
-
-
Method Detail
-
load
public ControllerRegistry load(File scenarioDir, Scenario scenario, ControllerRegistry registry) throws ParserConfigurationException, SAXException, IOException
Loads serialized actions into the specified ControllerRegistry and returns that registry.- Parameters:
scenarioDir
-scenario
-registry
-- Returns:
- the ControllerRegistry containing the loaded actions.
- Throws:
ParserConfigurationException
SAXException
IOException
-
startElement
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException
Receive notification of the start of an element.By default, do nothing. Application writers may override this method in a subclass to take specific actions at the start of each element (such as allocating a new tree node or writing output to a file).
- Specified by:
startElement
in interfaceContentHandler
- Overrides:
startElement
in classDefaultHandler
- Parameters:
uri
- The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed.localName
- The local name (without prefix), or the empty string if Namespace processing is not being performed.qName
- The qualified name (with prefix), or the empty string if qualified names are not available.attributes
- The attributes attached to the element. If there are no attributes, it shall be an empty Attributes object.- Throws:
SAXException
- Any SAX exception, possibly wrapping another exception.- See Also:
ContentHandler.startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
-
-