[CVS spice] Moved logger classes to alchemist.logger package.
mauro-yCVjj/[email protected] 13 Jun 2004 13:35:14 -0000
| Newsgroups | gmane.comp.java.spice.cvs |
|---|---|
| Message-ID | <[email protected]> |
Commit in spice/components/alchemist on MAIN
src/java/org/codehaus/spice/alchemist/instrument/InstrumentAlchemist.java +30 added 1.1
/DNAInstrumentManager.java +96 added 1.1
project.xml +11 -1 1.3 -> 1.4
src/java/org/codehaus/spice/alchemist/logger/AvalonLogger.java +219 added 1.1
/LoggerAlchemist.java +41 added 1.1
/DNALogger.java +219 added 1.1
src/test/org/codehaus/spice/alchemist/logger/LoggerAlchemistTestCase.java +43 added 1.1
/MockLogger.java +35 added 1.1
/DNALoggerTestCase.java +341 added 1.1
/AvalonLoggerTestCase.java +342 added 1.1
src/test/org/codehaus/spice/alchemist/MockLogger.java -35 1.1 removed
/AvalonLoggerTestCase.java -345 1.1 removed
/LoggerAlchemistTestCase.java -43 1.1 removed
/DNALoggerTestCase.java -344 1.1 removed
src/java/org/codehaus/spice/alchemist/impl/DNALogger.java -219 1.1 removed
/AvalonLogger.java -219 1.1 removed
src/java/org/codehaus/spice/alchemist/configuration/ConfigurationAlchemist.java +41 added 1.1
/AvalonConfiguration.java +295 added 1.1
/DNAConfiguration.java +299 added 1.1
src/java/org/codehaus/spice/alchemist/LoggerAlchemist.java -43 1.1 removed
+2012 -1249
12 added + 7 removed + 1 modified, total 20 files
Moved logger classes to alchemist.logger package.
Added configuration and instrument packages.
----------
spice/components/alchemist/src/java/org/codehaus/spice/alchemist/instrument
InstrumentAlchemist.java added at 1.1
diff -N InstrumentAlchemist.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ InstrumentAlchemist.java 13 Jun 2004 13:35:13 -0000 1.1
@@ -0,0 +1,30 @@
+/*
+ * 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.instrument;
+
+import org.apache.excalibur.instrument.InstrumentManager;
+import org.apache.excalibur.instrument.manager.DefaultInstrumentManager;
+
+/**
+ * Utility class containing methods to transform Instrument objects.
+ *
+ * @author Mauro Talevi
+ * @version $Revision: 1.1 $ $Date: 2004/06/13 13:35:13 $
+ */
+public class InstrumentAlchemist
+{
+ /**
+ * Convert Excalibur DefaultInstrumentManager to use DNA lifecycle methods
+ *
+ * @param manager the Excalibur DefaultInstrumentManager
+ * @return An InstrumentManager object
+ */
+ public static InstrumentManager toDNAInstrumentManager( final DefaultInstrumentManager manager )
+ {
+ return new DNAInstrumentManager(manager);
+ }
+
+}
----------
spice/components/alchemist/src/java/org/codehaus/spice/alchemist/instrument
DNAInstrumentManager.java added at 1.1
diff -N DNAInstrumentManager.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ DNAInstrumentManager.java 13 Jun 2004 13:35:14 -0000 1.1
@@ -0,0 +1,96 @@
+/*
+ * Copyright (C) The Loom Group. All rights reserved.
+ *
+ * This software is published under the terms of the Loom
+ * 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.instrument;
+
+import org.apache.excalibur.instrument.InstrumentManager;
+import org.apache.excalibur.instrument.Instrumentable;
+import org.apache.excalibur.instrument.manager.DefaultInstrumentManager;
+import org.codehaus.dna.Active;
+import org.codehaus.dna.Configurable;
+import org.codehaus.dna.Configuration;
+import org.codehaus.dna.ConfigurationException;
+import org.codehaus.dna.LogEnabled;
+import org.codehaus.dna.Logger;
+import org.codehaus.spice.alchemist.configuration.ConfigurationAlchemist;
+import org.codehaus.spice.alchemist.logger.LoggerAlchemist;
+
+
+/**
+ * DNA facade for the Excalibur <code>DefaultInstrumentManager</code>
+ *
+ * @author Johan Sjoberg
+ * @author Mauro Talevi
+ * @version $Revision: 1.1 $ $Date: 2004/06/13 13:35:14 $
+ */
+public class DNAInstrumentManager
+ implements InstrumentManager, LogEnabled, Configurable, Active
+{
+
+ /** The Excalibur DefaultInstrumentManager */
+ private final DefaultInstrumentManager _manager;
+
+ /**
+ * Create a DNAInstrumentManager
+ *
+ * @param manager the Excalibur DefaultInstrumentManager
+ */
+ public DNAInstrumentManager( final DefaultInstrumentManager manager )
+ {
+ _manager = manager;
+ }
+
+ /**
+ * @see LogEnabled#enableLogging(Logger)
+ */
+ public void enableLogging( Logger logger )
+ {
+ _manager.enableLogging( LoggerAlchemist.toAvalonLogger( logger ) );
+ }
+
+
+ /**
+ * @see Configurable#configure(Configuration)
+ */
+ public void configure( Configuration configuration ) throws ConfigurationException
+ {
+ try
+ {
+ _manager.configure( ConfigurationAlchemist.toAvalonConfiguration( configuration ) );
+ }
+ catch( Exception e )
+ {
+ throw new ConfigurationException( e.getMessage(), e );
+ }
+ }
+
+
+ /**
+ * @see org.codehaus.dna.Active#initialize()
+ */
+ public void initialize() throws Exception
+ {
+ _manager.initialize();
+ }
+
+
+ /**
+ * @see org.codehaus.dna.Active#dispose()
+ */
+ public void dispose()
+ {
+ _manager.dispose();
+ }
+
+
+ /**
+ * @see org.apache.excalibur.instrument.InstrumentManager#registerInstrumentable(org.apache.excalibur.instrument.Instrumentable, java.lang.String)
+ */
+ public void registerInstrumentable( Instrumentable arg0, String arg1 ) throws Exception {
+ _manager.registerInstrumentable( arg0, arg1 );
+ }
+}
----------
spice/components/alchemist
project.xml 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- project.xml 5 May 2004 22:59:01 -0000 1.3
+++ project.xml 13 Jun 2004 13:35:14 -0000 1.4
@@ -4,7 +4,7 @@
<name>Spice Alchemist</name>
<id>spice-alchemist</id>
<package>org.codehaus.spice.alchemist</package>
- <currentVersion>1.1</currentVersion>
+ <currentVersion>1.2-dev</currentVersion>
<inceptionYear>2003</inceptionYear>
<shortDescription>
@@ -41,6 +41,16 @@
<artifactId>dna-api</artifactId>
<version>1.1</version>
</dependency>
+ <dependency>
+ <groupId>excalibur-instrument</groupId>
+ <artifactId>excalibur-instrument</artifactId>
+ <version>1.2</version>
+ </dependency>
+ <dependency>
+ <groupId>excalibur-instrument</groupId>
+ <artifactId>excalibur-instrument-impl</artifactId>
+ <version>1.2</version>
+ </dependency>
<dependency> <!-- for unit test -->
<groupId>dna</groupId>
<artifactId>dna-impl</artifactId>
----------
spice/components/alchemist/src/java/org/codehaus/spice/alchemist/logger
AvalonLogger.java added at 1.1
diff -N AvalonLogger.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ AvalonLogger.java 13 Jun 2004 13:35:14 -0000 1.1
@@ -0,0 +1,219 @@
+/*
+ * 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.logger;
+
+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: 2004/06/13 13:35:14 $
+ */
+public class AvalonLogger
+ implements Logger
+{
+ /**
+ * The DNA logger.
+ */
+ private final org.codehaus.dna.Logger m_logger;
+
+ /**
+ * Create an instance of logger facade.
+ *
+ * @param logger the DNA logger
+ */
+ public AvalonLogger( final org.codehaus.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 ) );
+ }
+}
----------
spice/components/alchemist/src/java/org/codehaus/spice/alchemist/logger
LoggerAlchemist.java added at 1.1
diff -N LoggerAlchemist.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ LoggerAlchemist.java 13 Jun 2004 13:35:14 -0000 1.1
@@ -0,0 +1,41 @@
+/*
+ * 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.logger;
+
+import org.codehaus.dna.Logger;
+
+/**
+ * Utility class containing methods to transform Logger objects.
+ *
+ * @author Mauro Talevi
+ * @version $Revision: 1.1 $ $Date: 2004/06/13 13:35:14 $
+ */
+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 );
+ }
+}
----------
spice/components/alchemist/src/java/org/codehaus/spice/alchemist/logger
DNALogger.java added at 1.1
diff -N DNALogger.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ DNALogger.java 13 Jun 2004 13:35:14 -0000 1.1
@@ -0,0 +1,219 @@
+/*
+ * 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.logger;
+
+import org.codehaus.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: 2004/06/13 13:35:14 $
+ */
+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 ) );
+ }
+}
----------
spice/components/alchemist/src/test/org/codehaus/spice/alchemist/logger
LoggerAlchemistTestCase.java added at 1.1
diff -N LoggerAlchemistTestCase.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ LoggerAlchemistTestCase.java 13 Jun 2004 13:35:14 -0000 1.1
@@ -0,0 +1,43 @@
+/*
+ * 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.logger;
+
+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() );
+ }
+ }
+
+}
\ No newline at end of file
----------
spice/components/alchemist/src/test/org/codehaus/spice/alchemist/logger
MockLogger.java added at 1.1
diff -N MockLogger.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ MockLogger.java 13 Jun 2004 13:35:14 -0000 1.1
@@ -0,0 +1,35 @@
+/*
+ * 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.logger;
+
+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();
+ }
+}
----------
spice/components/alchemist/src/test/org/codehaus/spice/alchemist/logger
DNALoggerTestCase.java added at 1.1
diff -N DNALoggerTestCase.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ DNALoggerTestCase.java 13 Jun 2004 13:35:14 -0000 1.1
@@ -0,0 +1,341 @@
+/*
+ * 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.logger;
+
+import java.util.logging.Level;
+import junit.framework.TestCase;
+import org.apache.avalon.framework.logger.Jdk14Logger;
+
+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 );
+ }
+}
----------
spice/components/alchemist/src/test/org/codehaus/spice/alchemist/logger
AvalonLoggerTestCase.java added at 1.1
diff -N AvalonLoggerTestCase.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ AvalonLoggerTestCase.java 13 Jun 2004 13:35:14 -0000 1.1
@@ -0,0 +1,342 @@
+/*
+ * 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.logger;
+
+import java.util.logging.Level;
+import junit.framework.TestCase;
+import org.codehaus.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 );
+ }
+}
----------
spice/components/alchemist/src/test/org/codehaus/spice/alchemist
MockLogger.java removed after 1.1
diff -N MockLogger.java
--- MockLogger.java 24 Apr 2004 11:23:32 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,35 +0,0 @@
-/*
- * 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();
- }
-}
----------
spice/components/alchemist/src/test/org/codehaus/spice/alchemist
AvalonLoggerTestCase.java removed after 1.1
diff -N AvalonLoggerTestCase.java
--- AvalonLoggerTestCase.java 24 Apr 2004 11:23:32 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,345 +0,0 @@
-/*
- * 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.codehaus.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 );
- }
-}
----------
spice/components/alchemist/src/test/org/codehaus/spice/alchemist
LoggerAlchemistTestCase.java removed after 1.1
diff -N LoggerAlchemistTestCase.java
--- LoggerAlchemistTestCase.java 24 Apr 2004 11:23:32 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,43 +0,0 @@
-/*
- * 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() );
- }
- }
-
-}
\ No newline at end of file
----------
spice/components/alchemist/src/test/org/codehaus/spice/alchemist
DNALoggerTestCase.java removed after 1.1
diff -N DNALoggerTestCase.java
--- DNALoggerTestCase.java 24 Apr 2004 11:23:32 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,344 +0,0 @@
-/*
- * 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 );
- }
-}
----------
spice/components/alchemist/src/java/org/codehaus/spice/alchemist/impl
DNALogger.java removed after 1.1
diff -N DNALogger.java
--- DNALogger.java 24 Apr 2004 11:23:32 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,219 +0,0 @@
-/*
- * 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.codehaus.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: 2004/04/24 11:23:32 $
- */
-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 ) );
- }
-}
----------
spice/components/alchemist/src/java/org/codehaus/spice/alchemist/impl
AvalonLogger.java removed after 1.1
diff -N AvalonLogger.java
--- AvalonLogger.java 24 Apr 2004 11:23:32 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,219 +0,0 @@
-/*
- * 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: 2004/04/24 11:23:32 $
- */
-public class AvalonLogger
- implements Logger
-{
- /**
- * The DNA logger.
- */
- private final org.codehaus.dna.Logger m_logger;
-
- /**
- * Create an instance of logger facade.
- *
- * @param logger the DNA logger
- */
- public AvalonLogger( final org.codehaus.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 ) );
- }
-}
----------
spice/components/alchemist/src/java/org/codehaus/spice/alchemist/configuration
ConfigurationAlchemist.java added at 1.1
diff -N ConfigurationAlchemist.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ConfigurationAlchemist.java 13 Jun 2004 13:35:14 -0000 1.1
@@ -0,0 +1,41 @@
+/*
+ * 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.configuration;
+
+import org.codehaus.dna.Configuration;
+
+/**
+ * Utility class containing methods to transform Configuration objects.
+ *
+ * @author Mauro Talevi
+ * @version $Revision: 1.1 $ $Date: 2004/06/13 13:35:14 $
+ */
+public class ConfigurationAlchemist
+{
+ /**
+ * Convert Avalon Configuration to DNA Configuration
+ *
+ * @param configuration the Avalon Configuration
+ * @return the DNA Configuration
+ */
+ public static Configuration toDNAConfiguration( final org.apache.avalon.framework.configuration.Configuration configuration )
+ {
+ return new DNAConfiguration( configuration );
+ }
+
+ /**
+ * Convert DNA Configuration to Avalon Configuration
+ *
+ * @param configuration the DNA Configuration
+ * @return the Avalon Configuration
+ */
+ public static org.apache.avalon.framework.configuration.Configuration toAvalonConfiguration( final Configuration configuration )
+ {
+ return new AvalonConfiguration( configuration );
+ }
+}
----------
spice/components/alchemist/src/java/org/codehaus/spice/alchemist/configuration
AvalonConfiguration.java added at 1.1
diff -N AvalonConfiguration.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ AvalonConfiguration.java 13 Jun 2004 13:35:14 -0000 1.1
@@ -0,0 +1,295 @@
+/*
+ * 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.configuration;
+
+import org.apache.avalon.framework.configuration.Configuration;
+import org.apache.avalon.framework.configuration.ConfigurationException;
+import org.apache.avalon.framework.configuration.DefaultConfiguration;
+
+/**
+ * Avalon Configuration facade implementation for the DNA Configuration.
+ *
+ * @author Mauro Talevi
+ * @version $Revision: 1.1 $ $Date: 2004/06/13 13:35:14 $
+ */
+public class AvalonConfiguration implements Configuration {
+
+ /**
+ * The DNA Configuration.
+ */
+ private final org.codehaus.dna.Configuration _configuration;
+
+ /**
+ * Create an instance of configuration facade.
+ *
+ * @param configuration
+ */
+ public AvalonConfiguration(
+ final org.codehaus.dna.Configuration configuration ) {
+ _configuration = configuration;
+ }
+
+ /**
+ * @see org.apache.avalon.framework.configuration.Configuration#getName()
+ */
+ public String getName() {
+ return _configuration.getName();
+ }
+
+ /**
+ * @see org.apache.avalon.framework.configuration.Configuration#getLocation()
+ */
+ public String getLocation() {
+ return _configuration.getLocation();
+ }
+
+ /**
+ * @see org.apache.avalon.framework.configuration.Configuration#getNamespace()
+ */
+ public String getNamespace() throws ConfigurationException {
+ throw new ConfigurationException("Method not supported by "+_configuration.getClass().getName());
+ }
+
+ /**
+ * @see org.apache.avalon.framework.configuration.Configuration#getChild(java.lang.String)
+ */
+ public Configuration getChild( String arg0 ) {
+ return new AvalonConfiguration( _configuration.getChild( arg0 ) );
+ }
+
+ /**
+ * @see org.apache.avalon.framework.configuration.Configuration#getChild(java.lang.String,
+ * boolean)
+ */
+ public Configuration getChild( String arg0, boolean arg1 ) {
+ return new AvalonConfiguration( _configuration.getChild( arg0, arg1 ) );
+ }
+
+ /**
+ * @see org.apache.avalon.framework.configuration.Configuration#getChildren()
+ */
+ public Configuration[] getChildren() {
+ final DefaultConfiguration result = new DefaultConfiguration(
+ _configuration.getName(), _configuration.getLocation() );
+ final org.codehaus.dna.Configuration[] children = _configuration
+ .getChildren();
+ for ( int i = 0; i < children.length; i++ ) {
+ final Configuration child = new AvalonConfiguration( children[i] );
+ result.addChild( child );
+ }
+ return result.getChildren();
+ }
+
+ /**
+ * @see org.apache.avalon.framework.configuration.Configuration#getChildren(java.lang.String)
+ */
+ public Configuration[] getChildren( String arg0 ) {
+ final DefaultConfiguration result = new DefaultConfiguration(
+ _configuration.getName(), _configuration.getLocation() );
+ final org.codehaus.dna.Configuration[] children = _configuration
+ .getChildren( arg0 );
+ for ( int i = 0; i < children.length; i++ ) {
+ final Configuration child = new AvalonConfiguration( children[i] );
+ result.addChild( child );
+ }
+ return result.getChildren();
+ }
+
+ /**
+ * @see org.apache.avalon.framework.configuration.Configuration#getAttributeNames()
+ */
+ public String[] getAttributeNames() {
+ return _configuration.getAttributeNames();
+ }
+
+ /**
+ * @see org.apache.avalon.framework.configuration.Configuration#getAttribute(java.lang.String)
+ */
+ public String getAttribute( String arg0 ) throws ConfigurationException {
+ try {
+ return _configuration.getAttribute( arg0 );
+ } catch ( org.codehaus.dna.ConfigurationException e ) {
+ throw new ConfigurationException( e.getMessage() );
+ }
+ }
+
+ /**
+ * @see org.apache.avalon.framework.configuration.Configuration#getAttributeAsInteger(java.lang.String)
+ */
+ public int getAttributeAsInteger( String arg0 )
+ throws ConfigurationException {
+ try {
+ return _configuration.getAttributeAsInteger( arg0 );
+ } catch ( org.codehaus.dna.ConfigurationException e ) {
+ throw new ConfigurationException( e.getMessage() );
+ }
+ }
+
+ /**
+ * @see org.apache.avalon.framework.configuration.Configuration#getAttributeAsLong(java.lang.String)
+ */
+ public long getAttributeAsLong( String arg0 ) throws ConfigurationException {
+ try {
+ return _configuration.getAttributeAsLong( arg0 );
+ } catch ( org.codehaus.dna.ConfigurationException e ) {
+ throw new ConfigurationException( e.getMessage() );
+ }
+ }
+
+ /**
+ * @see org.apache.avalon.framework.configuration.Configuration#getAttributeAsFloat(java.lang.String)
+ */
+ public float getAttributeAsFloat( String arg0 )
+ throws ConfigurationException {
+ try {
+ return _configuration.getAttributeAsFloat( arg0 );
+ } catch ( org.codehaus.dna.ConfigurationException e ) {
+ throw new ConfigurationException( e.getMessage() );
+ }
+ }
+
+ /**
+ * @see org.apache.avalon.framework.configuration.Configuration#getAttributeAsBoolean(java.lang.String)
+ */
+ public boolean getAttributeAsBoolean( String arg0 )
+ throws ConfigurationException {
+ try {
+ return _configuration.getAttributeAsBoolean( arg0 );
+ } catch ( org.codehaus.dna.ConfigurationException e ) {
+ throw new ConfigurationException( e.getMessage() );
+ }
+ }
+
+ /**
+ * @see org.apache.avalon.framework.configuration.Configuration#getValue()
+ */
+ public String getValue() throws ConfigurationException {
+ try {
+ return _configuration.getValue();
+ } catch ( org.codehaus.dna.ConfigurationException e ) {
+ throw new ConfigurationException( e.getMessage() );
+ }
+ }
+
+ /**
+ * @see org.apache.avalon.framework.configuration.Configuration#getValueAsInteger()
+ */
+ public int getValueAsInteger() throws ConfigurationException {
+ try {
+ return _configuration.getValueAsInteger();
+ } catch ( org.codehaus.dna.ConfigurationException e ) {
+ throw new ConfigurationException( e.getMessage() );
+ }
+ }
+
+ /**
+ * @see org.apache.avalon.framework.configuration.Configuration#getValueAsFloat()
+ */
+ public float getValueAsFloat() throws ConfigurationException {
+ try {
+ return _configuration.getValueAsFloat();
+ } catch ( org.codehaus.dna.ConfigurationException e ) {
+ throw new ConfigurationException( e.getMessage() );
+ }
+ }
+
+ /**
+ * @see org.apache.avalon.framework.configuration.Configuration#getValueAsBoolean()
+ */
+ public boolean getValueAsBoolean() throws ConfigurationException {
+ try {
+ return _configuration.getValueAsBoolean();
+ } catch ( org.codehaus.dna.ConfigurationException e ) {
+ throw new ConfigurationException( e.getMessage() );
+ }
+ }
+
+ /**
+ * @see org.apache.avalon.framework.configuration.Configuration#getValueAsLong()
+ */
+ public long getValueAsLong() throws ConfigurationException {
+ try {
+ return _configuration.getValueAsLong();
+ } catch ( org.codehaus.dna.ConfigurationException e ) {
+ throw new ConfigurationException( e.getMessage() );
+ }
+ }
+
+ /**
+ * @see org.apache.avalon.framework.configuration.Configuration#getValue(java.lang.String)
+ */
+ public String getValue( String arg0 ) {
+ return _configuration.getValue( arg0 );
+ }
+
+ /**
+ * @see org.apache.avalon.framework.configuration.Configuration#getValueAsInteger(int)
+ */
+ public int getValueAsInteger( int arg0 ) {
+ return _configuration.getValueAsInteger( arg0 );
+ }
+
+ /**
+ * @see org.apache.avalon.framework.configuration.Configuration#getValueAsLong(long)
+ */
+ public long getValueAsLong( long arg0 ) {
+ return _configuration.getValueAsLong( arg0 );
+ }
+
+ /**
+ * @see org.apache.avalon.framework.configuration.Configuration#getValueAsFloat(float)
+ */
+ public float getValueAsFloat( float arg0 ) {
+ return _configuration.getValueAsFloat( arg0 );
+ }
+
+ /**
+ * @see org.apache.avalon.framework.configuration.Configuration#getValueAsBoolean(boolean)
+ */
+ public boolean getValueAsBoolean( boolean arg0 ) {
+ return _configuration.getValueAsBoolean( arg0 );
+ }
+
+ /**
+ * @see org.apache.avalon.framework.configuration.Configuration#getAttribute(java.lang.String,
+ * java.lang.String)
+ */
+ public String getAttribute( String arg0, String arg1 ) {
+ return _configuration.getAttribute( arg0, arg1 );
+ }
+
+ /**
+ * @see org.apache.avalon.framework.configuration.Configuration#getAttributeAsInteger(java.lang.String,
+ * int)
+ */
+ public int getAttributeAsInteger( String arg0, int arg1 ) {
+ return _configuration.getAttributeAsInteger( arg0, arg1 );
+ }
+
+ /**
+ * @see org.apache.avalon.framework.configuration.Configuration#getAttributeAsLong(java.lang.String,
+ * long)
+ */
+ public long getAttributeAsLong( String arg0, long arg1 ) {
+ return _configuration.getAttributeAsLong( arg0, arg1 );
+ }
+
+ /**
+ * @see org.apache.avalon.framework.configuration.Configuration#getAttributeAsFloat(java.lang.String,
+ * float)
+ */
+ public float getAttributeAsFloat( String arg0, float arg1 ) {
+ return _configuration.getAttributeAsFloat( arg0, arg1 );
+ }
+
+ /**
+ * @see org.apache.avalon.framework.configuration.Configuration#getAttributeAsBoolean(java.lang.String,
+ * boolean)
+ */
+ public boolean getAttributeAsBoolean( String arg0, boolean arg1 ) {
+ return _configuration.getAttributeAsBoolean( arg0, arg1 );
+ }
+}
\ No newline at end of file
----------
spice/components/alchemist/src/java/org/codehaus/spice/alchemist/configuration
DNAConfiguration.java added at 1.1
diff -N DNAConfiguration.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ DNAConfiguration.java 13 Jun 2004 13:35:14 -0000 1.1
@@ -0,0 +1,299 @@
+/*
+ * 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.configuration;
+
+import org.codehaus.dna.Configuration;
+import org.codehaus.dna.ConfigurationException;
+import org.codehaus.dna.impl.DefaultConfiguration;
+
+
+/**
+ * DNA Configuration facade implementation for the Avalon Configuration.
+ *
+ * @author Mauro Talevi
+ * @version $Revision: 1.1 $ $Date: 2004/06/13 13:35:14 $
+ */
+public class DNAConfiguration implements Configuration {
+
+ /** String used for default values */
+ private static final String EMPTY = "";
+
+ /**
+ * The Avalon Configuration.
+ */
+ private final org.apache.avalon.framework.configuration.Configuration _configuration;
+
+ /**
+ * Create an instance of configuration facade.
+ *
+ * @param configuration
+ */
+ public DNAConfiguration(
+ final org.apache.avalon.framework.configuration.Configuration configuration ) {
+ _configuration = configuration;
+ }
+
+ /**
+ * @see org.apache.avalon.framework.configuration.Configuration#getName()
+ */
+ public String getName() {
+ return _configuration.getName();
+ }
+
+ /**
+ * @see org.codehaus.dna.Configuration#getLocation()
+ */
+ public String getLocation() {
+ return _configuration.getLocation();
+ }
+
+ /**
+ * @see org.codehaus.dna.Configuration#getPath()
+ */
+ public String getPath() {
+ return EMPTY;
+ }
+
+ /**
+ * @see org.codehaus.dna.Configuration#getChild(java.lang.String)
+ */
+ public Configuration getChild( String arg0 ) {
+ return new DNAConfiguration( _configuration.getChild( arg0 ) );
+ }
+
+ /**
+ * @see org.codehaus.dna.Configuration#getChild(java.lang.String,
+ * boolean)
+ */
+ public Configuration getChild( String arg0, boolean arg1 ) {
+ return new DNAConfiguration( _configuration.getChild( arg0, arg1 ) );
+ }
+
+ /**
+ * @see org.codehaus.dna.Configuration#getChildren()
+ */
+ public Configuration[] getChildren() {
+ final DefaultConfiguration result = new DefaultConfiguration(
+ _configuration.getName(), _configuration.getLocation(), EMPTY );
+ final org.apache.avalon.framework.configuration.Configuration[] children = _configuration
+ .getChildren();
+ for ( int i = 0; i < children.length; i++ ) {
+ final Configuration child = new DNAConfiguration( children[i] );
+ result.addChild( child );
+ }
+ return result.getChildren();
+ }
+
+ /**
+ * @see org.codehaus.dna.Configuration#getChildren(java.lang.String)
+ */
+ public Configuration[] getChildren( String arg0 ) {
+ final DefaultConfiguration result = new DefaultConfiguration(
+ _configuration.getName(), _configuration.getLocation(), EMPTY );
+ final org.apache.avalon.framework.configuration.Configuration[] children = _configuration
+ .getChildren( arg0 );
+ for ( int i = 0; i < children.length; i++ ) {
+ final Configuration child = new DNAConfiguration( children[i] );
+ result.addChild( child );
+ }
+ return result.getChildren();
+ }
+
+ /**
+ * @see org.codehaus.dna.Configuration#getAttributeNames()
+ */
+ public String[] getAttributeNames() {
+ return _configuration.getAttributeNames();
+ }
+
+ /**
+ * @see org.codehaus.dna.Configuration#getAttribute(java.lang.String)
+ */
+ public String getAttribute( String arg0 ) throws ConfigurationException {
+ try {
+ return _configuration.getAttribute( arg0 );
+ } catch ( org.apache.avalon.framework.configuration.ConfigurationException e ) {
+ throw new ConfigurationException( e.getMessage(), e );
+ }
+ }
+
+ /**
+ * @see org.codehaus.dna.Configuration#getAttributeAsInteger(java.lang.String)
+ */
+ public int getAttributeAsInteger( String arg0 )
+ throws ConfigurationException {
+ try {
+ return _configuration.getAttributeAsInteger( arg0 );
+ } catch ( org.apache.avalon.framework.configuration.ConfigurationException e ) {
+ throw new ConfigurationException( e.getMessage(), e );
+ }
+ }
+
+ /**
+ * @see org.codehaus.dna.Configuration#getAttributeAsLong(java.lang.String)
+ */
+ public long getAttributeAsLong( String arg0 ) throws ConfigurationException {
+ try {
+ return _configuration.getAttributeAsLong( arg0 );
+ } catch ( org.apache.avalon.framework.configuration.ConfigurationException e ) {
+ throw new ConfigurationException( e.getMessage(), e );
+ }
+ }
+
+ /**
+ * @see org.codehaus.dna.Configuration#getAttributeAsFloat(java.lang.String)
+ */
+ public float getAttributeAsFloat( String arg0 )
+ throws ConfigurationException {
+ try {
+ return _configuration.getAttributeAsFloat( arg0 );
+ } catch ( org.apache.avalon.framework.configuration.ConfigurationException e ) {
+ throw new ConfigurationException( e.getMessage(), e);
+ }
+ }
+
+ /**
+ * @see org.codehaus.dna.Configuration#getAttributeAsBoolean(java.lang.String)
+ */
+ public boolean getAttributeAsBoolean( String arg0 )
+ throws ConfigurationException {
+ try {
+ return _configuration.getAttributeAsBoolean( arg0 );
+ } catch ( org.apache.avalon.framework.configuration.ConfigurationException e ) {
+ throw new ConfigurationException( e.getMessage(), e);
+ }
+ }
+
+ /**
+ * @see org.codehaus.dna.Configuration#getValue()
+ */
+ public String getValue() throws ConfigurationException {
+ try {
+ return _configuration.getValue();
+ } catch ( org.apache.avalon.framework.configuration.ConfigurationException e ) {
+ throw new ConfigurationException( e.getMessage(), e);
+ }
+ }
+
+ /**
+ * @see org.codehaus.dna.Configuration#getValueAsInteger()
+ */
+ public int getValueAsInteger() throws ConfigurationException {
+ try {
+ return _configuration.getValueAsInteger();
+ } catch ( org.apache.avalon.framework.configuration.ConfigurationException e ) {
+ throw new ConfigurationException( e.getMessage(), e);
+ }
+ }
+
+ /**
+ * @see org.codehaus.dna.Configuration#getValueAsFloat()
+ */
+ public float getValueAsFloat() throws ConfigurationException {
+ try {
+ return _configuration.getValueAsFloat();
+ } catch ( org.apache.avalon.framework.configuration.ConfigurationException e ) {
+ throw new ConfigurationException( e.getMessage(), e);
+ }
+ }
+
+ /**
+ * @see org.codehaus.dna.Configuration#getValueAsBoolean()
+ */
+ public boolean getValueAsBoolean() throws ConfigurationException {
+ try {
+ return _configuration.getValueAsBoolean();
+ } catch ( org.apache.avalon.framework.configuration.ConfigurationException e ) {
+ throw new ConfigurationException( e.getMessage(), e);
+ }
+ }
+
+ /**
+ * @see org.codehaus.dna.Configuration#getValueAsLong()
+ */
+ public long getValueAsLong() throws ConfigurationException {
+ try {
+ return _configuration.getValueAsLong();
+ } catch ( org.apache.avalon.framework.configuration.ConfigurationException e ) {
+ throw new ConfigurationException( e.getMessage(), e);
+ }
+ }
+
+ /**
+ * @see org.codehaus.dna.Configuration#getValue(java.lang.String)
+ */
+ public String getValue( String arg0 ) {
+ return _configuration.getValue( arg0 );
+ }
+
+ /**
+ * @see org.codehaus.dna.Configuration#getValueAsInteger(int)
+ */
+ public int getValueAsInteger( int arg0 ) {
+ return _configuration.getValueAsInteger( arg0 );
+ }
+
+ /**
+ * @see org.codehaus.dna.Configuration#getValueAsLong(long)
+ */
+ public long getValueAsLong( long arg0 ) {
+ return _configuration.getValueAsLong( arg0 );
+ }
+
+ /**
+ * @see org.codehaus.dna.Configuration#getValueAsFloat(float)
+ */
+ public float getValueAsFloat( float arg0 ) {
+ return _configuration.getValueAsFloat( arg0 );
+ }
+
+ /**
+ * @see org.codehaus.dna.Configuration#getValueAsBoolean(boolean)
+ */
+ public boolean getValueAsBoolean( boolean arg0 ) {
+ return _configuration.getValueAsBoolean( arg0 );
+ }
+
+ /**
+ * @see org.codehaus.dna.Configuration#getAttribute(java.lang.String,
+ * java.lang.String)
+ */
+ public String getAttribute( String arg0, String arg1 ) {
+ return _configuration.getAttribute( arg0, arg1 );
+ }
+
+ /**
+ * @see org.codehaus.dna.Configuration#getAttributeAsInteger(java.lang.String,
+ * int)
+ */
+ public int getAttributeAsInteger( String arg0, int arg1 ) {
+ return _configuration.getAttributeAsInteger( arg0, arg1 );
+ }
+
+ /**
+ * @see org.codehaus.dna.Configuration#getAttributeAsLong(java.lang.String,
+ * long)
+ */
+ public long getAttributeAsLong( String arg0, long arg1 ) {
+ return _configuration.getAttributeAsLong( arg0, arg1 );
+ }
+
+ /**
+ * @see org.codehaus.dna.Configuration#getAttributeAsFloat(java.lang.String,
+ * float)
+ */
+ public float getAttributeAsFloat( String arg0, float arg1 ) {
+ return _configuration.getAttributeAsFloat( arg0, arg1 );
+ }
+
+ /**
+ * @see org.codehaus.dna.Configuration#getAttributeAsBoolean(java.lang.String,
+ * boolean)
+ */
+ public boolean getAttributeAsBoolean( String arg0, boolean arg1 ) {
+ return _configuration.getAttributeAsBoolean( arg0, arg1 );
+ }
+}
\ No newline at end of file
----------
spice/components/alchemist/src/java/org/codehaus/spice/alchemist
LoggerAlchemist.java removed after 1.1
diff -N LoggerAlchemist.java
--- LoggerAlchemist.java 24 Apr 2004 11:23:32 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,43 +0,0 @@
-/*
- * 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.codehaus.dna.Logger;
-
-/**
- * Utility class containing methods to transform Logger objects.
- *
- * @author Mauro Talevi
- * @version $Revision: 1.1 $ $Date: 2004/04/24 11:23:32 $
- */
-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 );
- }
-}
CVSspam 0.2.8