Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
DIFGeneralConfigurationParameters |
|
| 1.1176470588235294;1,118 |
1 | /** | |
2 | * 2007, Digitalis Informatica. All rights reserved. Distribuicao e Gestao de Informatica, Lda. Estrada de Paco de Arcos | |
3 | * num.9 - Piso -1 2780-666 Paco de Arcos Telefone: (351) 21 4408990 Fax: (351) 21 4408999 http://www.digitalis.pt | |
4 | */ | |
5 | package pt.digitalis.dif.startup; | |
6 | ||
7 | import pt.digitalis.dif.ioc.DIFIoCRegistry; | |
8 | import pt.digitalis.utils.config.IConfigurations; | |
9 | import pt.digitalis.utils.config.annotations.ConfigDefault; | |
10 | import pt.digitalis.utils.config.annotations.ConfigID; | |
11 | import pt.digitalis.utils.config.annotations.ConfigIgnore; | |
12 | import pt.digitalis.utils.config.annotations.ConfigSectionID; | |
13 | ||
14 | /** | |
15 | * Configuration object for framework parameters. | |
16 | * | |
17 | * @author Pedro Viegas <a href="mailto:pviegas@digitalis.pt">pviegas@digitalis.pt</a> | |
18 | * @author Rodrigo Gonçalves <a href="mailto:rgoncalves@digitalis.pt">rgoncalves@digitalis.pt</a> | |
19 | * @created Dec 12, 2007 | |
20 | */ | |
21 | @ConfigID("dif2") | |
22 | @ConfigSectionID("GeneralConfigurations") | |
23 | 0 | public class DIFGeneralConfigurationParameters { |
24 | ||
25 | /** | |
26 | * The singleton instance | |
27 | */ | |
28 | 0 | static private DIFGeneralConfigurationParameters instance = null; |
29 | ||
30 | /** | |
31 | * Returns the active configuration object instance. | |
32 | * | |
33 | * @return the configuration instance | |
34 | */ | |
35 | @ConfigIgnore | |
36 | static public DIFGeneralConfigurationParameters getInstance() | |
37 | { | |
38 | 0 | if (instance == null) |
39 | try | |
40 | { | |
41 | 0 | instance = DIFIoCRegistry.getRegistry().getImplementation(IConfigurations.class) |
42 | 0 | .readConfiguration(DIFGeneralConfigurationParameters.class); |
43 | } | |
44 | 0 | catch (Exception e) |
45 | { | |
46 | 0 | instance = null; |
47 | } | |
48 | ||
49 | 0 | return instance; |
50 | } | |
51 | ||
52 | /** The client name */ | |
53 | private String client; | |
54 | ||
55 | /** | |
56 | * If the forms allow customizations saved in the persistence layer. Possible values: Y-Yes, N-No, D-Depends if the | |
57 | * 'dif-database-repository' is enabled | |
58 | */ | |
59 | private String customForms; | |
60 | ||
61 | /** The default language for messages */ | |
62 | private String defaultLanguage; | |
63 | ||
64 | /** T to enable monitorization by external apps like New Relic */ | |
65 | private Boolean monitorizationEnabled; | |
66 | ||
67 | /** | |
68 | * If the pools persist their actions to database. Possible values: Y-Yes, N-No, D-Depends if the | |
69 | * 'dif-database-repository' is enabled | |
70 | */ | |
71 | private String persistPools; | |
72 | ||
73 | /** The interval in seconds that DIF collects inactive sessions */ | |
74 | private int secondsForSessionCleanup; | |
75 | ||
76 | /** Time after the session has timed out that the cleanup Collection will consider before purging the session (ms). */ | |
77 | private long sessionExpirationTimeAfterTimeout; | |
78 | ||
79 | /** The session time out value (ms). */ | |
80 | private long sessionTimeout; | |
81 | ||
82 | /** | |
83 | * Inspector for the 'client' attribute. | |
84 | * | |
85 | * @return the client value | |
86 | */ | |
87 | @ConfigDefault("") | |
88 | public String getClient() | |
89 | { | |
90 | 0 | return client; |
91 | } | |
92 | ||
93 | /** | |
94 | * Inspector for the 'customForms' attribute. | |
95 | * | |
96 | * @return the customForms value | |
97 | */ | |
98 | @ConfigDefault("D") | |
99 | public String getCustomForms() | |
100 | { | |
101 | 0 | return customForms; |
102 | } | |
103 | ||
104 | /** | |
105 | * Inspector for the default language property. | |
106 | * | |
107 | * @return the default language value | |
108 | */ | |
109 | @ConfigDefault("en") | |
110 | public String getDefaultLanguage() | |
111 | { | |
112 | 0 | return defaultLanguage; |
113 | } | |
114 | ||
115 | /** | |
116 | * Inspector for the 'monitorizationEnabled' attribute. | |
117 | * | |
118 | * @return the monitorizationEnabled value | |
119 | */ | |
120 | @ConfigDefault("false") | |
121 | public Boolean getMonitorizationEnabled() | |
122 | { | |
123 | 0 | return monitorizationEnabled; |
124 | } | |
125 | ||
126 | /** | |
127 | * Inspector for the 'persistPools' attribute. | |
128 | * | |
129 | * @return the persistPools value | |
130 | */ | |
131 | @ConfigDefault("D") | |
132 | public String getPersistPools() | |
133 | { | |
134 | 0 | return persistPools; |
135 | } | |
136 | ||
137 | /** | |
138 | * Inspector for the session collection time property. | |
139 | * | |
140 | * @return the session collection time property value | |
141 | */ | |
142 | @ConfigDefault("1800") | |
143 | public int getSecondsForSessionCleanup() | |
144 | { | |
145 | 0 | return secondsForSessionCleanup; |
146 | } | |
147 | ||
148 | /** | |
149 | * @return the sessionExpirationTimeAfterTimeout | |
150 | */ | |
151 | public long getSessionExpirationTimeAfterTimeout() | |
152 | { | |
153 | 0 | return sessionExpirationTimeAfterTimeout; |
154 | } | |
155 | ||
156 | /** | |
157 | * Returns the defined session time out value. Default value is 5 minutes. | |
158 | * | |
159 | * @return the defined sessionTimeout value | |
160 | */ | |
161 | @ConfigDefault("1800000") | |
162 | public long getSessionTimeout() | |
163 | { | |
164 | 0 | return this.sessionTimeout; |
165 | } | |
166 | ||
167 | /** | |
168 | * Modifier for the 'client' attribute. | |
169 | * | |
170 | * @param client | |
171 | * the new client value to set | |
172 | */ | |
173 | public void setClient(String client) | |
174 | { | |
175 | 0 | this.client = client; |
176 | 0 | } |
177 | ||
178 | /** | |
179 | * Modifier for the 'customForms' attribute. | |
180 | * | |
181 | * @param customForms | |
182 | * the new customForms value to set | |
183 | */ | |
184 | public void setCustomForms(String customForms) | |
185 | { | |
186 | 0 | this.customForms = customForms; |
187 | 0 | } |
188 | ||
189 | /** | |
190 | * Modifier for the default language property. | |
191 | * | |
192 | * @param defaultLanguage | |
193 | * the new default language value to set | |
194 | */ | |
195 | public void setDefaultLanguage(String defaultLanguage) | |
196 | { | |
197 | 0 | this.defaultLanguage = defaultLanguage.toLowerCase(); |
198 | 0 | } |
199 | ||
200 | /** | |
201 | * Modifier for the 'monitorizationEnabled' attribute. | |
202 | * | |
203 | * @param monitorizationEnabled | |
204 | * the new monitorizationEnabled value to set | |
205 | */ | |
206 | public void setMonitorizationEnabled(Boolean monitorizationEnabled) | |
207 | { | |
208 | 0 | this.monitorizationEnabled = monitorizationEnabled; |
209 | 0 | } |
210 | ||
211 | /** | |
212 | * Modifier for the 'persistPools' attribute. | |
213 | * | |
214 | * @param persistPools | |
215 | * the new persistPools value to set | |
216 | */ | |
217 | public void setPersistPools(String persistPools) | |
218 | { | |
219 | 0 | this.persistPools = persistPools; |
220 | 0 | } |
221 | ||
222 | /** | |
223 | * Modifier for the session collection time property. | |
224 | * | |
225 | * @param secondsForSessionCleanup | |
226 | * the session collection time property value to set | |
227 | */ | |
228 | public void setSecondsForSessionCleanup(int secondsForSessionCleanup) | |
229 | { | |
230 | 0 | this.secondsForSessionCleanup = secondsForSessionCleanup; |
231 | 0 | } |
232 | ||
233 | /** | |
234 | * @param sessionExpirationTimeAfterTimeout | |
235 | */ | |
236 | public void setSessionExpirationTimeAfterTimeout(long sessionExpirationTimeAfterTimeout) | |
237 | { | |
238 | 0 | this.sessionExpirationTimeAfterTimeout = sessionExpirationTimeAfterTimeout; |
239 | 0 | } |
240 | ||
241 | /** | |
242 | * Sets the new session timeout value. | |
243 | * | |
244 | * @param sessionTimeout | |
245 | * the sessionTimeout to set | |
246 | */ | |
247 | public void setSessionTimeout(long sessionTimeout) | |
248 | { | |
249 | 0 | this.sessionTimeout = sessionTimeout; |
250 | 0 | } |
251 | } |