|
|||||||||||||||||||
| 30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover | |||||||||||||||||||
| Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
| DOMLog4JLoggerStoreFactory.java | 100% | 100% | 100% | 100% |
|
||||||||||||||
| 1 |
/*
|
|
| 2 |
* Copyright (C) The Spice Group. All rights reserved.
|
|
| 3 |
*
|
|
| 4 |
* This software is published under the terms of the Spice
|
|
| 5 |
* Software License version 1.1, a copy of which has been included
|
|
| 6 |
* with this distribution in the LICENSE.txt file.
|
|
| 7 |
*/
|
|
| 8 |
package org.codehaus.spice.loggerstore.factories;
|
|
| 9 |
|
|
| 10 |
import java.io.InputStream;
|
|
| 11 |
import java.util.Map;
|
|
| 12 |
import org.codehaus.spice.loggerstore.LoggerStore;
|
|
| 13 |
import org.codehaus.spice.loggerstore.stores.Log4JLoggerStore;
|
|
| 14 |
import org.w3c.dom.Element;
|
|
| 15 |
|
|
| 16 |
/**
|
|
| 17 |
* DOMLog4JLoggerStoreFactory is an implementation of LoggerStoreFactory for the
|
|
| 18 |
* Log4J Logger using a DOM configuration resource.
|
|
| 19 |
*
|
|
| 20 |
* @author <a href="mailto:mauro.talevi at aquilonia.org">Mauro Talevi</a>
|
|
| 21 |
* @author Peter Donald
|
|
| 22 |
* @version $Revision: 1.1 $ $Date: 2003/11/19 18:22:44 $
|
|
| 23 |
*/
|
|
| 24 |
public class DOMLog4JLoggerStoreFactory |
|
| 25 |
extends AbstractLoggerStoreFactory
|
|
| 26 |
{
|
|
| 27 |
/**
|
|
| 28 |
* Creates a LoggerStore from a given set of configuration parameters.
|
|
| 29 |
*
|
|
| 30 |
* @param config the Map of parameters for the configuration of the store
|
|
| 31 |
* @return the LoggerStore
|
|
| 32 |
* @throws Exception if unable to create the LoggerStore
|
|
| 33 |
*/
|
|
| 34 | 13 |
protected LoggerStore doCreateLoggerStore( final Map config )
|
| 35 |
throws Exception
|
|
| 36 |
{
|
|
| 37 | 13 |
final Element element = (Element)config.get( Element.class.getName() );
|
| 38 | 13 |
if( null != element ) |
| 39 |
{
|
|
| 40 | 1 |
return new Log4JLoggerStore( element ); |
| 41 |
} |
|
| 42 |
|
|
| 43 | 12 |
final InputStream resource = getInputStream( config ); |
| 44 | 12 |
if( null != resource ) |
| 45 |
{
|
|
| 46 | 11 |
return new Log4JLoggerStore( resource ); |
| 47 |
} |
|
| 48 | 1 |
return missingConfiguration();
|
| 49 |
} |
|
| 50 |
} |
|
| 51 |
|
|
||||||||||