org.edg.security.authorization.map
Class XmlFileHandler
java.lang.Object
|
+--org.edg.security.authorization.map.XmlFileHandler
- All Implemented Interfaces:
- FileMap.FileTypeHandler
- public class XmlFileHandler
- extends java.lang.Object
- implements FileMap.FileTypeHandler
A FileTypeHandler that understands XML files
- Author:
- Gian Luca Volpato
- See Also:
FileMap
,
FileMap.FileTypeHandler
Field Summary |
protected static org.apache.log4j.Logger |
logger
|
Method Summary |
void |
append(java.io.File file,
java.lang.Object key,
java.lang.Object value)
Appends a given (key,value) pair to the given file. |
java.util.Map |
load(java.io.File file)
Parses the file and turns it into a Map.
|
void |
save(java.io.File file,
java.util.Map map)
Saves the map to the given file. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
logger
protected static org.apache.log4j.Logger logger
XmlFileHandler
public XmlFileHandler()
load
public java.util.Map load(java.io.File file)
- Description copied from interface:
FileMap.FileTypeHandler
- Parses the file and turns it into a Map.
Implementor's notes:
- It is wise to load the file contents into
a
LinkedHashMap
, so that the order of the entries in a
file is reflected in the map when iterating over it.
- Each file handler must do the proper logging themselves.
- Specified by:
load
in interface FileMap.FileTypeHandler
- Parameters:
file
- the file to load from
- Returns:
- Map the newly created map, or an empty map if error
- See Also:
FileMap.FileTypeHandler.load(File)
save
public void save(java.io.File file,
java.util.Map map)
- Description copied from interface:
FileMap.FileTypeHandler
- Saves the map to the given file. If the file exists, it will
be overwritten.
- Specified by:
save
in interface FileMap.FileTypeHandler
- Parameters:
file
- the file to save to
- Returns:
- map the map to save
- See Also:
FileMap.FileTypeHandler.save(File, Map)
append
public void append(java.io.File file,
java.lang.Object key,
java.lang.Object value)
- Description copied from interface:
FileMap.FileTypeHandler
- Appends a given (key,value) pair to the given file.
- Specified by:
append
in interface FileMap.FileTypeHandler
- Parameters:
file
- the file to append tokey
- the new keyvalue
- the new value- See Also:
Look for the end of the XML map and substitute the last line with the new association.