org.edg.security.authorization.map
Class FileTableHandler
java.lang.Object
|
+--org.edg.security.authorization.map.FileTableHandler
- All Implemented Interfaces:
- FileMap.FileTypeHandler
- public class FileTableHandler
- extends java.lang.Object
- implements FileMap.FileTypeHandler
A FileTypeHandler that understands flat file tables
- Author:
- Olle Mulmo PDC, Gian Luca Volpato PDC
- See Also:
FileMap
,
FileMap.FileTypeHandler
Field Summary |
protected static org.apache.log4j.Logger |
logger
|
protected static char |
theComment
|
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
theComment
protected static final char theComment
- See Also:
- Constant Field Values
FileTableHandler
public FileTableHandler()
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:
FileMap.FileTypeHandler.append(File, Object, Object)