Submitted by: Robert Bielik <Robert.Bielik.at.gyros.com> (Patch committed with modifications and additional changes for test code) git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@225486 13f79535-47bb-0310-9956-ffa450edef68tags/fop-0_90-alpha1
@@ -478,7 +478,7 @@ list of possible build targets. | |||
<target name="hyphenation-jar" depends="hyphenation"> | |||
<tstamp> | |||
<format property="ts" pattern="yyyy-MM-dd'T'HH:mm:ssZ"/> | |||
<format property="ts" pattern="yyyyMMdd-HHmmss-z"/> | |||
</tstamp> | |||
<jar jarfile="${build.dir}/fop-hyph.jar" basedir="${build.dest}" includes="hyph/**"> | |||
<manifest> |
@@ -55,7 +55,7 @@ import java.util.ListIterator; | |||
*/ | |||
public class PageSequenceLayoutManager extends AbstractLayoutManager { | |||
private Log log = LogFactory.getLog(PageSequenceLayoutManager.class); | |||
private static Log log = LogFactory.getLog(PageSequenceLayoutManager.class); | |||
/** | |||
* AreaTreeHandler which activates the PSLM and controls | |||
@@ -189,7 +189,7 @@ public class PageSequenceLayoutManager extends AbstractLayoutManager { | |||
needColumnBalancing = (childLC.getNextSpan() == Constants.EN_ALL); | |||
} | |||
if (needColumnBalancing) { | |||
log.debug("Column balancing necessary for the next element list!!!"); | |||
this.log.debug("Column balancing necessary for the next element list!!!"); | |||
} | |||
return nextSequenceStartsOn; | |||
} | |||
@@ -303,8 +303,8 @@ public class PageSequenceLayoutManager extends AbstractLayoutManager { | |||
protected void doPhase3(PageBreakingAlgorithm alg, int partCount, | |||
BlockSequence originalList, BlockSequence effectiveList) { | |||
if (needColumnBalancing) { | |||
log.debug("Column balancing now!!!"); | |||
log.debug("==================================================="); | |||
this.log.debug("Column balancing now!!!"); | |||
this.log.debug("==================================================="); | |||
int restartPoint = pvProvider.getStartingPartIndexForLastPage(partCount); | |||
if (restartPoint > 0) { | |||
addAreas(alg, restartPoint, originalList, effectiveList); | |||
@@ -318,7 +318,7 @@ public class PageSequenceLayoutManager extends AbstractLayoutManager { | |||
} else { | |||
newStartPos = 0; | |||
} | |||
log.debug("Restarting at " + restartPoint + ", new start position: " + newStartPos); | |||
this.log.debug("Restarting at " + restartPoint + ", new start position: " + newStartPos); | |||
//Handle page break right here to avoid any side-effects | |||
handleBreakTrait(EN_PAGE); | |||
@@ -338,7 +338,7 @@ public class PageSequenceLayoutManager extends AbstractLayoutManager { | |||
int iOptPageCount = algRestart.findBreakingPoints(effectiveList, | |||
newStartPos, | |||
1, true, true); | |||
log.debug("restart: iOptPageCount= " + iOptPageCount | |||
this.log.debug("restart: iOptPageCount= " + iOptPageCount | |||
+ " pageBreaks.size()= " + algRestart.getPageBreaks().size()); | |||
if (iOptPageCount > getCurrentPV().getBodyRegion().getColumnCount()) { | |||
/* reenable when everything works | |||
@@ -349,7 +349,7 @@ public class PageSequenceLayoutManager extends AbstractLayoutManager { | |||
//Make sure we only add the areas we haven't added already | |||
effectiveList.ignoreAtStart = newStartPos; | |||
addAreas(algRestart, iOptPageCount, originalList, effectiveList); | |||
log.debug("==================================================="); | |||
this.log.debug("==================================================="); | |||
} else { | |||
//Directly add areas after finding the breaks | |||
addAreas(alg, partCount, originalList, effectiveList); | |||
@@ -357,7 +357,7 @@ public class PageSequenceLayoutManager extends AbstractLayoutManager { | |||
} | |||
protected void startPart(BlockSequence list, int breakClass) { | |||
log.debug("startPart() breakClass=" + breakClass); | |||
this.log.debug("startPart() breakClass=" + breakClass); | |||
if (curPV == null) { | |||
throw new IllegalStateException("curPV must not be null"); | |||
} |
@@ -24,6 +24,7 @@ import java.security.Provider; | |||
import java.security.Security; | |||
import org.apache.commons.logging.Log; | |||
import org.apache.commons.logging.LogFactory; | |||
/** | |||
* This class acts as a factory for PDF encryption support. It enables the | |||
@@ -31,6 +32,9 @@ import org.apache.commons.logging.Log; | |||
*/ | |||
public class PDFEncryptionManager { | |||
/** logging instance */ | |||
protected static Log log = LogFactory.getLog(PDFEncryptionManager.class); | |||
/** | |||
* Indicates whether JCE is available. | |||
* @return boolean true if JCE is present | |||
@@ -75,8 +79,7 @@ public class PDFEncryptionManager { | |||
* @param log the logger to send warnings to | |||
*/ | |||
public static void setupPDFEncryption(PDFEncryptionParams params, | |||
PDFDocument pdf, | |||
Log log) { | |||
PDFDocument pdf) { | |||
if (pdf == null) { | |||
throw new NullPointerException("PDF document must not be null"); | |||
} |
@@ -77,16 +77,14 @@ import org.apache.avalon.framework.configuration.ConfigurationException; | |||
public abstract class AbstractRenderer | |||
implements Renderer, Configurable, Constants { | |||
/** logging instance */ | |||
protected static Log log = LogFactory.getLog("org.apache.fop.render"); | |||
/** | |||
* user agent | |||
*/ | |||
protected FOUserAgent userAgent; | |||
/** | |||
* logging instance | |||
*/ | |||
protected static Log logger = LogFactory.getLog("org.apache.fop.render"); | |||
/** | |||
* block progression position | |||
*/ | |||
@@ -117,14 +115,6 @@ public abstract class AbstractRenderer | |||
public void configure(Configuration conf) throws ConfigurationException { | |||
} | |||
/** | |||
* Returns the Commons-Logging instance for this class | |||
* @return The Commons-Logging instance | |||
*/ | |||
protected Log getLogger() { | |||
return logger; | |||
} | |||
/** | |||
* @see org.apache.fop.render.Renderer | |||
*/ | |||
@@ -713,7 +703,7 @@ public abstract class AbstractRenderer | |||
handler.handleXML(ctx, doc, namespace); | |||
} catch (Throwable t) { | |||
// could not handle document | |||
getLogger().error("Some XML content will be ignored. " | |||
log.error("Some XML content will be ignored. " | |||
+ "Could not render XML", t); | |||
} | |||
} else { | |||
@@ -723,7 +713,7 @@ public abstract class AbstractRenderer | |||
if (!warnedXMLHandlers.contains(namespace)) { | |||
// no handler found for document | |||
warnedXMLHandlers.add(namespace); | |||
getLogger().warn("Some XML content will be ignored. " | |||
log.warn("Some XML content will be ignored. " | |||
+ "No handler defined for XML: " + namespace); | |||
} | |||
} |
@@ -46,7 +46,7 @@ public class PNGRenderer extends Java2DRenderer { | |||
/** @see org.apache.fop.render.Renderer#startRenderer(java.io.OutputStream) */ | |||
public void startRenderer(OutputStream outputStream) throws IOException { | |||
getLogger().info("rendering areas to PNG"); | |||
log.info("rendering areas to PNG"); | |||
setOutputDirectory(); | |||
this.firstOutputStream = outputStream; | |||
} | |||
@@ -86,7 +86,7 @@ public class PNGRenderer extends Java2DRenderer { | |||
OutputStream os = getCurrentOutputStream(i); | |||
if (os == null) { | |||
getLogger().warn("No filename information available." | |||
log.warn("No filename information available." | |||
+ " Stopping early after the first page."); | |||
break; | |||
} | |||
@@ -95,7 +95,7 @@ public class PNGRenderer extends Java2DRenderer { | |||
.get(i)); | |||
// Encode this image | |||
getLogger().debug("Encoding page " + (i + 1)); | |||
log.debug("Encoding page " + (i + 1)); | |||
renderParams = PNGEncodeParam.getDefaultEncodeParam(image); | |||
// Set resolution |
@@ -50,7 +50,7 @@ public class PNGRenderer_onthefly extends Java2DRenderer { | |||
/** @see org.apache.fop.render.Renderer#startRenderer(java.io.OutputStream) */ | |||
public void startRenderer(OutputStream outputStream) throws IOException { | |||
getLogger().info("rendering areas to PNG"); | |||
log.info("rendering areas to PNG"); | |||
setOutputDirectory(); | |||
this.firstOutputStream = outputStream; | |||
} | |||
@@ -83,7 +83,7 @@ public class PNGRenderer_onthefly extends Java2DRenderer { | |||
RenderedImage image = (RenderedImage) getPageImage(pageViewport); | |||
// Encode this image | |||
getLogger().debug("Encoding Page" + (getCurrentPageNumber() + 1)); | |||
log.debug("Encoding page" + (getCurrentPageNumber() + 1)); | |||
renderParams = PNGEncodeParam.getDefaultEncodeParam(image); | |||
OutputStream os = getCurrentOutputStream(getCurrentPageNumber()); | |||
PNGImageEncoder encoder = new PNGImageEncoder(os, renderParams); |
@@ -39,6 +39,8 @@ import org.apache.batik.ext.awt.image.codec.tiff.TIFFField; | |||
import org.apache.batik.ext.awt.image.codec.tiff.TIFFImageDecoder; | |||
import org.apache.batik.ext.awt.image.codec.tiff.TIFFImageEncoder; | |||
import org.apache.batik.ext.awt.image.rendered.FormatRed; | |||
import org.apache.commons.logging.Log; | |||
import org.apache.commons.logging.LogFactory; | |||
import org.apache.fop.apps.FOPException; | |||
import org.apache.fop.render.java2d.Java2DRenderer; | |||
@@ -110,10 +112,10 @@ public class TIFFRenderer extends Java2DRenderer { | |||
name = "COMPRESSION_DEFLATE"; | |||
break; | |||
default: | |||
getLogger().info("TIFF compression not supported: " + comp); | |||
log.info("TIFF compression not supported: " + comp); | |||
return; | |||
} | |||
getLogger().info("TIFF compression set to " + name); | |||
log.info("TIFF compression set to " + name); | |||
} | |||
@@ -127,7 +129,7 @@ public class TIFFRenderer extends Java2DRenderer { | |||
public void stopRenderer() throws IOException { | |||
super.stopRenderer(); | |||
getLogger().debug("Starting Tiff encoding ..."); | |||
log.debug("Starting Tiff encoding ..."); | |||
//Set resolution | |||
float pixSzMM = userAgent.getPixelUnitToMillimeter(); | |||
@@ -152,7 +154,7 @@ public class TIFFRenderer extends Java2DRenderer { | |||
TIFFImageEncoder enc = new TIFFImageEncoder(outputStream, renderParams); | |||
// Creates lazy iterator over generated page images | |||
Iterator pageImagesItr = new LazyPageImagesIterator(getNumberOfPages()); | |||
Iterator pageImagesItr = new LazyPageImagesIterator(getNumberOfPages(), log); | |||
// The first image to be passed to enc | |||
RenderedImage first = (RenderedImage) pageImagesItr.next(); | |||
@@ -166,18 +168,27 @@ public class TIFFRenderer extends Java2DRenderer { | |||
// Cleaning | |||
outputStream.flush(); | |||
clearViewportList(); | |||
getLogger().debug("Tiff encoding done."); | |||
log.debug("Tiff encoding done."); | |||
} | |||
/** Private inner class to lazy page rendering. */ | |||
private class LazyPageImagesIterator implements Iterator { | |||
/** logging instance */ | |||
private Log log; | |||
private int count; | |||
private int current = 0; | |||
public LazyPageImagesIterator(int c) { | |||
/** | |||
* Main constructor | |||
* @param c number of pages to iterate over | |||
* @param log the logger to use (this is a hack so this compiles under JDK 1.3) | |||
*/ | |||
public LazyPageImagesIterator(int c, Log log) { | |||
count = c; | |||
this.log = log; | |||
} | |||
public boolean hasNext() { | |||
@@ -185,7 +196,7 @@ public class TIFFRenderer extends Java2DRenderer { | |||
} | |||
public Object next() { | |||
getLogger().debug("[" + (current + 1) + "]"); | |||
log.debug("[" + (current + 1) + "]"); | |||
// Renders current page as image | |||
BufferedImage pageImage = null; |
@@ -201,7 +201,7 @@ public abstract class Java2DRenderer extends AbstractRenderer implements Printab | |||
} | |||
public void stopRenderer() throws IOException { | |||
getLogger().debug("Java2DRenderer stopped"); | |||
log.debug("Java2DRenderer stopped"); | |||
renderingDone = true; | |||
numberOfPages = currentPageNumber; | |||
// TODO set all vars to null for gc | |||
@@ -261,7 +261,7 @@ public abstract class Java2DRenderer extends AbstractRenderer implements Printab | |||
pageWidth = (int) Math.round(bounds.getWidth() / 1000f); | |||
pageHeight = (int) Math.round(bounds.getHeight() / 1000f); | |||
getLogger().info( | |||
log.info( | |||
"Rendering Page " + pageViewport.getPageNumberString() | |||
+ " (pageWidth " + pageWidth + ", pageHeight " | |||
+ pageHeight + ")"); | |||
@@ -393,7 +393,7 @@ public abstract class Java2DRenderer extends AbstractRenderer implements Printab | |||
// after the block-container has been painted. See below. | |||
List breakOutList = null; | |||
if (bv.getPositioning() == Block.FIXED) { | |||
getLogger().debug("Block.FIXED --> break out"); | |||
log.debug("Block.FIXED --> break out"); | |||
breakOutList = new java.util.ArrayList(); | |||
Graphics2D graph; | |||
while (true) { | |||
@@ -403,7 +403,7 @@ public abstract class Java2DRenderer extends AbstractRenderer implements Printab | |||
} | |||
breakOutList.add(0, graph); // Insert because of | |||
// stack-popping | |||
getLogger().debug("Adding to break out list: " + graph); | |||
log.debug("Adding to break out list: " + graph); | |||
} | |||
} | |||
@@ -455,13 +455,13 @@ public abstract class Java2DRenderer extends AbstractRenderer implements Printab | |||
// clip if necessary | |||
if (breakOutList != null) { | |||
getLogger().debug( | |||
log.debug( | |||
"Block.FIXED --> restoring context after break-out"); | |||
Graphics2D graph; | |||
Iterator i = breakOutList.iterator(); | |||
while (i.hasNext()) { | |||
graph = (Graphics2D) i.next(); | |||
getLogger().debug("Restoring: " + graph); | |||
log.debug("Restoring: " + graph); | |||
state.push(); | |||
} | |||
} | |||
@@ -638,7 +638,7 @@ public abstract class Java2DRenderer extends AbstractRenderer implements Printab | |||
} | |||
} else { | |||
getLogger().warn( | |||
log.warn( | |||
"Can't find background image: " + back.getURL()); | |||
} | |||
} | |||
@@ -883,7 +883,7 @@ public abstract class Java2DRenderer extends AbstractRenderer implements Printab | |||
state.getGraph().draw(line); | |||
// lower Leader | |||
line.setLine(startx, starty + thickness, endx, starty + thickness); | |||
state.getGraph().setColor(Color.WHITE); | |||
state.getGraph().setColor(Color.white); | |||
state.getGraph().draw(line); | |||
// TODO the implementation could be nicer, f.eg. with triangles at | |||
@@ -904,7 +904,7 @@ public abstract class Java2DRenderer extends AbstractRenderer implements Printab | |||
state.getGraph().draw(line); | |||
// upperLeader | |||
line.setLine(startx, starty, endx, starty); | |||
state.getGraph().setColor(Color.WHITE); | |||
state.getGraph().setColor(Color.white); | |||
state.getGraph().draw(line); | |||
// TODO the implementation could be nicer, f.eg. with triangles at | |||
@@ -972,7 +972,7 @@ public abstract class Java2DRenderer extends AbstractRenderer implements Printab | |||
renderSVGDocument(doc, pos); // TODO check if ok. | |||
} else if ("image/eps".equals(mime)) { | |||
getLogger().warn("EPS images are not supported by this renderer"); | |||
log.warn("EPS images are not supported by this renderer"); | |||
currentBPPosition += (h * 1000); | |||
} else if ("image/jpeg".equals(mime)) { | |||
if (!fopimage.load(FopImage.ORIGINAL_DATA)) { | |||
@@ -991,15 +991,17 @@ public abstract class Java2DRenderer extends AbstractRenderer implements Printab | |||
currentBPPosition += (h * 1000); | |||
} else { | |||
if (!fopimage.load(FopImage.BITMAP)) { | |||
getLogger().warn("Loading of bitmap failed: " + url); | |||
log.warn("Loading of bitmap failed: " + url); | |||
return; | |||
} | |||
byte[] raw = fopimage.getBitmaps(); | |||
// TODO Hardcoded color and sample models, FIX ME! | |||
ColorModel cm = new ComponentColorModel(ColorSpace | |||
.getInstance(ColorSpace.CS_LINEAR_RGB), false, false, | |||
ColorModel cm = new ComponentColorModel( | |||
ColorSpace.getInstance(ColorSpace.CS_LINEAR_RGB), | |||
new int[] {8, 8, 8}, | |||
false, false, | |||
ColorModel.OPAQUE, DataBuffer.TYPE_BYTE); | |||
SampleModel sampleModel = new PixelInterleavedSampleModel( | |||
DataBuffer.TYPE_BYTE, w, h, 3, w * 3, new int[] { 0, 1, 2 }); | |||
@@ -1088,7 +1090,7 @@ public abstract class Java2DRenderer extends AbstractRenderer implements Printab | |||
try { | |||
root = builder.build(ctx, doc); | |||
} catch (Exception e) { | |||
getLogger().error( | |||
log.error( | |||
"svg graphic could not be built: " + e.getMessage(), e); | |||
return; | |||
} | |||
@@ -1105,7 +1107,7 @@ public abstract class Java2DRenderer extends AbstractRenderer implements Printab | |||
try { | |||
inverse = at.createInverse(); | |||
} catch (NoninvertibleTransformException e) { | |||
getLogger().warn(e); | |||
log.warn(e); | |||
} | |||
if (!at.isIdentity()) { | |||
state.getGraph().transform(at); |
@@ -1,5 +1,5 @@ | |||
/* | |||
* Copyright 1999-2004 The Apache Software Foundation. | |||
* Copyright 1999-2005 The Apache Software Foundation. | |||
* | |||
* Licensed under the Apache License, Version 2.0 (the "License"); | |||
* you may not use this file except in compliance with the License. | |||
@@ -155,7 +155,7 @@ public class PCLRenderer extends PrintRenderer { | |||
} | |||
public void startRenderer(OutputStream outputStream) throws IOException { | |||
getLogger().info("rendering areas to PCL"); | |||
log.info("rendering areas to PCL"); | |||
currentStream = new PCLStream(outputStream); | |||
// Set orientation. |
@@ -260,7 +260,7 @@ public class PDFRenderer extends PrintRenderer { | |||
//Setup encryption if necessary | |||
PDFEncryptionManager.setupPDFEncryption( | |||
userAgent.getPDFEncryptionParams(), this.pdfDoc, getLogger()); | |||
userAgent.getPDFEncryptionParams(), this.pdfDoc); | |||
} | |||
/** | |||
@@ -652,7 +652,7 @@ public class PDFRenderer extends PrintRenderer { | |||
restoreGraphicsState(); | |||
} else { | |||
getLogger().warn("Can't find background image: " + back.getURL()); | |||
log.warn("Can't find background image: " + back.getURL()); | |||
} | |||
} | |||
} | |||
@@ -837,7 +837,7 @@ public class PDFRenderer extends PrintRenderer { | |||
float w = x2 - x1; | |||
float h = y2 - y1; | |||
if ((w < 0) || (h < 0)) { | |||
getLogger().error("Negative extent received. Border won't be painted."); | |||
log.error("Negative extent received. Border won't be painted."); | |||
return; | |||
} | |||
switch (style) { |
@@ -266,8 +266,8 @@ public class PDFXMLHandler implements XMLHandler { | |||
PDFRenderer renderer = (PDFRenderer)context.getRenderer(); | |||
renderer.saveGraphicsState(); | |||
//pdfInfo.currentStream.add("q\n"); | |||
renderer.setColor(Color.BLACK, false, null); | |||
renderer.setColor(Color.BLACK, true, null); | |||
renderer.setColor(Color.black, false, null); | |||
renderer.setColor(Color.black, true, null); | |||
// transform so that the coordinates (0,0) is from the top left | |||
// and positive is down and to the right. (0,0) is where the | |||
// viewBox puts it. |
@@ -1,5 +1,5 @@ | |||
/* | |||
* Copyright 1999-2004 The Apache Software Foundation. | |||
* Copyright 1999-2005 The Apache Software Foundation. | |||
* | |||
* Licensed under the Apache License, Version 2.0 (the "License"); | |||
* you may not use this file except in compliance with the License. | |||
@@ -133,7 +133,7 @@ public class PSRenderer extends PrintRenderer { | |||
*/ | |||
protected void handleIOTrouble(IOException ioe) { | |||
if (!ioTrouble) { | |||
getLogger().error("Error while writing to target file", ioe); | |||
log.error("Error while writing to target file", ioe); | |||
ioTrouble = true; | |||
} | |||
} | |||
@@ -305,7 +305,7 @@ public class PSRenderer extends PrintRenderer { | |||
*/ | |||
public void startRenderer(OutputStream outputStream) | |||
throws IOException { | |||
getLogger().debug("rendering areas to PostScript"); | |||
log.debug("rendering areas to PostScript"); | |||
//Setup for PostScript generation | |||
this.gen = new PSGenerator(outputStream); | |||
@@ -351,7 +351,7 @@ public class PSRenderer extends PrintRenderer { | |||
*/ | |||
public void renderPage(PageViewport page) | |||
throws IOException, FOPException { | |||
getLogger().debug("renderPage(): " + page); | |||
log.debug("renderPage(): " + page); | |||
this.currentPageNumber++; | |||
gen.writeDSCComment(DSCConstants.PAGE, new Object[] |
@@ -185,7 +185,7 @@ public class SVGRenderer extends AbstractRenderer implements XMLHandler { | |||
try { | |||
svgT.transcode(input, output); | |||
} catch (TranscoderException e) { | |||
getLogger().error("could not write svg file :" + e.getMessage(), e); | |||
log.error("could not write svg file :" + e.getMessage(), e); | |||
} | |||
ostream.flush(); | |||
ostream = null; |
@@ -1,5 +1,5 @@ | |||
/* | |||
* Copyright 1999-2004 The Apache Software Foundation. | |||
* Copyright 1999-2005 The Apache Software Foundation. | |||
* | |||
* Licensed under the Apache License, Version 2.0 (the "License"); | |||
* you may not use this file except in compliance with the License. | |||
@@ -77,7 +77,7 @@ public class TXTRenderer extends PrintRenderer { | |||
private void addStr(int row, int col, String str, boolean ischar) { | |||
if (debug) { | |||
getLogger().debug("TXTRenderer.addStr(" + row + ", " + col | |||
log.debug("TXTRenderer.addStr(" + row + ", " + col | |||
+ ", \"" + str + "\", " + ischar + ")"); | |||
} | |||
if (suppressGraphics && !ischar) { | |||
@@ -109,7 +109,7 @@ public class TXTRenderer extends PrintRenderer { | |||
sb.append(' '); | |||
} | |||
if (debug) { | |||
getLogger().debug("TXTRenderer.addStr() sb.length()=" | |||
log.debug("TXTRenderer.addStr() sb.length()=" | |||
+ sb.length()); | |||
} | |||
for (int countr = col; countr < (col + str.length()); countr++) { | |||
@@ -117,7 +117,7 @@ public class TXTRenderer extends PrintRenderer { | |||
sb.append(str.charAt(countr - col)); | |||
} else { | |||
if (debug) { | |||
getLogger().debug("TXTRenderer.addStr() sb.length()=" | |||
log.debug("TXTRenderer.addStr() sb.length()=" | |||
+ sb.length() + " countr=" + countr); | |||
} | |||
sb.setCharAt(countr, str.charAt(countr - col)); |
@@ -285,7 +285,7 @@ public class XMLRenderer extends AbstractRenderer { | |||
*/ | |||
public void startRenderer(OutputStream outputStream) | |||
throws IOException { | |||
getLogger().debug("Rendering areas to Area Tree XML"); | |||
log.debug("Rendering areas to Area Tree XML"); | |||
if (this.handler == null) { | |||
SAXTransformerFactory factory | |||
@@ -327,7 +327,7 @@ public class XMLRenderer extends AbstractRenderer { | |||
if (this.out != null) { | |||
this.out.flush(); | |||
} | |||
getLogger().debug("Written out Area Tree XML"); | |||
log.debug("Written out Area Tree XML"); | |||
} | |||
/** |
@@ -1,5 +1,5 @@ | |||
/* | |||
* Copyright 2004 The Apache Software Foundation. | |||
* Copyright 2004-2005 The Apache Software Foundation. | |||
* | |||
* Licensed under the Apache License, Version 2.0 (the "License"); | |||
* you may not use this file except in compliance with the License. | |||
@@ -39,6 +39,7 @@ import org.apache.avalon.framework.configuration.Configuration; | |||
import org.apache.avalon.framework.configuration.ConfigurationException; | |||
import org.apache.avalon.framework.container.ContainerUtil; | |||
import org.apache.avalon.framework.logger.AbstractLogEnabled; | |||
import org.apache.avalon.framework.logger.Logger; | |||
import org.apache.commons.io.IOUtils; | |||
public class FOPTestbed extends AbstractLogEnabled | |||
@@ -75,7 +76,9 @@ public class FOPTestbed extends AbstractLogEnabled | |||
//Initialize threads | |||
List threadList = new java.util.LinkedList(); | |||
for (int ti = 0; ti < this.threads; ti++) { | |||
Thread thread = new Thread(new TaskRunner()); | |||
TaskRunner runner = new TaskRunner(); | |||
ContainerUtil.enableLogging(runner, getLogger()); | |||
Thread thread = new Thread(runner); | |||
threadList.add(thread); | |||
} | |||
@@ -100,7 +103,7 @@ public class FOPTestbed extends AbstractLogEnabled | |||
getLogger().info("Stress test duration: " + (System.currentTimeMillis() - start) + "ms"); | |||
} | |||
private class TaskRunner implements Runnable { | |||
private class TaskRunner extends AbstractLogEnabled implements Runnable { | |||
public void run() { | |||
try { | |||
@@ -109,6 +112,7 @@ public class FOPTestbed extends AbstractLogEnabled | |||
while (i.hasNext()) { | |||
TaskDef def = (TaskDef)i.next(); | |||
final Task task = new Task(def, counter++); | |||
ContainerUtil.enableLogging(task, getLogger()); | |||
task.execute(); | |||
} | |||
} | |||
@@ -122,7 +126,8 @@ public class FOPTestbed extends AbstractLogEnabled | |||
public FOProcessor createFOProcessor() { | |||
try { | |||
Class clazz = Class.forName(this.fopCfg.getAttribute("class", "org.apache.fop.threading.FOProcessorImpl")); | |||
Class clazz = Class.forName(this.fopCfg.getAttribute("class", | |||
"org.apache.fop.threading.FOProcessorImpl")); | |||
FOProcessor fop = (FOProcessor)clazz.newInstance(); | |||
ContainerUtil.enableLogging(fop, getLogger()); | |||
ContainerUtil.configure(fop, this.fopCfg); | |||
@@ -187,7 +192,7 @@ public class FOPTestbed extends AbstractLogEnabled | |||
} | |||
private class Task implements Executable { | |||
private class Task extends AbstractLogEnabled implements Executable { | |||
private TaskDef def; | |||
private int num; | |||
@@ -199,7 +204,7 @@ public class FOPTestbed extends AbstractLogEnabled | |||
public void execute() throws Exception { | |||
getLogger().info("Processing: "+def); | |||
getLogger().info("Processing: " + def); | |||
FOProcessor fop = (FOProcessor)createFOProcessor(); | |||
DecimalFormat df = new DecimalFormat("00000"); | |||
File outfile = new File(outputDir, df.format(num) + ".pdf"); |