diff options
author | Glen Mazza <gmazza@apache.org> | 2004-03-31 10:55:07 +0000 |
---|---|---|
committer | Glen Mazza <gmazza@apache.org> | 2004-03-31 10:55:07 +0000 |
commit | a054ab3b7e22af6c163b5d68c04bf5868958a59e (patch) | |
tree | 158b4e54cf28f6dd1926de530309ffc2b1ceb3d4 /src/java/org/apache/fop/render | |
parent | b0ef412c716311de35850f0d6ae56a1b7f7d8acf (diff) | |
download | xmlgraphics-fop-a054ab3b7e22af6c163b5d68c04bf5868958a59e.tar.gz xmlgraphics-fop-a054ab3b7e22af6c163b5d68c04bf5868958a59e.zip |
PR:
Obtained from:
Submitted by:
Reviewed by:
Conversion of Avalon to Commons-Logger. (Will still need to update the
examples, which I will take care of next; Jeremias will be modifying
the PDF libraries for more efficient use of the CL loggers.)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@197474 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/render')
9 files changed, 49 insertions, 19 deletions
diff --git a/src/java/org/apache/fop/render/AbstractRenderer.java b/src/java/org/apache/fop/render/AbstractRenderer.java index 8f5a96f7f..cc4781649 100644 --- a/src/java/org/apache/fop/render/AbstractRenderer.java +++ b/src/java/org/apache/fop/render/AbstractRenderer.java @@ -63,9 +63,9 @@ import org.apache.fop.apps.FOUserAgent; import org.apache.fop.fo.Constants; import org.apache.fop.fo.FOTreeControl; import org.apache.fop.fo.pagination.Region; +import org.apache.commons.logging.Log; // Avalon -import org.apache.avalon.framework.logger.AbstractLogEnabled; import org.apache.avalon.framework.configuration.Configurable; import org.apache.avalon.framework.configuration.Configuration; import org.apache.avalon.framework.configuration.ConfigurationException; @@ -75,7 +75,7 @@ import org.apache.avalon.framework.configuration.ConfigurationException; * top level processing of the area tree and adds some abstract methods to * handle viewports. This keeps track of the current block and inline position. */ -public abstract class AbstractRenderer extends AbstractLogEnabled +public abstract class AbstractRenderer implements Renderer, Configurable, Constants { /** @@ -84,6 +84,11 @@ public abstract class AbstractRenderer extends AbstractLogEnabled protected FOUserAgent userAgent; /** + * logging instance + */ + protected Log logger = null; + + /** * producer (usually "FOP") */ protected String producer = "FOP"; @@ -136,6 +141,22 @@ public abstract class AbstractRenderer extends AbstractLogEnabled public void configure(Configuration conf) throws ConfigurationException { } + /** + * Sets the Commons-Logging instance for this class + * @param logger The Commons-Logging instance + */ + public void setLogger(Log logger) { + this.logger = logger; + } + + /** + * Returns the Commons-Logging instance for this class + * @return The Commons-Logging instance + */ + protected Log getLogger() { + return logger; + } + /** @see org.apache.fop.render.Renderer */ public void setProducer(String inProducer) { producer = inProducer; diff --git a/src/java/org/apache/fop/render/Renderer.java b/src/java/org/apache/fop/render/Renderer.java index ef5f4526f..62446bf0b 100644 --- a/src/java/org/apache/fop/render/Renderer.java +++ b/src/java/org/apache/fop/render/Renderer.java @@ -37,6 +37,8 @@ import org.apache.fop.area.inline.Viewport; import org.apache.fop.area.inline.TextArea; import org.apache.fop.fo.FOTreeControl; import org.apache.fop.apps.FOUserAgent; +import org.apache.commons.logging.Log; + /** * Interface implemented by all renderers. This interface is used to control @@ -185,6 +187,13 @@ public interface Renderer { * @param cont The inline container area */ void renderContainer(Container cont); + + /** + * Tells the renderer to render an inline container. + * + * @param cont The inline container area + */ + void setLogger(Log logger); } diff --git a/src/java/org/apache/fop/render/pdf/PDFRenderer.java b/src/java/org/apache/fop/render/pdf/PDFRenderer.java index d28063b2a..e4a7bb289 100644 --- a/src/java/org/apache/fop/render/pdf/PDFRenderer.java +++ b/src/java/org/apache/fop/render/pdf/PDFRenderer.java @@ -249,7 +249,7 @@ public class PDFRenderer extends PrintRenderer { ostream = stream; producer = "FOP " + Version.getVersion(); this.pdfDoc = new PDFDocument(producer); - setupLogger(this.pdfDoc); + this.pdfDoc.setLogger(logger); this.pdfDoc.setCreator(creator); this.pdfDoc.setCreationDate(creationDate); this.pdfDoc.setFilterMap(filterMap); diff --git a/src/java/org/apache/fop/render/ps/AbstractPSTranscoder.java b/src/java/org/apache/fop/render/ps/AbstractPSTranscoder.java index d37326671..567197606 100644 --- a/src/java/org/apache/fop/render/ps/AbstractPSTranscoder.java +++ b/src/java/org/apache/fop/render/ps/AbstractPSTranscoder.java @@ -105,7 +105,7 @@ public abstract class AbstractPSTranscoder extends AbstractFOPTranscoder { throws TranscoderException { graphics = createDocumentGraphics2D(); - ContainerUtil.enableLogging(graphics, getLogger()); + try { if (this.cfg != null) { ContainerUtil.configure(graphics, this.cfg); diff --git a/src/java/org/apache/fop/render/rtf/PageAttributesConverter.java b/src/java/org/apache/fop/render/rtf/PageAttributesConverter.java index 7f8016aa0..fb34f9413 100644 --- a/src/java/org/apache/fop/render/rtf/PageAttributesConverter.java +++ b/src/java/org/apache/fop/render/rtf/PageAttributesConverter.java @@ -19,8 +19,8 @@ package org.apache.fop.render.rtf; -import org.apache.avalon.framework.logger.Logger; -import org.apache.avalon.framework.logger.ConsoleLogger; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.impl.SimpleLog; //FOP import org.apache.fop.apps.FOPException; @@ -40,7 +40,7 @@ import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfPage; class PageAttributesConverter { - private static Logger log = new ConsoleLogger(); + private static Log log = new SimpleLog("FOP/RTF"); /** convert xsl:fo attributes to RTF text attributes */ static RtfAttributes convertPageAttributes(SimplePageMaster pagemaster) { diff --git a/src/java/org/apache/fop/render/rtf/RTFHandler.java b/src/java/org/apache/fop/render/rtf/RTFHandler.java index 593c67d71..3d65a071a 100644 --- a/src/java/org/apache/fop/render/rtf/RTFHandler.java +++ b/src/java/org/apache/fop/render/rtf/RTFHandler.java @@ -24,8 +24,8 @@ import java.io.OutputStream; import java.io.OutputStreamWriter; import java.util.Iterator; -import org.apache.avalon.framework.logger.ConsoleLogger; -import org.apache.avalon.framework.logger.Logger; +import org.apache.commons.logging.impl.SimpleLog; +import org.apache.commons.logging.Log; import org.apache.fop.apps.FOPException; import org.apache.fop.fo.FOInputHandler; import org.apache.fop.fo.FObj; @@ -98,7 +98,7 @@ public class RTFHandler extends FOInputHandler { private RtfFile rtfFile; private final OutputStream os; - private final Logger log = new ConsoleLogger(); + private final Log log = new SimpleLog("FOP/RTF"); private RtfSection sect; private RtfDocumentArea docArea; private int iNestCount; diff --git a/src/java/org/apache/fop/render/rtf/TableAttributesConverter.java b/src/java/org/apache/fop/render/rtf/TableAttributesConverter.java index ea695bd24..c8c88927c 100644 --- a/src/java/org/apache/fop/render/rtf/TableAttributesConverter.java +++ b/src/java/org/apache/fop/render/rtf/TableAttributesConverter.java @@ -22,8 +22,8 @@ package org.apache.fop.render.rtf; import org.apache.fop.render.rtf.rtflib.rtfdoc.BorderAttributesConverter; //FOP -import org.apache.avalon.framework.logger.Logger; -import org.apache.avalon.framework.logger.ConsoleLogger; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.impl.SimpleLog; import org.apache.fop.apps.FOPException; import org.apache.fop.fo.expr.NCnameProperty; import org.apache.fop.fo.properties.ColorTypeProperty; @@ -57,7 +57,7 @@ import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfColorTable; public class TableAttributesConverter { - private static Logger log = new ConsoleLogger(); + private static Log log = new SimpleLog("FOP/RTF"); ////////////////////////////////////////////////// // @@ Construction diff --git a/src/java/org/apache/fop/render/rtf/TableContext.java b/src/java/org/apache/fop/render/rtf/TableContext.java index f9d08e634..fa847f09e 100644 --- a/src/java/org/apache/fop/render/rtf/TableContext.java +++ b/src/java/org/apache/fop/render/rtf/TableContext.java @@ -20,8 +20,8 @@ package org.apache.fop.render.rtf; import java.util.List; -import org.apache.avalon.framework.logger.ConsoleLogger; -import org.apache.avalon.framework.logger.Logger; +import org.apache.commons.logging.impl.SimpleLog; +import org.apache.commons.logging.Log; import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfAttributes; import org.apache.fop.render.rtf.rtflib.interfaces.ITableColumnsInfo; @@ -39,7 +39,7 @@ import org.apache.fop.render.rtf.rtflib.interfaces.ITableColumnsInfo; */ class TableContext implements ITableColumnsInfo { - private final Logger log = new ConsoleLogger(); + private final Log log = new SimpleLog("FOP/RTF"); private final BuilderContext context; private final List colWidths = new java.util.ArrayList(); private int colIndex; diff --git a/src/java/org/apache/fop/render/rtf/TextAttributesConverter.java b/src/java/org/apache/fop/render/rtf/TextAttributesConverter.java index 25e1d8173..f53bc937d 100644 --- a/src/java/org/apache/fop/render/rtf/TextAttributesConverter.java +++ b/src/java/org/apache/fop/render/rtf/TextAttributesConverter.java @@ -20,8 +20,8 @@ package org.apache.fop.render.rtf; //FOP -import org.apache.avalon.framework.logger.Logger; -import org.apache.avalon.framework.logger.ConsoleLogger; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.impl.SimpleLog; import org.apache.fop.apps.FOPException; import org.apache.fop.fo.Constants; import org.apache.fop.fo.PropertyList; @@ -49,7 +49,7 @@ import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfText; */ class TextAttributesConverter { - private static Logger log = new ConsoleLogger(); + private static Log log = new SimpleLog("FOP/RTF"); /** * Converts all known text FO properties to RtfAttributes |