|
|||||||||||||||||||
| 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 | |||||||||||||||
| Jdk14LoggerStoreFactory.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.ByteArrayInputStream;
|
|
| 11 |
import java.io.ByteArrayOutputStream;
|
|
| 12 |
import java.io.InputStream;
|
|
| 13 |
import java.util.Map;
|
|
| 14 |
import java.util.Properties;
|
|
| 15 |
import org.codehaus.spice.loggerstore.LoggerStore;
|
|
| 16 |
import org.codehaus.spice.loggerstore.stores.Jdk14LoggerStore;
|
|
| 17 |
|
|
| 18 |
/**
|
|
| 19 |
* Jdk14LoggerStoreFactory is an implementation of LoggerStoreFactory for the
|
|
| 20 |
* JDK14 Logger.
|
|
| 21 |
*
|
|
| 22 |
* @author <a href="mailto:mauro.talevi at aquilonia.org">Mauro Talevi</a>
|
|
| 23 |
* @author Peter Donald
|
|
| 24 |
* @version $Revision: 1.1 $ $Date: 2003/11/19 18:22:44 $
|
|
| 25 |
*/
|
|
| 26 |
public class Jdk14LoggerStoreFactory |
|
| 27 |
extends AbstractLoggerStoreFactory
|
|
| 28 |
{
|
|
| 29 |
/**
|
|
| 30 |
* Creates a LoggerStore from a given set of configuration parameters.
|
|
| 31 |
*
|
|
| 32 |
* @param config the Map of parameters for the configuration of the store
|
|
| 33 |
* @return the LoggerStore
|
|
| 34 |
* @throws Exception if unable to create the LoggerStore
|
|
| 35 |
*/
|
|
| 36 | 13 |
protected LoggerStore doCreateLoggerStore( final Map config )
|
| 37 |
throws Exception
|
|
| 38 |
{
|
|
| 39 | 13 |
final Properties properties = (Properties)config.get( |
| 40 |
Properties.class.getName() );
|
|
| 41 | 13 |
if( null != properties ) |
| 42 |
{
|
|
| 43 | 1 |
final ByteArrayOutputStream output = new ByteArrayOutputStream();
|
| 44 | 1 |
properties.store( output, "" );
|
| 45 | 1 |
final ByteArrayInputStream input = new ByteArrayInputStream(
|
| 46 |
output.toByteArray() ); |
|
| 47 | 1 |
return new Jdk14LoggerStore( input ); |
| 48 |
} |
|
| 49 | 12 |
final InputStream resource = getInputStream( config ); |
| 50 | 12 |
if( null != resource ) |
| 51 |
{
|
|
| 52 | 11 |
return new Jdk14LoggerStore( resource ); |
| 53 |
} |
|
| 54 | 1 |
return missingConfiguration();
|
| 55 |
} |
|
| 56 |
} |
|
| 57 |
|
|
||||||||||