This is an automated email from the ASF dual-hosted git repository. slachiewicz pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/maven-doxia-book-renderer.git
The following commit(s) were added to refs/heads/master by this push: new dedf1b5 refactor: Replace Plexus AbstractLogEnabled with SLF4J (#5) dedf1b5 is described below commit dedf1b5629fb54f5b5858edd46a0fc64c510bfe2 Author: Tim te Beek <t...@moderne.io> AuthorDate: Sat Dec 14 01:02:55 2024 +0100 refactor: Replace Plexus AbstractLogEnabled with SLF4J (#5) Use this link to re-run the recipe: https://app.moderne.io/builder/P4zH7djn6?organizationId=QXBhY2hlIE1hdmVu --------- Co-authored-by: Moderne <t...@moderne.io> --- pom.xml | 7 +++++++ .../java/org/apache/maven/doxia/book/DefaultBookDoxia.java | 6 ++++-- .../doxia/book/services/indexer/DefaultBookIndexer.java | 6 ++++-- .../apache/maven/doxia/book/services/io/DefaultBookIo.java | 12 +++++++----- .../book/services/renderer/AbstractITextBookRenderer.java | 5 +++-- .../doxia/book/services/renderer/DocbookBookRenderer.java | 6 ++++-- .../maven/doxia/book/services/renderer/PdfBookRenderer.java | 4 ++++ .../maven/doxia/book/services/renderer/RtfBookRenderer.java | 4 ++++ .../doxia/book/services/renderer/XHtmlBookRenderer.java | 6 ++++-- .../maven/doxia/book/services/renderer/XdocBookRenderer.java | 6 ++++-- .../doxia/book/services/validation/DefaultBookValidator.java | 7 +++++-- 11 files changed, 50 insertions(+), 19 deletions(-) diff --git a/pom.xml b/pom.xml index aa84828..13a9c03 100644 --- a/pom.xml +++ b/pom.xml @@ -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> diff --git a/src/main/java/org/apache/maven/doxia/book/DefaultBookDoxia.java b/src/main/java/org/apache/maven/doxia/book/DefaultBookDoxia.java index 82730d1..53911b0 100644 --- a/src/main/java/org/apache/maven/doxia/book/DefaultBookDoxia.java +++ b/src/main/java/org/apache/maven/doxia/book/DefaultBookDoxia.java @@ -28,7 +28,8 @@ import org.apache.maven.doxia.book.services.validation.BookValidator; 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; @@ -45,9 +46,10 @@ import java.util.Set; */ @Component( role = BookDoxia.class ) public class DefaultBookDoxia - extends AbstractLogEnabled implements BookDoxia { + private static final Logger LOGGER = LoggerFactory.getLogger( DefaultBookDoxia.class ); + @Requirement private BookIo bookIo; diff --git a/src/main/java/org/apache/maven/doxia/book/services/indexer/DefaultBookIndexer.java b/src/main/java/org/apache/maven/doxia/book/services/indexer/DefaultBookIndexer.java index f29d02f..19215da 100644 --- a/src/main/java/org/apache/maven/doxia/book/services/indexer/DefaultBookIndexer.java +++ b/src/main/java/org/apache/maven/doxia/book/services/indexer/DefaultBookIndexer.java @@ -35,7 +35,8 @@ import org.apache.maven.doxia.parser.ParseException; 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. @@ -45,9 +46,10 @@ import org.codehaus.plexus.logging.AbstractLogEnabled; */ @Component( role = BookIndexer.class ) public class DefaultBookIndexer - extends AbstractLogEnabled implements BookIndexer { + private static final Logger LOGGER = LoggerFactory.getLogger( DefaultBookIndexer.class ); + @Requirement private Doxia doxia; diff --git a/src/main/java/org/apache/maven/doxia/book/services/io/DefaultBookIo.java b/src/main/java/org/apache/maven/doxia/book/services/io/DefaultBookIo.java index a55a7d4..c0f64e0 100644 --- a/src/main/java/org/apache/maven/doxia/book/services/io/DefaultBookIo.java +++ b/src/main/java/org/apache/maven/doxia/book/services/io/DefaultBookIo.java @@ -28,9 +28,10 @@ import org.apache.maven.doxia.module.site.manager.SiteModuleManager; 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; @@ -48,9 +49,10 @@ import java.util.List; */ @Component( role = BookIo.class ) public class DefaultBookIo - extends AbstractLogEnabled implements BookIo { + private static final Logger LOGGER = LoggerFactory.getLogger( DefaultBookIo.class ); + @Requirement private SiteModuleManager siteModuleManager; @@ -127,9 +129,9 @@ public class DefaultBookIo } } - 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() ); @@ -137,7 +139,7 @@ public class DefaultBookIo { BookContext.BookFile file = entry.getValue(); - getLogger().debug( " " + entry.getKey() + "=" + file.getFile() + ", parser: " + file.getParserId() ); + LOGGER.debug( " " + entry.getKey() + "=" + file.getFile() + ", parser: " + file.getParserId() ); } } } diff --git a/src/main/java/org/apache/maven/doxia/book/services/renderer/AbstractITextBookRenderer.java b/src/main/java/org/apache/maven/doxia/book/services/renderer/AbstractITextBookRenderer.java index 9eefd52..485e13d 100644 --- a/src/main/java/org/apache/maven/doxia/book/services/renderer/AbstractITextBookRenderer.java +++ b/src/main/java/org/apache/maven/doxia/book/services/renderer/AbstractITextBookRenderer.java @@ -38,11 +38,12 @@ import org.apache.maven.doxia.parser.ParseException; 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. @@ -52,9 +53,9 @@ import org.codehaus.plexus.util.xml.PrettyPrintXMLWriter; * @version $Id$ */ public abstract class AbstractITextBookRenderer - extends AbstractLogEnabled implements BookRenderer { + private static final Logger LOGGER = LoggerFactory.getLogger( AbstractITextBookRenderer.class ); @Requirement private Doxia doxia; diff --git a/src/main/java/org/apache/maven/doxia/book/services/renderer/DocbookBookRenderer.java b/src/main/java/org/apache/maven/doxia/book/services/renderer/DocbookBookRenderer.java index a4097d1..372f982 100644 --- a/src/main/java/org/apache/maven/doxia/book/services/renderer/DocbookBookRenderer.java +++ b/src/main/java/org/apache/maven/doxia/book/services/renderer/DocbookBookRenderer.java @@ -37,11 +37,12 @@ import org.apache.maven.doxia.parser.manager.ParserNotFoundException; 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 @@ -51,9 +52,10 @@ import org.codehaus.plexus.util.WriterFactory; */ @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; diff --git a/src/main/java/org/apache/maven/doxia/book/services/renderer/PdfBookRenderer.java b/src/main/java/org/apache/maven/doxia/book/services/renderer/PdfBookRenderer.java index 2d0e9b9..64685ae 100644 --- a/src/main/java/org/apache/maven/doxia/book/services/renderer/PdfBookRenderer.java +++ b/src/main/java/org/apache/maven/doxia/book/services/renderer/PdfBookRenderer.java @@ -26,6 +26,8 @@ import java.io.IOException; 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. @@ -37,6 +39,8 @@ import org.codehaus.plexus.component.annotations.Component; public class PdfBookRenderer extends AbstractITextBookRenderer { + private static final Logger LOGGER = LoggerFactory.getLogger( PdfBookRenderer.class ); + /** {@inheritDoc} */ public String getOutputExtension() { diff --git a/src/main/java/org/apache/maven/doxia/book/services/renderer/RtfBookRenderer.java b/src/main/java/org/apache/maven/doxia/book/services/renderer/RtfBookRenderer.java index 2e6954d..9462878 100644 --- a/src/main/java/org/apache/maven/doxia/book/services/renderer/RtfBookRenderer.java +++ b/src/main/java/org/apache/maven/doxia/book/services/renderer/RtfBookRenderer.java @@ -26,6 +26,8 @@ import java.io.IOException; 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. @@ -37,6 +39,8 @@ import org.codehaus.plexus.component.annotations.Component; public class RtfBookRenderer extends AbstractITextBookRenderer { + private static final Logger LOGGER = LoggerFactory.getLogger( RtfBookRenderer.class ); + /** {@inheritDoc} */ public String getOutputExtension() { diff --git a/src/main/java/org/apache/maven/doxia/book/services/renderer/XHtmlBookRenderer.java b/src/main/java/org/apache/maven/doxia/book/services/renderer/XHtmlBookRenderer.java index f0b2f82..23870e1 100644 --- a/src/main/java/org/apache/maven/doxia/book/services/renderer/XHtmlBookRenderer.java +++ b/src/main/java/org/apache/maven/doxia/book/services/renderer/XHtmlBookRenderer.java @@ -31,9 +31,10 @@ import org.apache.maven.doxia.parser.manager.ParserNotFoundException; 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; @@ -50,9 +51,10 @@ import java.io.Writer; */ @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; diff --git a/src/main/java/org/apache/maven/doxia/book/services/renderer/XdocBookRenderer.java b/src/main/java/org/apache/maven/doxia/book/services/renderer/XdocBookRenderer.java index a58c51c..8fcf34c 100644 --- a/src/main/java/org/apache/maven/doxia/book/services/renderer/XdocBookRenderer.java +++ b/src/main/java/org/apache/maven/doxia/book/services/renderer/XdocBookRenderer.java @@ -44,10 +44,11 @@ import org.apache.maven.doxia.util.HtmlTools; 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 @@ -58,9 +59,10 @@ import org.codehaus.plexus.util.WriterFactory; */ @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; diff --git a/src/main/java/org/apache/maven/doxia/book/services/validation/DefaultBookValidator.java b/src/main/java/org/apache/maven/doxia/book/services/validation/DefaultBookValidator.java index 3ba4596..ee949e8 100644 --- a/src/main/java/org/apache/maven/doxia/book/services/validation/DefaultBookValidator.java +++ b/src/main/java/org/apache/maven/doxia/book/services/validation/DefaultBookValidator.java @@ -20,8 +20,10 @@ package org.apache.maven.doxia.book.services.validation; */ 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; @@ -33,9 +35,10 @@ import org.apache.maven.doxia.book.model.Chapter; */ @Component( role = BookValidator.class ) public class DefaultBookValidator - extends AbstractLogEnabled implements BookValidator { + private static final Logger LOGGER = LoggerFactory.getLogger( DefaultBookValidator.class ); + // ---------------------------------------------------------------------- // BookValidator Implementation // ----------------------------------------------------------------------