Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
ConfigurationManagement |
|
| 0.0;0 |
1 | package org.naftulin.configmgr; | |
2 | ||
3 | import java.util.List; | |
4 | ||
5 | /** | |
6 | * Configuration Management provides a convinient way to manage configuration for your programs. | |
7 | * Alows to load and reload configurations, add configuration, list all the configurations and | |
8 | * returns configuration manager interface. Configuration manager interface returns configuration | |
9 | * based on the key. | |
10 | * | |
11 | * @author Henry Naftulin | |
12 | * @since 1.0 | |
13 | */ | |
14 | public interface ConfigurationManagement { | |
15 | /** | |
16 | * Returns configuration manager created by the configuration management engine. | |
17 | * @return configuration manager. | |
18 | */ | |
19 | ConfigurationManager getConfigurationManager(); | |
20 | ||
21 | /** | |
22 | * Reloades configurations stored in the configuration management engine. The | |
23 | * configurations are read again, parsed and stored. | |
24 | * @throws ConfigurationManagerException if a problem occurs while reading or parsing the configurations. | |
25 | */ | |
26 | void reload() throws ConfigurationManagerException; | |
27 | ||
28 | /** | |
29 | * Returns {@link ConfigurationManagementEntry configuration management entry} based on the key passed. | |
30 | * @param key key the entry is stored under | |
31 | * @return configuration management entry based on the key passed | |
32 | * @throws ConfigurationManagerException if the entry is not found. | |
33 | */ | |
34 | ConfigurationManagementEntry getConfigurationManagmentEntry(String key) throws ConfigurationManagerException; | |
35 | ||
36 | /** | |
37 | * Adds a {@link ConfigurationManagementEntry configuration management entry}. Entries added this way will be lost when | |
38 | * the reload fucntionality is invoked. | |
39 | * @param entry configuration managemet entry | |
40 | * @throws EntryInErrorException if the entry is not configured properly, for example if the key is not supplied. | |
41 | */ | |
42 | void addConfigurationManagmentEntry(ConfigurationManagementEntry entry) throws EntryInErrorException; | |
43 | ||
44 | /** | |
45 | * Returns a list of {@link ConfigurationManagementEntry configuration management entries} managed by this configuration managment engine. | |
46 | * @return a list of {@link ConfigurationManagementEntry configuration management entries} managed by this configuration managment engine. | |
47 | */ | |
48 | List<ConfigurationManagementEntry> getConfigurationManagmentEntries(); | |
49 | ||
50 | /** | |
51 | * Returns true if configuration Management has loaded configurations. Returns false | |
52 | * before that point. After instantiation, we can confgure where configuration master | |
53 | * record is read from. Once the master record is configured, we will be able to reload | |
54 | * configuration manager. Reloading configuration manager will load all configurations, | |
55 | * and the flag will switch to initialized. | |
56 | * @return true if configuration Management has loaded configurations. | |
57 | */ | |
58 | boolean isInitialized(); | |
59 | } |