Class XMLInterface
java.lang.Object
net.simplace.sim.io.interfaces.FWSimInterface<FilePool>
net.simplace.sim.io.interfaces.FILEInterface
net.simplace.sim.io.interfaces.XMLInterface
Interface for XML files; currently only used for resources. The file contains one element per data line, each with
parameter children (attribute id = column name, text = value, or value
children for arrays).- Author:
- Andreas Enders
-
Nested Class Summary
Nested classes/interfaces inherited from class FWSimInterface
FWSimInterface.INTERFACE_TYPE -
Field Summary
Fields inherited from class FILEInterface
iContent, iFileinfo, iFilenameFields inherited from class FWSimInterface
iColumnMap, iColumnNamesInt, iIntColumnNames -
Constructor Summary
ConstructorsModifierConstructorDescriptionXMLInterface(String aName, int aPoolSize, String aFileName, String aContent) Creates the interface without element.protectedXMLInterface(String aName, org.jdom2.Element aInterfaceElement) Creates the interface from its element. -
Method Summary
Modifier and TypeMethodDescriptionread(FWSimSession aFwSimSession, String aProjectID, Object aCache, LinkedHashMap<String, String> aKeyMap, FWSimInputAdapter aResourceAdapter, String aUniqueID, FWSimInterface.INTERFACE_TYPE aInterfaceType) Converts the root element of an XML resource into a resource cache: each child element becomes a data line, itsparameterchildren the values (arrays of double or int fromvaluechildren).Methods inherited from class FILEInterface
finalize, getFilename, getInterface, getRegisteredOutputFiles, resetFilePool, setFilename, toXMLMethods inherited from class FWSimInterface
checkHeaderForColMode, createInterface, createInterface, createStatisticInterface, getInterfaceElement, getInterfaceType, getName, getPoolSize, readColArray, readColArray, toString, transformArrays, writeToDatabase
-
Constructor Details
-
XMLInterface
Creates the interface from its element.- Parameters:
aName- name of the interfaceaInterfaceElement- theinterfaceelement
-
XMLInterface
Creates the interface without element.- Parameters:
aName- name of the interfaceaPoolSize- number of pooled filesaFileName- the file name, may contain tokensaContent- the XML as string instead of a file, may benull
-
-
Method Details
-
read
public FWSimResourceCache read(FWSimSession aFwSimSession, String aProjectID, Object aCache, LinkedHashMap<String, String> aKeyMap, FWSimInputAdapter aResourceAdapter, String aUniqueID, FWSimInterface.INTERFACE_TYPE aInterfaceType) throws MissingSimResourceExceptionConverts the root element of an XML resource into a resource cache: each child element becomes a data line, itsparameterchildren the values (arrays of double or int fromvaluechildren). Missing values and wrong keys are logged. If the adapter caches to the database, or for the project data, the lines are also written to a table. Errors are logged and a partly filled cache is returned.- Specified by:
readin classFWSimInterface<FilePool>- Parameters:
aFwSimSession- the sessionaProjectID- id of the current projectaCache- the data read, in the format of the interface (e.g.String[][], result set, XML element)aKeyMap- key variables of the resourceaResourceAdapter- the adapter the cache belongs toaUniqueID- unique id of the source dataaInterfaceType- type of the source interface- Returns:
- the new resource cache
- Throws:
MissingSimResourceException- if the data cannot be converted- See Also:
-