Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Replace Plexus AbstractLogEnabled with SLF4J #5

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,13 @@ under the License.
<artifactId>plexus-component-annotations</artifactId>
</dependency>

<!-- logging -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.36</version>
</dependency>

<!-- test -->
<dependency>
<groupId>org.apache.maven.doxia</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
import org.apache.maven.doxia.book.services.validation.ValidationResult;
import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.component.annotations.Requirement;
import org.codehaus.plexus.logging.AbstractLogEnabled;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.File;
import java.util.Collections;
Expand All @@ -45,9 +46,10 @@
*/
@Component( role = BookDoxia.class )
public class DefaultBookDoxia
extends AbstractLogEnabled
implements BookDoxia
{
private static final Logger LOGGER = LoggerFactory.getLogger( DefaultBookDoxia.class );

@Requirement
private BookIo bookIo;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
import org.apache.maven.doxia.parser.manager.ParserNotFoundException;
import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.component.annotations.Requirement;
import org.codehaus.plexus.logging.AbstractLogEnabled;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* Default implementation of BookIndexer.
Expand All @@ -45,9 +46,10 @@
*/
@Component( role = BookIndexer.class )
public class DefaultBookIndexer
extends AbstractLogEnabled
implements BookIndexer
{
private static final Logger LOGGER = LoggerFactory.getLogger( DefaultBookIndexer.class );

@Requirement
private Doxia doxia;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@
import org.codehaus.plexus.util.IOUtil;
import org.codehaus.plexus.util.ReaderFactory;
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.component.annotations.Requirement;
import org.codehaus.plexus.logging.AbstractLogEnabled;

import java.io.IOException;
import java.io.File;
Expand All @@ -48,9 +49,10 @@
*/
@Component( role = BookIo.class )
public class DefaultBookIo
extends AbstractLogEnabled
implements BookIo
{
private static final Logger LOGGER = LoggerFactory.getLogger( DefaultBookIo.class );

@Requirement
private SiteModuleManager siteModuleManager;

Expand Down Expand Up @@ -127,17 +129,17 @@ else if ( name.endsWith( extension ) )
}
}

if ( getLogger().isDebugEnabled() )
if ( LOGGER.isDebugEnabled() )
{
getLogger().debug( "Dumping document <-> id mapping:" );
LOGGER.debug( "Dumping document <-> id mapping:" );

Map<String, BookContext.BookFile> map = new TreeMap<>( context.getFiles() );

for ( Map.Entry<String, BookContext.BookFile> entry : map.entrySet() )
{
BookContext.BookFile file = entry.getValue();

getLogger().debug( " " + entry.getKey() + "=" + file.getFile() + ", parser: " + file.getParserId() );
LOGGER.debug( " " + entry.getKey() + "=" + file.getFile() + ", parser: " + file.getParserId() );
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,12 @@
import org.apache.maven.doxia.parser.manager.ParserNotFoundException;
import org.apache.maven.doxia.sink.Sink;
import org.codehaus.plexus.component.annotations.Requirement;
import org.codehaus.plexus.logging.AbstractLogEnabled;
import org.codehaus.plexus.util.IOUtil;
import org.codehaus.plexus.util.ReaderFactory;
import org.codehaus.plexus.util.WriterFactory;
import org.codehaus.plexus.util.xml.PrettyPrintXMLWriter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* Base class for <code>iText</code> renderer.
Expand All @@ -52,9 +53,9 @@
* @version $Id$
*/
public abstract class AbstractITextBookRenderer
extends AbstractLogEnabled
implements BookRenderer
{
private static final Logger LOGGER = LoggerFactory.getLogger( AbstractITextBookRenderer.class );
@Requirement
private Doxia doxia;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,12 @@
import org.apache.maven.doxia.sink.Sink;
import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.component.annotations.Requirement;
import org.codehaus.plexus.logging.AbstractLogEnabled;
import org.codehaus.plexus.util.IOUtil;
import org.codehaus.plexus.util.ReaderFactory;
import org.codehaus.plexus.util.StringUtils;
import org.codehaus.plexus.util.WriterFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* An implementation of <code>BookRenderer</code> for docbook
Expand All @@ -51,9 +52,10 @@
*/
@Component( role = BookRenderer.class, hint = "doc-book" )
public class DocbookBookRenderer
extends AbstractLogEnabled
implements BookRenderer
{
private static final Logger LOGGER = LoggerFactory.getLogger( DocbookBookRenderer.class );

@Requirement
private Doxia doxia;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@

import org.apache.maven.doxia.module.itext.ITextUtil;
import org.codehaus.plexus.component.annotations.Component;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* PDF book renderer with the <code>iText</code> framework.
Expand All @@ -37,6 +39,8 @@
public class PdfBookRenderer
extends AbstractITextBookRenderer
{
private static final Logger LOGGER = LoggerFactory.getLogger( PdfBookRenderer.class );

/** {@inheritDoc} */
public String getOutputExtension()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@

import org.apache.maven.doxia.module.itext.ITextUtil;
import org.codehaus.plexus.component.annotations.Component;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* RTF book renderer with the <code>iText</code> framework.
Expand All @@ -37,6 +39,8 @@
public class RtfBookRenderer
extends AbstractITextBookRenderer
{
private static final Logger LOGGER = LoggerFactory.getLogger( RtfBookRenderer.class );

/** {@inheritDoc} */
public String getOutputExtension()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@
import org.apache.maven.doxia.parser.ParseException;
import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.component.annotations.Requirement;
import org.codehaus.plexus.logging.AbstractLogEnabled;
import org.codehaus.plexus.util.IOUtil;
import org.codehaus.plexus.util.ReaderFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.File;
import java.io.FileNotFoundException;
Expand All @@ -50,9 +51,10 @@
*/
@Component( role = BookRenderer.class, hint = "xhtml" )
public class XHtmlBookRenderer
extends AbstractLogEnabled
implements BookRenderer
{
private static final Logger LOGGER = LoggerFactory.getLogger( XHtmlBookRenderer.class );

@Requirement
private Doxia doxia;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,11 @@
import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.component.annotations.Requirement;
import org.codehaus.plexus.i18n.I18N;
import org.codehaus.plexus.logging.AbstractLogEnabled;
import org.codehaus.plexus.util.IOUtil;
import org.codehaus.plexus.util.ReaderFactory;
import org.codehaus.plexus.util.WriterFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* An implementation of <code>BookRenderer</code> for Xdoc
Expand All @@ -58,9 +59,10 @@
*/
@Component( role = BookRenderer.class, hint = "xdoc" )
public class XdocBookRenderer
extends AbstractLogEnabled
implements BookRenderer
{
private static final Logger LOGGER = LoggerFactory.getLogger( XdocBookRenderer.class );

@Requirement
private Doxia doxia;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@
*/

import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.logging.AbstractLogEnabled;
import org.codehaus.plexus.util.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import org.apache.maven.doxia.book.model.BookModel;
import org.apache.maven.doxia.book.model.Chapter;

Expand All @@ -33,9 +35,10 @@
*/
@Component( role = BookValidator.class )
public class DefaultBookValidator
extends AbstractLogEnabled
implements BookValidator
{
private static final Logger LOGGER = LoggerFactory.getLogger( DefaultBookValidator.class );

// ----------------------------------------------------------------------
// BookValidator Implementation
// ----------------------------------------------------------------------
Expand Down
Loading