Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
LoggingConfiguration |
|
| 1.2222222222222223;1,222 |
1 | /** | |
2 | * 2009, 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 | ||
6 | package pt.digitalis.dif.utils.logging; | |
7 | ||
8 | import pt.digitalis.dif.ioc.DIFIoCRegistry; | |
9 | import pt.digitalis.utils.config.IConfigurations; | |
10 | import pt.digitalis.utils.config.annotations.ConfigDefault; | |
11 | import pt.digitalis.utils.config.annotations.ConfigID; | |
12 | import pt.digitalis.utils.config.annotations.ConfigIgnore; | |
13 | import pt.digitalis.utils.config.annotations.ConfigSectionID; | |
14 | ||
15 | /** | |
16 | * Configuration point for the Presentation layer | |
17 | * | |
18 | * @author Pedro Viegas <a href="mailto:pviegas@digitalis.pt">pviegas@digitalis.pt</a><br/> | |
19 | * @created Sep 24, 2009 | |
20 | */ | |
21 | @ConfigID("dif2") | |
22 | @ConfigSectionID("Logging") | |
23 | 0 | public class LoggingConfiguration { |
24 | ||
25 | /** The singleton instance */ | |
26 | 0 | static private LoggingConfiguration instance = null; |
27 | ||
28 | /** | |
29 | * Returns the active configuration object instance. | |
30 | * | |
31 | * @return the configuration instance | |
32 | */ | |
33 | @ConfigIgnore | |
34 | static public LoggingConfiguration getInstance() | |
35 | { | |
36 | 0 | if (instance == null) |
37 | try | |
38 | { | |
39 | 0 | instance = DIFIoCRegistry.getRegistry().getImplementation(IConfigurations.class) |
40 | 0 | .readConfiguration(LoggingConfiguration.class); |
41 | } | |
42 | 0 | catch (Exception e) |
43 | { | |
44 | 0 | instance = null; |
45 | } | |
46 | ||
47 | 0 | return instance; |
48 | } | |
49 | ||
50 | /** If T activate debugging in the model. */ | |
51 | private Boolean debugModel; | |
52 | ||
53 | /** The Error Log Email Address */ | |
54 | private String errorLogEmailAddress; | |
55 | ||
56 | /** The error Log Email Body */ | |
57 | private String errorLogEmailBody; | |
58 | ||
59 | /** The error Log Email Subject */ | |
60 | private String errorLogEmailSubject; | |
61 | ||
62 | /** | |
63 | * Inspector for the 'debugModel' attribute. | |
64 | * | |
65 | * @return the debugModel value | |
66 | */ | |
67 | @ConfigDefault("false") | |
68 | public Boolean getDebugModel() | |
69 | { | |
70 | 0 | return debugModel; |
71 | } | |
72 | ||
73 | /** | |
74 | * Inspector for the 'errorLogEmailAddress' attribute. | |
75 | * | |
76 | * @return the errorLogEmailAddress value | |
77 | */ | |
78 | @ConfigDefault("") | |
79 | public String getErrorLogEmailAddress() | |
80 | { | |
81 | 0 | return errorLogEmailAddress; |
82 | } | |
83 | ||
84 | /** | |
85 | * Inspector for the 'errorLogEmailBody' attribute. | |
86 | * | |
87 | * @return the errorLogEmailBody value | |
88 | */ | |
89 | @ConfigDefault("An error occurred in application ${applicationName}. You can see the details authentication as administrator and see \"Error Log Viewer\" service.") | |
90 | public String getErrorLogEmailBody() | |
91 | { | |
92 | 0 | return errorLogEmailBody; |
93 | } | |
94 | ||
95 | /** | |
96 | * Inspector for the 'errorLogEmailSubject' attribute. | |
97 | * | |
98 | * @return the errorLogEmailSubject value | |
99 | */ | |
100 | @ConfigDefault("Error Log service") | |
101 | public String getErrorLogEmailSubject() | |
102 | { | |
103 | 0 | return errorLogEmailSubject; |
104 | } | |
105 | ||
106 | /** | |
107 | * Modifier for the 'debugModel' attribute. | |
108 | * | |
109 | * @param debugModel | |
110 | * the new debugModel value to set | |
111 | */ | |
112 | public void setDebugModel(Boolean debugModel) | |
113 | { | |
114 | 0 | this.debugModel = debugModel; |
115 | 0 | } |
116 | ||
117 | /** | |
118 | * Modifier for the 'errorLogEmailAddress' attribute. | |
119 | * | |
120 | * @param errorLogEmailAddress | |
121 | * the new errorLogEmailAddress value to set | |
122 | */ | |
123 | public void setErrorLogEmailAddress(String errorLogEmailAddress) | |
124 | { | |
125 | 0 | this.errorLogEmailAddress = errorLogEmailAddress; |
126 | 0 | } |
127 | ||
128 | /** | |
129 | * Modifier for the 'errorLogEmailBody' attribute. | |
130 | * | |
131 | * @param errorLogEmailBody | |
132 | * the new errorLogEmailBody value to set | |
133 | */ | |
134 | public void setErrorLogEmailBody(String errorLogEmailBody) | |
135 | { | |
136 | 0 | this.errorLogEmailBody = errorLogEmailBody; |
137 | 0 | } |
138 | ||
139 | /** | |
140 | * Modifier for the 'errorLogEmailSubject' attribute. | |
141 | * | |
142 | * @param errorLogEmailSubject | |
143 | * the new errorLogEmailSubject value to set | |
144 | */ | |
145 | public void setErrorLogEmailSubject(String errorLogEmailSubject) | |
146 | { | |
147 | 0 | this.errorLogEmailSubject = errorLogEmailSubject; |
148 | 0 | } |
149 | ||
150 | } |