cvs commit: spice/sandbox/alchemist project.xml
[email protected] Thu, 20 Nov 2003 05:01:20 -0600
| Newsgroups | gmane.comp.java.spice.cvs |
|---|---|
| Message-ID | <[email protected]> |
mauro 2003/11/20 05:01:20
Modified: sandbox/alchemist/xdocs index.xml
sandbox/alchemist project.xml
Added: sandbox/alchemist/src/test/org/codehaus/spice/alchemist
LoggerAlchemistTestCase.java
AvalonLoggerTestCase.java MockLogger.java
DNALoggerTestCase.java
sandbox/alchemist/src/java/org/codehaus/spice/alchemist/impl
DNALogger.java AvalonLogger.java
sandbox/alchemist/src/java/org/codehaus/spice/alchemist
LoggerAlchemist.java
Removed: sandbox/alchemist/src/test/org/jcomponent/alchemist
MockLogger.java DNALoggerTestCase.java
LoggerAlchemistTestCase.java
AvalonLoggerTestCase.java
sandbox/alchemist/src/java/org/jcomponent/alchemist/impl
AvalonLogger.java DNALogger.java
sandbox/alchemist/src/java/org/jcomponent/alchemist
LoggerAlchemist.java
Log:
Renamed org.jcomponent -> org.codehaus.spice
Revision Changes Path
1.1 spice/sandbox/alchemist/src/test/org/codehaus/spice/alchemist/LoggerAlchemistTestCase.java
Index: LoggerAlchemistTestCase.java
===================================================================
/*
* Copyright (C) The Spice Group. All rights reserved.
*
* This software is published under the terms of the Spice
* Software License version 1.1, a copy of which has been included
* with this distribution in the LICENSE.txt file.
*/
package org.codehaus.spice.alchemist;
import junit.framework.TestCase;
public class LoggerAlchemistTestCase
extends TestCase
{
private MockLogger m_mockLogger;
public void testDNALoggerWithNullLogger()
throws Exception
{
try
{
LoggerAlchemist.toDNALogger( null );
}
catch( NullPointerException npe )
{
assertEquals( "npe.getMessage()", "logger", npe.getMessage() );
}
}
public void testAvalonLoggerWithNullLogger()
throws Exception
{
try
{
LoggerAlchemist.toAvalonLogger( null );
}
catch( NullPointerException npe )
{
assertEquals( "npe.getMessage()", "logger", npe.getMessage() );
}
}
}
1.1 spice/sandbox/alchemist/src/test/org/codehaus/spice/alchemist/AvalonLoggerTestCase.java
Index: AvalonLoggerTestCase.java
===================================================================
/*
* Copyright (C) The Spice Group. All rights reserved.
*
* This software is published under the terms of the Spice
* Software License version 1.1, a copy of which has been included
* with this distribution in the LICENSE.txt file.
*/
package org.codehaus.spice.alchemist;
import java.util.logging.Level;
import junit.framework.TestCase;
import org.codehaus.spice.alchemist.impl.AvalonLogger;
import org.jcontainer.dna.impl.Jdk14Logger;
public class AvalonLoggerTestCase
extends TestCase
{
private MockLogger m_mockLogger;
public void testLoggerEmptyCtor()
throws Exception
{
try
{
new AvalonLogger( null );
}
catch( NullPointerException npe )
{
assertEquals( "npe.getMessage()", "logger", npe.getMessage() );
}
}
public void testLoggerGetChildLogger()
throws Exception
{
final AvalonLogger logger = createLogger( Level.FINE );
assertNotSame( "logger.getChildLogger == logger",
logger,
logger.getChildLogger( "whatever" ) );
}
public void testLoggerDebugEnabled()
throws Exception
{
final Level level = Level.ALL;
final Level type = Level.FINE;
final String message = "Meep!";
final Throwable throwable = null;
final boolean output = true;
final AvalonLogger logger = createLogger( level );
logger.debug( message );
checkLogger( output, message, throwable, type );
}
public void testLoggerDebugDisabled()
throws Exception
{
final Level level = Level.OFF;
final String message = "Meep!";
final AvalonLogger logger = createLogger( level );
logger.debug( message );
checkLogger( false, null, null, null );
}
public void testLoggerDebugWithExceptionEnabled()
throws Exception
{
final Level level = Level.ALL;
final Level type = Level.FINE;
final String message = "Meep!";
final Throwable throwable = new Throwable();
final boolean output = true;
final AvalonLogger logger = createLogger( level );
logger.debug( message, throwable );
checkLogger( output, message, throwable, type );
}
public void testLoggerDebugWithExceptionDisabled()
throws Exception
{
final Level level = Level.OFF;
final String message = "Meep!";
final Throwable throwable = new Throwable();
final AvalonLogger logger = createLogger( level );
logger.debug( message, throwable );
checkLogger( false, null, null, null );
}
public void testLoggerInfoEnabled()
throws Exception
{
final Level level = Level.ALL;
final Level type = Level.INFO;
final String message = "Meep!";
final Throwable throwable = null;
final boolean output = true;
final AvalonLogger logger = createLogger( level );
logger.info( message );
checkLogger( output, message, throwable, type );
}
public void testLoggerInfoDisabled()
throws Exception
{
final Level level = Level.OFF;
final String message = "Meep!";
final AvalonLogger logger = createLogger( level );
logger.info( message );
checkLogger( false, null, null, null );
}
public void testLoggerInfoWithExceptionEnabled()
throws Exception
{
final Level level = Level.ALL;
final Level type = Level.INFO;
final String message = "Meep!";
final Throwable throwable = new Throwable();
final boolean output = true;
final AvalonLogger logger = createLogger( level );
logger.info( message, throwable );
checkLogger( output, message, throwable, type );
}
public void testLoggerInfoWithExceptionDisabled()
throws Exception
{
final Level level = Level.OFF;
final String message = "Meep!";
final Throwable throwable = new Throwable();
final AvalonLogger logger = createLogger( level );
logger.info( message, throwable );
checkLogger( false, null, null, null );
}
public void testLoggerWarnEnabled()
throws Exception
{
final Level level = Level.ALL;
final Level type = Level.WARNING;
final String message = "Meep!";
final Throwable throwable = null;
final boolean output = true;
final AvalonLogger logger = createLogger( level );
logger.warn( message );
checkLogger( output, message, throwable, type );
}
public void testLoggerWarnDisabled()
throws Exception
{
final Level level = Level.OFF;
final String message = "Meep!";
final AvalonLogger logger = createLogger( level );
logger.warn( message );
checkLogger( false, null, null, null );
}
public void testLoggerWarnWithExceptionEnabled()
throws Exception
{
final Level level = Level.ALL;
final Level type = Level.WARNING;
final String message = "Meep!";
final Throwable throwable = new Throwable();
final boolean output = true;
final AvalonLogger logger = createLogger( level );
logger.warn( message, throwable );
checkLogger( output, message, throwable, type );
}
public void testLoggerWarnWithExceptionDisabled()
throws Exception
{
final Level level = Level.OFF;
final String message = "Meep!";
final Throwable throwable = new Throwable();
final AvalonLogger logger = createLogger( level );
logger.warn( message, throwable );
checkLogger( false, null, null, null );
}
public void testLoggerErrorEnabled()
throws Exception
{
final Level level = Level.ALL;
final Level type = Level.SEVERE;
final String message = "Meep!";
final Throwable throwable = null;
final boolean output = true;
final AvalonLogger logger = createLogger( level );
logger.error( message );
checkLogger( output, message, throwable, type );
}
public void testLoggerErrorWithExceptionEnabled()
throws Exception
{
final Level level = Level.ALL;
final Level type = Level.SEVERE;
final String message = "Meep!";
final Throwable throwable = new Throwable();
final boolean output = true;
final AvalonLogger logger = createLogger( level );
logger.error( message, throwable );
checkLogger( output, message, throwable, type );
}
public void testLoggerFatalErrorEnabled()
throws Exception
{
final Level level = Level.ALL;
final Level type = Level.SEVERE;
final String message = "Meep!";
final Throwable throwable = null;
final boolean output = true;
final AvalonLogger logger = createLogger( level );
logger.fatalError( message );
checkLogger( output, message, throwable, type );
}
public void testLoggerFatalErrorDisabled()
throws Exception
{
final Level level = Level.OFF;
final String message = "Meep!";
final AvalonLogger logger = createLogger( level );
logger.fatalError( message );
checkLogger( false, null, null, null );
}
public void testLoggerFatalErrorWithExceptionEnabled()
throws Exception
{
final Level level = Level.ALL;
final Level type = Level.SEVERE;
final String message = "Meep!";
final Throwable throwable = new Throwable();
final boolean output = true;
final AvalonLogger logger = createLogger( level );
logger.fatalError( message, throwable );
checkLogger( output, message, throwable, type );
}
public void testLoggerFatalErrorWithExceptionDisabled()
throws Exception
{
final Level level = Level.OFF;
final String message = "Meep!";
final Throwable throwable = new Throwable();
final AvalonLogger logger = createLogger( level );
logger.fatalError( message, throwable );
checkLogger( false, null, null, null );
}
public void testConsoleLevelComparisonWithDebugEnabled()
throws Exception
{
final AvalonLogger logger = createLogger( Level.FINEST );
assertEquals( "logger.isDebugEnabled()", true, logger.isDebugEnabled() );
assertEquals( "logger.isInfoEnabled()", true, logger.isInfoEnabled() );
assertEquals( "logger.isWarnEnabled()", true, logger.isWarnEnabled() );
assertEquals( "logger.isErrorEnabled()", true, logger.isErrorEnabled() );
assertEquals( "logger.isFatalErrorEnabled()", true, logger.isFatalErrorEnabled() );
}
public void testConsoleLevelComparisonWithInfoEnabled()
throws Exception
{
final AvalonLogger logger = createLogger( Level.INFO );
assertEquals( "logger.isDebugEnabled()", false, logger.isDebugEnabled() );
assertEquals( "logger.isInfoEnabled()", true, logger.isInfoEnabled() );
assertEquals( "logger.isWarnEnabled()", true, logger.isWarnEnabled() );
assertEquals( "logger.isErrorEnabled()", true, logger.isErrorEnabled() );
assertEquals( "logger.isFatalErrorEnabled()", true, logger.isFatalErrorEnabled() );
}
public void testConsoleLevelComparisonWithWarnEnabled()
throws Exception
{
final AvalonLogger logger = createLogger( Level.WARNING );
assertEquals( "logger.isDebugEnabled()", false, logger.isDebugEnabled() );
assertEquals( "logger.isInfoEnabled()", false, logger.isInfoEnabled() );
assertEquals( "logger.isWarnEnabled()", true, logger.isWarnEnabled() );
assertEquals( "logger.isErrorEnabled()", true, logger.isErrorEnabled() );
assertEquals( "logger.isFatalErrorEnabled()", true, logger.isFatalErrorEnabled() );
}
public void testConsoleLevelComparisonWithErrorEnabled()
throws Exception
{
final AvalonLogger logger = createLogger( Level.SEVERE );
assertEquals( "logger.isDebugEnabled()", false, logger.isDebugEnabled() );
assertEquals( "logger.isInfoEnabled()", false, logger.isInfoEnabled() );
assertEquals( "logger.isWarnEnabled()", false, logger.isWarnEnabled() );
assertEquals( "logger.isErrorEnabled()", true, logger.isErrorEnabled() );
assertEquals( "logger.isFatalErrorEnabled()", true, logger.isFatalErrorEnabled() );
}
private AvalonLogger createLogger( final Level priority )
{
m_mockLogger = new MockLogger( priority );
return new AvalonLogger( new Jdk14Logger( m_mockLogger ) );
}
private void checkLogger( final boolean output,
final String message,
final Throwable throwable,
final Level priority )
{
assertEquals( "logger.m_message == message", message, m_mockLogger.m_message );
assertEquals( "logger.m_output == output", output, m_mockLogger.m_output );
assertEquals( "logger.m_throwable == throwable", throwable, m_mockLogger.m_throwable );
assertEquals( "logger.m_priority == prioritye", priority, m_mockLogger.m_priority );
}
}
1.1 spice/sandbox/alchemist/src/test/org/codehaus/spice/alchemist/MockLogger.java
Index: MockLogger.java
===================================================================
/*
* Copyright (C) The Spice Group. All rights reserved.
*
* This software is published under the terms of the Spice
* Software License version 1.1, a copy of which has been included
* with this distribution in the LICENSE.txt file.
*/
package org.codehaus.spice.alchemist;
import java.util.logging.Level;
import java.util.logging.LogRecord;
import java.util.logging.Logger;
class MockLogger
extends Logger
{
boolean m_output;
Level m_priority;
String m_message;
Throwable m_throwable;
public MockLogger( final Level level )
{
super( "test", null );
setLevel( level );
}
public void log( final LogRecord record )
{
m_output = true;
m_priority = record.getLevel();
m_message = record.getMessage();
m_throwable = record.getThrown();
}
}
1.1 spice/sandbox/alchemist/src/test/org/codehaus/spice/alchemist/DNALoggerTestCase.java
Index: DNALoggerTestCase.java
===================================================================
/*
* Copyright (C) The Spice Group. All rights reserved.
*
* This software is published under the terms of the Spice
* Software License version 1.1, a copy of which has been included
* with this distribution in the LICENSE.txt file.
*/
package org.codehaus.spice.alchemist;
import java.util.logging.Level;
import junit.framework.TestCase;
import org.apache.avalon.framework.logger.Jdk14Logger;
import org.codehaus.spice.alchemist.impl.DNALogger;
public class DNALoggerTestCase
extends TestCase
{
private MockLogger m_mockLogger;
public void testLoggerEmptyCtor()
throws Exception
{
try
{
new DNALogger( null );
}
catch( NullPointerException npe )
{
assertEquals( "npe.getMessage()", "logger", npe.getMessage() );
}
}
public void testLoggerGetChildLogger()
throws Exception
{
final DNALogger logger = createLogger( Level.FINE );
assertNotSame( "logger.getChildLogger == logger",
logger,
logger.getChildLogger( "whatever" ) );
}
public void testLoggerTraceEnabled()
throws Exception
{
final Level level = Level.ALL;
final Level type = Level.FINE;
final String message = "Meep!";
final Throwable throwable = null;
final boolean output = true;
final DNALogger logger = createLogger( level );
logger.trace( message );
checkLogger( output, message, throwable, type );
}
public void testLoggerTraceDisabled()
throws Exception
{
final Level level = Level.OFF;
final String message = "Meep!";
final DNALogger logger = createLogger( level );
logger.trace( message );
checkLogger( false, null, null, null );
}
public void testLoggerTraceWithExceptionEnabled()
throws Exception
{
final Level level = Level.ALL;
final Level type = Level.FINE;
final String message = "Meep!";
final Throwable throwable = new Throwable();
final boolean output = true;
final DNALogger logger = createLogger( level );
logger.trace( message, throwable );
checkLogger( output, message, throwable, type );
}
public void testLoggerTraceWithExceptionDisabled()
throws Exception
{
final Level level = Level.OFF;
final String message = "Meep!";
final Throwable throwable = new Throwable();
final DNALogger logger = createLogger( level );
logger.trace( message, throwable );
checkLogger( false, null, null, null );
}
public void testLoggerDebugEnabled()
throws Exception
{
final Level level = Level.ALL;
final Level type = Level.FINE;
final String message = "Meep!";
final Throwable throwable = null;
final boolean output = true;
final DNALogger logger = createLogger( level );
logger.debug( message );
checkLogger( output, message, throwable, type );
}
public void testLoggerDebugDisabled()
throws Exception
{
final Level level = Level.OFF;
final String message = "Meep!";
final DNALogger logger = createLogger( level );
logger.debug( message );
checkLogger( false, null, null, null );
}
public void testLoggerDebugWithExceptionEnabled()
throws Exception
{
final Level level = Level.ALL;
final Level type = Level.FINE;
final String message = "Meep!";
final Throwable throwable = new Throwable();
final boolean output = true;
final DNALogger logger = createLogger( level );
logger.debug( message, throwable );
checkLogger( output, message, throwable, type );
}
public void testLoggerDebugWithExceptionDisabled()
throws Exception
{
final Level level = Level.OFF;
final String message = "Meep!";
final Throwable throwable = new Throwable();
final DNALogger logger = createLogger( level );
logger.debug( message, throwable );
checkLogger( false, null, null, null );
}
public void testLoggerInfoEnabled()
throws Exception
{
final Level level = Level.ALL;
final Level type = Level.INFO;
final String message = "Meep!";
final Throwable throwable = null;
final boolean output = true;
final DNALogger logger = createLogger( level );
logger.info( message );
checkLogger( output, message, throwable, type );
}
public void testLoggerInfoDisabled()
throws Exception
{
final Level level = Level.OFF;
final String message = "Meep!";
final DNALogger logger = createLogger( level );
logger.info( message );
checkLogger( false, null, null, null );
}
public void testLoggerInfoWithExceptionEnabled()
throws Exception
{
final Level level = Level.ALL;
final Level type = Level.INFO;
final String message = "Meep!";
final Throwable throwable = new Throwable();
final boolean output = true;
final DNALogger logger = createLogger( level );
logger.info( message, throwable );
checkLogger( output, message, throwable, type );
}
public void testLoggerInfoWithExceptionDisabled()
throws Exception
{
final Level level = Level.OFF;
final String message = "Meep!";
final Throwable throwable = new Throwable();
final DNALogger logger = createLogger( level );
logger.info( message, throwable );
checkLogger( false, null, null, null );
}
public void testLoggerWarnEnabled()
throws Exception
{
final Level level = Level.ALL;
final Level type = Level.WARNING;
final String message = "Meep!";
final Throwable throwable = null;
final boolean output = true;
final DNALogger logger = createLogger( level );
logger.warn( message );
checkLogger( output, message, throwable, type );
}
public void testLoggerWarnDisabled()
throws Exception
{
final Level level = Level.OFF;
final String message = "Meep!";
final DNALogger logger = createLogger( level );
logger.warn( message );
checkLogger( false, null, null, null );
}
public void testLoggerWarnWithExceptionEnabled()
throws Exception
{
final Level level = Level.ALL;
final Level type = Level.WARNING;
final String message = "Meep!";
final Throwable throwable = new Throwable();
final boolean output = true;
final DNALogger logger = createLogger( level );
logger.warn( message, throwable );
checkLogger( output, message, throwable, type );
}
public void testLoggerWarnWithExceptionDisabled()
throws Exception
{
final Level level = Level.OFF;
final String message = "Meep!";
final Throwable throwable = new Throwable();
final DNALogger logger = createLogger( level );
logger.warn( message, throwable );
checkLogger( false, null, null, null );
}
public void testLoggerErrorEnabled()
throws Exception
{
final Level level = Level.ALL;
final Level type = Level.SEVERE;
final String message = "Meep!";
final Throwable throwable = null;
final boolean output = true;
final DNALogger logger = createLogger( level );
logger.error( message );
checkLogger( output, message, throwable, type );
}
public void testLoggerErrorWithExceptionEnabled()
throws Exception
{
final Level level = Level.ALL;
final Level type = Level.SEVERE;
final String message = "Meep!";
final Throwable throwable = new Throwable();
final boolean output = true;
final DNALogger logger = createLogger( level );
logger.error( message, throwable );
checkLogger( output, message, throwable, type );
}
public void testConsoleLevelComparisonWithDebugEnabled()
throws Exception
{
final DNALogger logger = createLogger( Level.FINEST );
assertEquals( "logger.isTraceEnabled()", true, logger.isTraceEnabled() );
assertEquals( "logger.isDebugEnabled()", true, logger.isDebugEnabled() );
assertEquals( "logger.isInfoEnabled()", true, logger.isInfoEnabled() );
assertEquals( "logger.isWarnEnabled()", true, logger.isWarnEnabled() );
assertEquals( "logger.isErrorEnabled()", true, logger.isErrorEnabled() );
}
public void testConsoleLevelComparisonWithInfoEnabled()
throws Exception
{
final DNALogger logger = createLogger( Level.INFO );
assertEquals( "logger.isTraceEnabled()", false, logger.isTraceEnabled() );
assertEquals( "logger.isDebugEnabled()", false, logger.isDebugEnabled() );
assertEquals( "logger.isInfoEnabled()", true, logger.isInfoEnabled() );
assertEquals( "logger.isWarnEnabled()", true, logger.isWarnEnabled() );
assertEquals( "logger.isErrorEnabled()", true, logger.isErrorEnabled() );
}
public void testConsoleLevelComparisonWithWarnEnabled()
throws Exception
{
final DNALogger logger = createLogger( Level.WARNING );
assertEquals( "logger.isTraceEnabled()", false, logger.isTraceEnabled() );
assertEquals( "logger.isDebugEnabled()", false, logger.isDebugEnabled() );
assertEquals( "logger.isInfoEnabled()", false, logger.isInfoEnabled() );
assertEquals( "logger.isWarnEnabled()", true, logger.isWarnEnabled() );
assertEquals( "logger.isErrorEnabled()", true, logger.isErrorEnabled() );
}
public void testConsoleLevelComparisonWithErrorEnabled()
throws Exception
{
final DNALogger logger = createLogger( Level.SEVERE );
assertEquals( "logger.isTraceEnabled()", false, logger.isTraceEnabled() );
assertEquals( "logger.isDebugEnabled()", false, logger.isDebugEnabled() );
assertEquals( "logger.isInfoEnabled()", false, logger.isInfoEnabled() );
assertEquals( "logger.isWarnEnabled()", false, logger.isWarnEnabled() );
assertEquals( "logger.isErrorEnabled()", true, logger.isErrorEnabled() );
}
private DNALogger createLogger( final Level priority )
{
m_mockLogger = new MockLogger( priority );
return new DNALogger( new Jdk14Logger( m_mockLogger ) );
}
private void checkLogger( final boolean output,
final String message,
final Throwable throwable,
final Level priority )
{
assertEquals( "logger.m_message == message", message, m_mockLogger.m_message );
assertEquals( "logger.m_output == output", output, m_mockLogger.m_output );
assertEquals( "logger.m_throwable == throwable", throwable, m_mockLogger.m_throwable );
assertEquals( "logger.m_priority == priority", priority, m_mockLogger.m_priority );
}
}
1.1 spice/sandbox/alchemist/src/java/org/codehaus/spice/alchemist/impl/DNALogger.java
Index: DNALogger.java
===================================================================
/*
* Copyright (C) The Spice Group. All rights reserved.
*
* This software is published under the terms of the Spice
* Software License version 1.1, a copy of which has been included
* with this distribution in the LICENSE.txt file.
*/
package org.codehaus.spice.alchemist.impl;
import org.jcontainer.dna.Logger;
/**
* DNA Logger facade implementation for the Avalon Logger.
* The following lists the mapping between DNA log levels
* and Avalon log levels.
*
* <ul>
* <li>trace ==> debug</li>
* <li>debug ==> debug</li>
* <li>info ==> info</li>
* <li>warn ==> warn</li>
* <li>error ==> error</li>
* </ul>
*
* @version $Revision: 1.1 $ $Date: 2003/11/20 11:01:20 $
*/
public class DNALogger
implements Logger
{
/**
* The Avalon logger.
*/
private final org.apache.avalon.framework.logger.Logger m_logger;
/**
* Create an instance of logger facade.
*
* @param logger the Avalon Logger
*/
public DNALogger( final org.apache.avalon.framework.logger.Logger logger )
{
if( null == logger )
{
throw new NullPointerException( "logger" );
}
m_logger = logger;
}
/**
* Log a trace message.
*
* @param message the message
*/
public void trace( final String message )
{
m_logger.debug( message );
}
/**
* Log a trace message with an associated throwable.
*
* @param message the message
* @param throwable the throwable
*/
public void trace( final String message,
final Throwable throwable )
{
m_logger.debug( message, throwable );
}
/**
* Return true if a trace message will be logged.
*
* @return true if message will be logged
*/
public boolean isTraceEnabled()
{
return m_logger.isDebugEnabled();
}
/**
* Log a debug message.
*
* @param message the message
*/
public void debug( final String message )
{
m_logger.debug( message );
}
/**
* Log a debug message with an associated throwable.
*
* @param message the message
* @param throwable the throwable
*/
public void debug( final String message,
final Throwable throwable )
{
m_logger.debug( message, throwable );
}
/**
* Return true if a debug message will be logged.
*
* @return true if message will be logged
*/
public boolean isDebugEnabled()
{
return m_logger.isDebugEnabled();
}
/**
* Log a info message.
*
* @param message the message
*/
public void info( final String message )
{
m_logger.info( message );
}
/**
* Log a info message with an associated throwable.
*
* @param message the message
* @param throwable the throwable
*/
public void info( final String message,
final Throwable throwable )
{
m_logger.info( message, throwable );
}
/**
* Return true if an info message will be logged.
*
* @return true if message will be logged
*/
public boolean isInfoEnabled()
{
return m_logger.isInfoEnabled();
}
/**
* Log a warn message.
*
* @param message the message
*/
public void warn( final String message )
{
m_logger.warn( message );
}
/**
* Log a warn message with an associated throwable.
*
* @param message the message
* @param throwable the throwable
*/
public void warn( final String message,
final Throwable throwable )
{
m_logger.warn( message, throwable );
}
/**
* Return true if a warn message will be logged.
*
* @return true if message will be logged
*/
public boolean isWarnEnabled()
{
return m_logger.isWarnEnabled();
}
/**
* Log a error message.
*
* @param message the message
*/
public void error( final String message )
{
m_logger.error( message );
}
/**
* Log a error message with an associated throwable.
*
* @param message the message
* @param throwable the throwable
*/
public void error( final String message,
final Throwable throwable )
{
m_logger.error( message, throwable );
}
/**
* Return true if a error message will be logged.
*
* @return true if message will be logged
*/
public boolean isErrorEnabled()
{
return m_logger.isErrorEnabled();
}
/**
* Get the child logger with specified name.
*
* @param name the name of child logger
* @return the child logger
*/
public Logger getChildLogger( final String name )
{
return new DNALogger( m_logger.getChildLogger( name ) );
}
}
1.1 spice/sandbox/alchemist/src/java/org/codehaus/spice/alchemist/impl/AvalonLogger.java
Index: AvalonLogger.java
===================================================================
/*
* Copyright (C) The Spice Group. All rights reserved.
*
* This software is published under the terms of the Spice
* Software License version 1.1, a copy of which has been included
* with this distribution in the LICENSE.txt file.
*/
package org.codehaus.spice.alchemist.impl;
import org.apache.avalon.framework.logger.Logger;
/**
* Avalon Logger facade implementation for the DNA Logger.
* The following lists the mapping between Avalon log levels
* and DNA log levels.
*
* <ul>
* <li>debug ==> debug</li>
* <li>info ==> info</li>
* <li>warn ==> warn</li>
* <li>error ==> error</li>
* <li>fatalError ==> error</li>
* </ul>
*
* @version $Revision: 1.1 $ $Date: 2003/11/20 11:01:20 $
*/
public class AvalonLogger
implements Logger
{
/**
* The DNA logger.
*/
private final org.jcontainer.dna.Logger m_logger;
/**
* Create an instance of logger facade.
*
* @param logger the DNA logger
*/
public AvalonLogger( final org.jcontainer.dna.Logger logger )
{
if( null == logger )
{
throw new NullPointerException( "logger" );
}
m_logger = logger;
}
/**
* Log a debug message.
*
* @param message the message
*/
public void debug( final String message )
{
m_logger.debug( message );
}
/**
* Log a debug message with an associated throwable.
*
* @param message the message
* @param throwable the throwable
*/
public void debug( final String message,
final Throwable throwable )
{
m_logger.debug( message, throwable );
}
/**
* Return true if a debug message will be logged.
*
* @return true if message will be logged
*/
public boolean isDebugEnabled()
{
return m_logger.isDebugEnabled();
}
/**
* Log a info message.
*
* @param message the message
*/
public void info( final String message )
{
m_logger.info( message );
}
/**
* Log a info message with an associated throwable.
*
* @param message the message
* @param throwable the throwable
*/
public void info( final String message,
final Throwable throwable )
{
m_logger.info( message, throwable );
}
/**
* Return true if an info message will be logged.
*
* @return true if message will be logged
*/
public boolean isInfoEnabled()
{
return m_logger.isInfoEnabled();
}
/**
* Log a warn message.
*
* @param message the message
*/
public void warn( final String message )
{
m_logger.warn( message );
}
/**
* Log a warn message with an associated throwable.
*
* @param message the message
* @param throwable the throwable
*/
public void warn( final String message,
final Throwable throwable )
{
m_logger.warn( message, throwable );
}
/**
* Return true if a warn message will be logged.
*
* @return true if message will be logged
*/
public boolean isWarnEnabled()
{
return m_logger.isWarnEnabled();
}
/**
* Log a error message.
*
* @param message the message
*/
public void error( final String message )
{
m_logger.error( message );
}
/**
* Log a error message with an associated throwable.
*
* @param message the message
* @param throwable the throwable
*/
public void error( final String message,
final Throwable throwable )
{
m_logger.error( message, throwable );
}
/**
* Return true if a error message will be logged.
*
* @return true if message will be logged
*/
public boolean isErrorEnabled()
{
return m_logger.isErrorEnabled();
}
/**
* Log a fatal error message.
*
* @param message the message
*/
public void fatalError( final String message )
{
m_logger.error( message );
}
/**
* Log a fatal error message with an associated throwable.
*
* @param message the message
* @param throwable the throwable
*/
public void fatalError( final String message,
final Throwable throwable )
{
m_logger.error( message, throwable );
}
/**
* Return true if a fatal error message will be logged.
*
* @return true if message will be logged
*/
public boolean isFatalErrorEnabled()
{
return m_logger.isErrorEnabled();
}
/**
* Get the child logger with specified name.
*
* @param name the name of child logger
* @return the child logger
*/
public Logger getChildLogger( final String name )
{
return new AvalonLogger( m_logger.getChildLogger( name ) );
}
}
1.2 +1 -1 spice/sandbox/alchemist/xdocs/index.xml
Index: index.xml
===================================================================
RCS file: /scm/cvs/spice/sandbox/alchemist/xdocs/index.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- index.xml 25 Oct 2003 13:31:44 -0000 1.1
+++ index.xml 20 Nov 2003 11:01:20 -0000 1.2
@@ -18,7 +18,7 @@
<section name="Logger">
<p>
- <a href="apidocs/org/jcomponent/alchemist/LoggerAlchemist.html">
+ <a href="apidocs/org/codehaus/spice/alchemist/LoggerAlchemist.html">
LoggerAlchemist</a> provides transformation methods between loggers
in the DNA and Avalon frameworks.
</p>
1.1 spice/sandbox/alchemist/src/java/org/codehaus/spice/alchemist/LoggerAlchemist.java
Index: LoggerAlchemist.java
===================================================================
/*
* Copyright (C) The Spice Group. All rights reserved.
*
* This software is published under the terms of the Spice
* Software License version 1.1, a copy of which has been included
* with this distribution in the LICENSE.txt file.
*/
package org.codehaus.spice.alchemist;
import org.codehaus.spice.alchemist.impl.AvalonLogger;
import org.codehaus.spice.alchemist.impl.DNALogger;
import org.jcontainer.dna.Logger;
/**
* Utility class containing methods to transform Logger objects.
*
* @author <a href="mailto:mauro.talevi at aquilonia.org">Mauro Talevi</a>
* @version $Revision: 1.1 $ $Date: 2003/11/20 11:01:20 $
*/
public class LoggerAlchemist
{
/**
* Convert Avalon Logger to DNA Logger
*
* @param logger the Avalon Logger
* @return the DNA Logger
*/
public static Logger toDNALogger( final org.apache.avalon.framework.logger.Logger logger )
{
return new DNALogger( logger );
}
/**
* Convert DNA Logger to Avalon Logger
*
* @param logger the DNA Logger
* @return the Avalon Logger
*/
public static org.apache.avalon.framework.logger.Logger toAvalonLogger( final Logger logger )
{
return new AvalonLogger( logger );
}
}
1.3 +2 -4 spice/sandbox/alchemist/project.xml
Index: project.xml
===================================================================
RCS file: /scm/cvs/spice/sandbox/alchemist/project.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- project.xml 25 Oct 2003 14:00:52 -0000 1.2
+++ project.xml 20 Nov 2003 11:01:20 -0000 1.3
@@ -2,11 +2,9 @@
<project>
<extend>${basedir}/../../tools/maven/project.xml</extend>
<name>Alchemist</name>
- <groupId>jcomponent</groupId>
- <id>jcomponent-alchemist</id>
+ <id>spice-alchemist</id>
<gumpRepositoryId>sandbox</gumpRepositoryId>
- <package>org.jcomponent.alchemist</package>
- <siteDirectory>/home/groups/s/sp/spice/htdocs/alchemist</siteDirectory>
+ <package>org.codehaus.spice.alchemist</package>
<currentVersion>1.0-dev</currentVersion>
<inceptionYear>2003</inceptionYear>