public class GroupDirectoryDAO extends AbstractLogEnabled implements Component, Initializable, Serviceable, Disposable
GroupDirectory
Modifier and Type | Field and Description |
---|---|
private static File |
__GROUP_DIRECTORIES_FILE
The path of the XML file containing the group directories
|
private static String |
__ID_REGEX
The regular expression for an id of a group directory
|
private Map<String,GroupDirectory> |
_groupDirectories
The whole group directories of the application
|
private GroupDirectoryFactory |
_groupDirectoryFactory
The factory for group directories
|
private long |
_lastFileReading
The date (as a long) of the last time the
GroupDirectories file was read (last update) |
static String |
ROLE
Avalon Role
|
Constructor and Description |
---|
GroupDirectoryDAO() |
Modifier and Type | Method and Description |
---|---|
private void |
_configureGroupDirectory(Configuration configuration) |
private void |
_createDirectoriesFile(File file) |
private GroupDirectory |
_createGroupDirectory(String id,
String label,
String modelId,
Map<String,String> params) |
private Map<String,Object> |
_getParametersFromConfiguration(Configuration conf,
String modelId) |
private Map<String,Object> |
_getTypedParams(Map<String,String> params,
String modelId) |
private boolean |
_isCorrectId(String id) |
private void |
_read(boolean forceRead)
If needed, reads the config file representing the group directories and then
reinitializes and updates the internal representation of the group directories.
|
private void |
_saxGroupDirectory(GroupDirectory groupDirectory,
TransformerHandler handler) |
private void |
_toSAX(TransformerHandler handler) |
private boolean |
_write()
Erases the config file representing the group directories and rebuild it
from the internal representation of the group directories.
|
Map<String,Object> |
add(String id,
String label,
String modelId,
Map<String,String> params)
Adds a new group directory
|
void |
dispose() |
Map<String,Object> |
edit(String id,
String label,
String modelId,
Map<String,String> params)
Edits the given group directory
|
Map<String,Object> |
getEditionConfiguration()
Gets the configuration for creating/editing a group directory.
|
List<GroupDirectory> |
getGroupDirectories()
Gets all the group directories of this application
|
List<Object> |
getGroupDirectories2Json()
Gets all the group directories to JSON format
|
Set<String> |
getGroupDirectoriesIds()
Gets the list of the ids of all the group directories of the application
|
GroupDirectory |
getGroupDirectory(String id)
Gets a group directory by its id.
|
Map<String,Object> |
getGroupDirectory2Json(GroupDirectory groupDirectory)
gets a group directory to JSON format
|
Map<String,Object> |
getGroupDirectoryParameterValues(String id)
Gets the values of the parameters of the given group directory
|
void |
initialize() |
Map<String,Object> |
remove(String id)
Removes the given group directory
|
void |
service(ServiceManager manager) |
getLogger, setLogger
private static final File __GROUP_DIRECTORIES_FILE
private static final String __ID_REGEX
private long _lastFileReading
GroupDirectories file
was read (last update)private Map<String,GroupDirectory> _groupDirectories
private GroupDirectoryFactory _groupDirectoryFactory
public GroupDirectoryDAO()
public void initialize()
initialize
in interface Initializable
public void service(ServiceManager manager) throws ServiceException
service
in interface Serviceable
ServiceException
public List<Object> getGroupDirectories2Json()
GroupDirectories
public Map<String,Object> getGroupDirectory2Json(GroupDirectory groupDirectory)
groupDirectory
- The group directory to getGroupDirectory
public List<GroupDirectory> getGroupDirectories()
GroupDirectories
public GroupDirectory getGroupDirectory(String id)
id
- The id of the group directoryGroupDirectory
, or null if not foundpublic Set<String> getGroupDirectoriesIds()
public Map<String,Object> getEditionConfiguration() throws Exception
Exception
- If an error occurs.public Map<String,Object> getGroupDirectoryParameterValues(String id)
id
- The id of the group directorypublic Map<String,Object> add(String id, String label, String modelId, Map<String,String> params)
id
- The unique id of the group directorylabel
- The label of the group directorymodelId
- The id of the group directory modelparams
- The parameters of the group directoryprivate boolean _isCorrectId(String id)
public Map<String,Object> edit(String id, String label, String modelId, Map<String,String> params)
id
- The id of the group directory to editlabel
- The label of the group directorymodelId
- The id of the group directory modelparams
- The parameters of the group directoryprivate GroupDirectory _createGroupDirectory(String id, String label, String modelId, Map<String,String> params)
private Map<String,Object> _getTypedParams(Map<String,String> params, String modelId)
public Map<String,Object> remove(String id)
id
- The id of the group directory to removeprivate void _read(boolean forceRead)
forceRead
- True to avoid the use of the cache and force the reading of the fileprivate void _createDirectoriesFile(File file) throws IOException, TransformerConfigurationException, SAXException
private void _configureGroupDirectory(Configuration configuration) throws ConfigurationException
ConfigurationException
private Map<String,Object> _getParametersFromConfiguration(Configuration conf, String modelId)
private boolean _write()
private void _toSAX(TransformerHandler handler) throws SAXException
SAXException
private void _saxGroupDirectory(GroupDirectory groupDirectory, TransformerHandler handler) throws SAXException
SAXException
public void dispose()
dispose
in interface Disposable