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
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
-
Constructor Summary
ConstructorDescriptionCreates a ScenarioFileLoader that will load actions using the specified ControllerActionIOExtensions to do the loading. -
Method Summary
Modifier and TypeMethodDescriptionload
(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
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.xml.sax.ContentHandler
declaration
-
Field Details
-
MODEL_INITIALIZER_XML
- See Also:
-
MODEL_PLUGIN_XML
- See Also:
-
-
Constructor Details
-
ScenarioFileLoader
Creates a ScenarioFileLoader that will load actions using the specified ControllerActionIOExtensions to do the loading.- Parameters:
ext
- the extensions used to the loading
-
-
Method Details
-
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:
-