EMMA Coverage Report (generated Thu Sep 26 06:45:34 CEST 2013)
[all classes][org.jomc.logging.ri.commons]

COVERAGE SUMMARY FOR SOURCE FILE [CommonsLogger.java]

nameclass, %method, %block, %line, %
CommonsLogger.java100% (1/1)100% (34/34)82%  (244/299)89%  (68.2/77)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class CommonsLogger100% (1/1)100% (34/34)82%  (244/299)89%  (68.2/77)
onLog (Level, String, Throwable): void 100% (1/1)52%  (47/90)56%  (10/18)
<static initializer> 100% (1/1)75%  (6/8)75%  (0.8/1)
getName (): String 100% (1/1)75%  (15/20)91%  (2.7/3)
getObjectManagementLogger (): Logger 100% (1/1)75%  (15/20)91%  (2.7/3)
CommonsLogger (): void 100% (1/1)100% (3/3)100% (2/2)
config (String): void 100% (1/1)100% (5/5)100% (2/2)
config (String, Throwable): void 100% (1/1)100% (6/6)100% (2/2)
config (Throwable): void 100% (1/1)100% (7/7)100% (2/2)
debug (String): void 100% (1/1)100% (5/5)100% (2/2)
debug (String, Throwable): void 100% (1/1)100% (6/6)100% (2/2)
debug (Throwable): void 100% (1/1)100% (7/7)100% (2/2)
error (String): void 100% (1/1)100% (5/5)100% (2/2)
error (String, Throwable): void 100% (1/1)100% (6/6)100% (2/2)
error (Throwable): void 100% (1/1)100% (7/7)100% (2/2)
fatal (String): void 100% (1/1)100% (5/5)100% (2/2)
fatal (String, Throwable): void 100% (1/1)100% (6/6)100% (2/2)
fatal (Throwable): void 100% (1/1)100% (7/7)100% (2/2)
getLogger (): Log 100% (1/1)100% (4/4)100% (1/1)
info (String): void 100% (1/1)100% (5/5)100% (2/2)
info (String, Throwable): void 100% (1/1)100% (6/6)100% (2/2)
info (Throwable): void 100% (1/1)100% (7/7)100% (2/2)
isConfigEnabled (): boolean 100% (1/1)100% (4/4)100% (1/1)
isDebugEnabled (): boolean 100% (1/1)100% (4/4)100% (1/1)
isErrorEnabled (): boolean 100% (1/1)100% (4/4)100% (1/1)
isFatalEnabled (): boolean 100% (1/1)100% (4/4)100% (1/1)
isInfoEnabled (): boolean 100% (1/1)100% (4/4)100% (1/1)
isTraceEnabled (): boolean 100% (1/1)100% (4/4)100% (1/1)
isWarnEnabled (): boolean 100% (1/1)100% (4/4)100% (1/1)
trace (String): void 100% (1/1)100% (5/5)100% (2/2)
trace (String, Throwable): void 100% (1/1)100% (6/6)100% (2/2)
trace (Throwable): void 100% (1/1)100% (7/7)100% (2/2)
warn (String): void 100% (1/1)100% (5/5)100% (2/2)
warn (String, Throwable): void 100% (1/1)100% (6/6)100% (2/2)
warn (Throwable): void 100% (1/1)100% (7/7)100% (2/2)

1// SECTION-START[License Header]
2// <editor-fold defaultstate="collapsed" desc=" Generated License ">
3/*
4 *   Java Object Management and Configuration
5 *   Copyright (C) Christian Schulte, 2005-206
6 *   All rights reserved.
7 *
8 *   Redistribution and use in source and binary forms, with or without
9 *   modification, are permitted provided that the following conditions
10 *   are met:
11 *
12 *     o Redistributions of source code must retain the above copyright
13 *       notice, this list of conditions and the following disclaimer.
14 *
15 *     o Redistributions in binary form must reproduce the above copyright
16 *       notice, this list of conditions and the following disclaimer in
17 *       the documentation and/or other materials provided with the
18 *       distribution.
19 *
20 *   THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
21 *   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
22 *   AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
23 *   THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT,
24 *   INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
25 *   NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29 *   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 *
31 *   $JOMC$
32 *
33 */
34// </editor-fold>
35// SECTION-END
36package org.jomc.logging.ri.commons;
37 
38import java.util.logging.Level;
39import org.apache.commons.logging.Log;
40import org.apache.commons.logging.LogFactory;
41 
42// SECTION-START[Documentation]
43// <editor-fold defaultstate="collapsed" desc=" Generated Documentation ">
44/**
45 * Object management and configuration logging system implementation backed by Apache Commons Logging.
46 *
47 * <dl>
48 *   <dt><b>Identifier:</b></dt><dd>org.jomc.logging.ri.commons.CommonsLogger</dd>
49 *   <dt><b>Name:</b></dt><dd>JOMC Logging ⁑ Commons Logging</dd>
50 *   <dt><b>Specifications:</b></dt>
51 *     <dd>org.jomc.logging.Logger @ 1.1</dd>
52 *     <dd>org.jomc.spi.Listener @ 1.0</dd>
53 *   <dt><b>Abstract:</b></dt><dd>No</dd>
54 *   <dt><b>Final:</b></dt><dd>No</dd>
55 *   <dt><b>Stateless:</b></dt><dd>Yes</dd>
56 * </dl>
57 *
58 * @author <a href="mailto:cs@schulte.it">Christian Schulte</a> 1.0
59 * @version 1.3
60 */
61// </editor-fold>
62// SECTION-END
63// SECTION-START[Annotations]
64// <editor-fold defaultstate="collapsed" desc=" Generated Annotations ">
65@javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.5", comments = "See http://www.jomc.org/jomc/1.5/jomc-tools-1.5" )
66// </editor-fold>
67// SECTION-END
68public final class CommonsLogger
69    implements
70    org.jomc.logging.Logger,
71    org.jomc.spi.Listener
72{
73    // SECTION-START[Constructors]
74    // <editor-fold defaultstate="collapsed" desc=" Generated Constructors ">
75    /** Creates a new {@code CommonsLogger} instance. */
76    @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.5", comments = "See http://www.jomc.org/jomc/1.5/jomc-tools-1.5" )
77    public CommonsLogger()
78    {
79        // SECTION-START[Default Constructor]
80        super();
81        // SECTION-END
82    }
83    // </editor-fold>
84    // SECTION-END
85    // SECTION-START[Logger]
86 
87    public boolean isConfigEnabled()
88    {
89        return this.getLogger().isDebugEnabled();
90    }
91 
92    public void config( final String message )
93    {
94        this.getLogger().debug( message );
95    }
96 
97    public void config( final Throwable throwable )
98    {
99        this.getLogger().debug( throwable.getMessage(), throwable );
100    }
101 
102    public void config( final String message, final Throwable throwable )
103    {
104        this.getLogger().debug( message, throwable );
105    }
106 
107    public boolean isDebugEnabled()
108    {
109        return this.getLogger().isDebugEnabled();
110    }
111 
112    public void debug( final String message )
113    {
114        this.getLogger().debug( message );
115    }
116 
117    public void debug( final Throwable throwable )
118    {
119        this.getLogger().debug( throwable.getMessage(), throwable );
120    }
121 
122    public void debug( final String message, final Throwable throwable )
123    {
124        this.getLogger().debug( message, throwable );
125    }
126 
127    public boolean isErrorEnabled()
128    {
129        return this.getLogger().isErrorEnabled();
130    }
131 
132    public void error( final String message )
133    {
134        this.getLogger().error( message );
135    }
136 
137    public void error( final Throwable throwable )
138    {
139        this.getLogger().error( throwable.getMessage(), throwable );
140    }
141 
142    public void error( final String message, final Throwable throwable )
143    {
144        this.getLogger().error( message, throwable );
145    }
146 
147    public boolean isFatalEnabled()
148    {
149        return this.getLogger().isFatalEnabled();
150    }
151 
152    public void fatal( final String message )
153    {
154        this.getLogger().fatal( message );
155    }
156 
157    public void fatal( final Throwable throwable )
158    {
159        this.getLogger().fatal( throwable.getMessage(), throwable );
160    }
161 
162    public void fatal( final String message, final Throwable throwable )
163    {
164        this.getLogger().fatal( message, throwable );
165    }
166 
167    public boolean isInfoEnabled()
168    {
169        return this.getLogger().isInfoEnabled();
170    }
171 
172    public void info( final String message )
173    {
174        this.getLogger().info( message );
175    }
176 
177    public void info( final Throwable throwable )
178    {
179        this.getLogger().info( throwable.getMessage(), throwable );
180    }
181 
182    public void info( final String message, final Throwable throwable )
183    {
184        this.getLogger().info( message, throwable );
185    }
186 
187    public boolean isTraceEnabled()
188    {
189        return this.getLogger().isTraceEnabled();
190    }
191 
192    public void trace( final String message )
193    {
194        this.getLogger().trace( message );
195    }
196 
197    public void trace( final Throwable throwable )
198    {
199        this.getLogger().trace( throwable.getMessage(), throwable );
200    }
201 
202    public void trace( final String message, final Throwable throwable )
203    {
204        this.getLogger().trace( message, throwable );
205    }
206 
207    public boolean isWarnEnabled()
208    {
209        return this.getLogger().isWarnEnabled();
210    }
211 
212    public void warn( final String message )
213    {
214        this.getLogger().warn( message );
215    }
216 
217    public void warn( final Throwable throwable )
218    {
219        this.getLogger().warn( throwable.getMessage(), throwable );
220    }
221 
222    public void warn( final String message, final Throwable throwable )
223    {
224        this.getLogger().warn( message, throwable );
225    }
226 
227    // SECTION-END
228    // SECTION-START[Listener]
229    public void onLog( final Level level, final String message, final Throwable throwable )
230    {
231        if ( level != null )
232        {
233            if ( level.intValue() <= Level.FINEST.intValue() )
234            {
235                this.getObjectManagementLogger().trace( message, throwable );
236            }
237            else if ( level.intValue() <= Level.FINER.intValue() )
238            {
239                this.getObjectManagementLogger().debug( message, throwable );
240            }
241            else if ( level.intValue() <= Level.FINE.intValue() )
242            {
243                this.getObjectManagementLogger().debug( message, throwable );
244            }
245            else if ( level.intValue() <= Level.CONFIG.intValue() )
246            {
247                this.getObjectManagementLogger().config( message, throwable );
248            }
249            else if ( level.intValue() <= Level.INFO.intValue() )
250            {
251                this.getObjectManagementLogger().info( message, throwable );
252            }
253            else if ( level.intValue() <= Level.WARNING.intValue() )
254            {
255                this.getObjectManagementLogger().warn( message, throwable );
256            }
257            else if ( level.intValue() <= Level.SEVERE.intValue() )
258            {
259                this.getObjectManagementLogger().error( message, throwable );
260            }
261            else if ( level.intValue() < Level.OFF.intValue() )
262            {
263                this.getObjectManagementLogger().fatal( message, throwable );
264            }
265        }
266    }
267 
268    // SECTION-END
269    // SECTION-START[CommonsLogger]
270    /**
271     * Gets the commons logging logger backing the instance.
272     *
273     * @return The commons logging logger backing the instance..
274     *
275     * @see #getName()
276     * @see LogFactory#getLog(java.lang.String)
277     */
278    public Log getLogger()
279    {
280        return LogFactory.getLog( this.getName() );
281    }
282 
283    // SECTION-END
284    // SECTION-START[Dependencies]
285    // <editor-fold defaultstate="collapsed" desc=" Generated Dependencies ">
286    /**
287     * Gets the {@code <ObjectManagementLogger>} dependency.
288     * <p>
289     *   This method returns the {@code <JOMC Logging ⁑ Commons Logging>} object of the {@code <org.jomc.logging.Logger>} specification at specification level 1.1.
290     *   That specification does not apply to any scope. A new object is returned whenever requested and bound to this instance.
291     * </p>
292     * <p><strong>Properties:</strong>
293     *   <table border="1" width="100%" cellpadding="3" cellspacing="0">
294     *     <tr class="TableSubHeadingColor">
295     *       <th align="left" scope="col" nowrap><b>Name</b></th>
296     *       <th align="left" scope="col" nowrap><b>Type</b></th>
297     *       <th align="left" scope="col" nowrap><b>Documentation</b></th>
298     *     </tr>
299     *     <tr class="TableRow">
300     *       <td align="left" valign="top" nowrap>{@code <name>}</td>
301     *       <td align="left" valign="top" nowrap>{@code java.lang.String}</td>
302     *       <td align="left" valign="top">Name of the logger object management events are logged with.</td>
303     *     </tr>
304     *   </table>
305     * </p>
306     * <dl>
307     *   <dt><b>Final:</b></dt><dd>No</dd>
308     * </dl>
309     * @return Logger object management events are logged with.
310     * @throws org.jomc.ObjectManagementException if getting the dependency instance fails.
311     */
312    @SuppressWarnings("unused")
313    @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.5", comments = "See http://www.jomc.org/jomc/1.5/jomc-tools-1.5" )
314    private org.jomc.logging.Logger getObjectManagementLogger()
315    {
316        final org.jomc.logging.Logger _d = (org.jomc.logging.Logger) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getDependency( this, "ObjectManagementLogger" );
317        assert _d != null : "'ObjectManagementLogger' dependency not found.";
318        return _d;
319    }
320    // </editor-fold>
321    // SECTION-END
322    // SECTION-START[Properties]
323    // <editor-fold defaultstate="collapsed" desc=" Generated Properties ">
324    /**
325     * Gets the value of the {@code <name>} property.
326     * <p><dl>
327     *   <dt><b>Final:</b></dt><dd>No</dd>
328     * </dl></p>
329     * @return Name of the component events are logged for.
330     * @throws org.jomc.ObjectManagementException if getting the property instance fails.
331     */
332    @SuppressWarnings("unused")
333    @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.5", comments = "See http://www.jomc.org/jomc/1.5/jomc-tools-1.5" )
334    public java.lang.String getName()
335    {
336        final java.lang.String _p = (java.lang.String) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getProperty( this, "name" );
337        assert _p != null : "'name' property not found.";
338        return _p;
339    }
340    // </editor-fold>
341    // SECTION-END
342    // SECTION-START[Messages]
343    // SECTION-END
344}

[all classes][org.jomc.logging.ri.commons]
EMMA 2.1.5320 (stable) (C) Vladimir Roubtsov