public class XMLPersistenceManager extends java.lang.Object implements PersistenceManager
Modifier and Type | Field and Description |
---|---|
protected java.io.File |
persistenceFile
xml file
|
protected org.jdom2.input.SAXBuilder |
saxBuilder
sax builder
|
Constructor and Description |
---|
XMLPersistenceManager(java.io.File persistenceFile)
Creates a persistence manager.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addFingerPrint(org.jdom2.Element fingerPrint,
java.lang.String technologyName,
PositionInformation positionInformation)
Adds signal data to an xml element.
|
java.util.Map<java.lang.String,java.util.List<PositionInformation>> |
getPersistedPositions()
Delivers all persisted positions.
|
protected org.jdom2.Document |
open() |
void |
persistPosition(java.lang.String technologyName,
PositionInformation positionInformation)
Adds new signal data for a technology of a position.
|
void |
removeAllMappedPositions()
Removes all persisted positions.
|
void |
removeMappedPosition(java.lang.String name)
Removes a persisted position.
|
void |
removeMappedPosition(java.lang.String name,
java.lang.String technology)
Remove a mapped technology of a position.
|
protected org.jdom2.Element |
removeOldTechnologyData(org.jdom2.Element root,
java.lang.String technologyName,
PositionInformation positionInformation)
Removes old technology data if they do not have a content.
|
protected void |
save(org.jdom2.Document doc) |
protected java.io.File persistenceFile
protected org.jdom2.input.SAXBuilder saxBuilder
public XMLPersistenceManager(java.io.File persistenceFile)
persistenceFile
- xml filepublic java.util.Map<java.lang.String,java.util.List<PositionInformation>> getPersistedPositions() throws PositioningPersistenceException
getPersistedPositions
in interface PersistenceManager
org.jdom2.JDOMException
- if the xml structur is wrongjava.io.IOException
- if the file could not be readPositioningPersistenceException
public void persistPosition(java.lang.String technologyName, PositionInformation positionInformation) throws PositioningPersistenceException
persistPosition
in interface PersistenceManager
technologyName
- name of the technologypositionInformation
- position informationorg.jdom2.JDOMException
- if the xml structur is wrongjava.io.IOException
- if the file could not be writtenPositioningPersistenceException
public void removeMappedPosition(java.lang.String name) throws PositioningPersistenceException
removeMappedPosition
in interface PersistenceManager
name
- name of the positionorg.jdom2.JDOMException
- if the xml structur is wrongjava.io.IOException
- if the file could not be writtenPositioningPersistenceException
public void removeMappedPosition(java.lang.String name, java.lang.String technology) throws PositioningPersistenceException
removeMappedPosition
in interface PersistenceManager
name
- name of the positiontechnology
- technology nameorg.jdom2.JDOMException
- if the xml structur is wrongjava.io.IOException
- if the file could not be writtenPositioningPersistenceException
public void removeAllMappedPositions() throws PositioningPersistenceException
removeAllMappedPositions
in interface PersistenceManager
PositioningPersistenceException
protected org.jdom2.Element removeOldTechnologyData(org.jdom2.Element root, java.lang.String technologyName, PositionInformation positionInformation)
root
- root xml elementtechnologyName
- technology namepositionInformation
- position informationprotected void addFingerPrint(org.jdom2.Element fingerPrint, java.lang.String technologyName, PositionInformation positionInformation)
fingerPrint
- xml element which will be changedtechnologyName
- technology namepositionInformation
- position informationprotected org.jdom2.Document open() throws org.jdom2.JDOMException, java.io.IOException
org.jdom2.JDOMException
java.io.IOException
protected void save(org.jdom2.Document doc) throws java.io.IOException
java.io.IOException