1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36 package org.jomc.logging.ri.commons;
37
38 import java.util.logging.Level;
39 import org.apache.commons.logging.Log;
40 import org.apache.commons.logging.LogFactory;
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.4", comments = "See http://www.jomc.org/jomc/1.4/jomc-tools-1.4" )
66
67
68 public final class CommonsLogger
69 implements
70 org.jomc.logging.Logger,
71 org.jomc.spi.Listener
72 {
73
74
75
76 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.4", comments = "See http://www.jomc.org/jomc/1.4/jomc-tools-1.4" )
77 public CommonsLogger()
78 {
79
80 super();
81
82 }
83
84
85
86
87 public boolean isDebugEnabled()
88 {
89 return this.getLogger().isDebugEnabled();
90 }
91
92 public void debug( final String message )
93 {
94 this.getLogger().debug( message );
95 }
96
97 public void debug( final Throwable throwable )
98 {
99 this.getLogger().debug( throwable.getMessage(), throwable );
100 }
101
102 public void debug( final String message, final Throwable throwable )
103 {
104 this.getLogger().debug( message, throwable );
105 }
106
107 public boolean isErrorEnabled()
108 {
109 return this.getLogger().isErrorEnabled();
110 }
111
112 public void error( final String message )
113 {
114 this.getLogger().error( message );
115 }
116
117 public void error( final Throwable throwable )
118 {
119 this.getLogger().error( throwable.getMessage(), throwable );
120 }
121
122 public void error( final String message, final Throwable throwable )
123 {
124 this.getLogger().error( message, throwable );
125 }
126
127 public boolean isFatalEnabled()
128 {
129 return this.getLogger().isFatalEnabled();
130 }
131
132 public void fatal( final String message )
133 {
134 this.getLogger().fatal( message );
135 }
136
137 public void fatal( final Throwable throwable )
138 {
139 this.getLogger().fatal( throwable.getMessage(), throwable );
140 }
141
142 public void fatal( final String message, final Throwable throwable )
143 {
144 this.getLogger().fatal( message, throwable );
145 }
146
147 public boolean isInfoEnabled()
148 {
149 return this.getLogger().isInfoEnabled();
150 }
151
152 public void info( final String message )
153 {
154 this.getLogger().info( message );
155 }
156
157 public void info( final Throwable throwable )
158 {
159 this.getLogger().info( throwable.getMessage(), throwable );
160 }
161
162 public void info( final String message, final Throwable throwable )
163 {
164 this.getLogger().info( message, throwable );
165 }
166
167 public boolean isTraceEnabled()
168 {
169 return this.getLogger().isTraceEnabled();
170 }
171
172 public void trace( final String message )
173 {
174 this.getLogger().trace( message );
175 }
176
177 public void trace( final Throwable throwable )
178 {
179 this.getLogger().trace( throwable.getMessage(), throwable );
180 }
181
182 public void trace( final String message, final Throwable throwable )
183 {
184 this.getLogger().trace( message, throwable );
185 }
186
187 public boolean isWarnEnabled()
188 {
189 return this.getLogger().isWarnEnabled();
190 }
191
192 public void warn( final String message )
193 {
194 this.getLogger().warn( message );
195 }
196
197 public void warn( final Throwable throwable )
198 {
199 this.getLogger().warn( throwable.getMessage(), throwable );
200 }
201
202 public void warn( final String message, final Throwable throwable )
203 {
204 this.getLogger().warn( message, throwable );
205 }
206
207
208
209 public void onLog( final Level level, final String message, final Throwable throwable )
210 {
211 if ( level != null )
212 {
213 if ( level.equals( Level.CONFIG ) || level.equals( Level.FINE ) )
214 {
215 this.getObjectManagementLogger().debug( message, throwable );
216 }
217 else if ( level.equals( Level.FINER ) || level.equals( Level.FINEST ) )
218 {
219 this.getObjectManagementLogger().trace( message, throwable );
220 }
221 else if ( level.equals( Level.INFO ) )
222 {
223 this.getObjectManagementLogger().info( message, throwable );
224 }
225 else if ( level.equals( Level.SEVERE ) )
226 {
227 this.getObjectManagementLogger().error( message, throwable );
228 }
229 else if ( level.equals( Level.WARNING ) )
230 {
231 this.getObjectManagementLogger().warn( message, throwable );
232 }
233 else
234 {
235 this.getObjectManagementLogger().trace( message, throwable );
236 }
237 }
238 }
239
240
241
242
243
244
245
246
247
248
249
250 public Log getLogger()
251 {
252 return LogFactory.getLog( this.getName() );
253 }
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284 @SuppressWarnings("unused")
285 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.4", comments = "See http://www.jomc.org/jomc/1.4/jomc-tools-1.4" )
286 private org.jomc.logging.Logger getObjectManagementLogger()
287 {
288 final org.jomc.logging.Logger _d = (org.jomc.logging.Logger) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getDependency( this, "ObjectManagementLogger" );
289 assert _d != null : "'ObjectManagementLogger' dependency not found.";
290 return _d;
291 }
292
293
294
295
296
297
298
299
300
301
302
303
304 @SuppressWarnings("unused")
305 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.4", comments = "See http://www.jomc.org/jomc/1.4/jomc-tools-1.4" )
306 public java.lang.String getName()
307 {
308 final java.lang.String _p = (java.lang.String) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getProperty( this, "name" );
309 assert _p != null : "'name' property not found.";
310 return _p;
311 }
312
313
314
315
316 }