You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by sp...@apache.org on 2006/03/09 21:25:01 UTC

svn commit: r384602 - in /xmlgraphics/fop/branches/Temp_API_Finalization: examples/embedding/java/embedding/ examples/embedding/java/embedding/intermediate/ src/java/org/apache/fop/apps/ src/java/org/apache/fop/tools/ src/java/org/apache/fop/tools/antt...

Author: spepping
Date: Thu Mar  9 12:24:59 2006
New Revision: 384602

URL: http://svn.apache.org/viewcvs?rev=384602&view=rev
Log:
Change call to deprecated FOUserAgent constructor to FopFactory method

Modified:
    xmlgraphics/fop/branches/Temp_API_Finalization/examples/embedding/java/embedding/ExampleFO2OldStylePrint.java
    xmlgraphics/fop/branches/Temp_API_Finalization/examples/embedding/java/embedding/intermediate/ExampleConcat.java
    xmlgraphics/fop/branches/Temp_API_Finalization/examples/embedding/java/embedding/intermediate/ExampleStamp.java
    xmlgraphics/fop/branches/Temp_API_Finalization/src/java/org/apache/fop/apps/FOUserAgent.java
    xmlgraphics/fop/branches/Temp_API_Finalization/src/java/org/apache/fop/tools/TestConverter.java
    xmlgraphics/fop/branches/Temp_API_Finalization/src/java/org/apache/fop/tools/anttasks/Fop.java
    xmlgraphics/fop/branches/Temp_API_Finalization/test/java/org/apache/fop/GenericFOPTestCase.java
    xmlgraphics/fop/branches/Temp_API_Finalization/test/java/org/apache/fop/URIResolutionTestCase.java
    xmlgraphics/fop/branches/Temp_API_Finalization/test/java/org/apache/fop/intermediate/AreaTreeParserTestCase.java
    xmlgraphics/fop/branches/Temp_API_Finalization/test/java/org/apache/fop/layoutengine/LayoutEngineTester.java
    xmlgraphics/fop/branches/Temp_API_Finalization/test/java/org/apache/fop/visual/AbstractPSPDFBitmapProducer.java
    xmlgraphics/fop/branches/Temp_API_Finalization/test/java/org/apache/fop/visual/BitmapProducerJava2D.java

Modified: xmlgraphics/fop/branches/Temp_API_Finalization/examples/embedding/java/embedding/ExampleFO2OldStylePrint.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/branches/Temp_API_Finalization/examples/embedding/java/embedding/ExampleFO2OldStylePrint.java?rev=384602&r1=384601&r2=384602&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_API_Finalization/examples/embedding/java/embedding/ExampleFO2OldStylePrint.java (original)
+++ xmlgraphics/fop/branches/Temp_API_Finalization/examples/embedding/java/embedding/ExampleFO2OldStylePrint.java Thu Mar  9 12:24:59 2006
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2005 The Apache Software Foundation.
+ * Copyright 1999-2006 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.
@@ -36,6 +36,7 @@
 import org.apache.fop.apps.FOUserAgent;
 import org.apache.fop.apps.Fop;
 import org.apache.fop.apps.FOPException;
+import org.apache.fop.apps.FopFactory;
 import org.apache.fop.apps.MimeConstants;
 import org.apache.fop.render.print.PrintRenderer;
 
@@ -44,6 +45,9 @@
  */
 public class ExampleFO2OldStylePrint {
 
+    // configure fopFactory as desired
+    private FopFactory fopFactory = FopFactory.newInstance();
+    
     /**
      * Prints an FO file using an old-style PrinterJob.
      * @param fo the FO file
@@ -60,7 +64,7 @@
         
         try {
             //Set up a custom user agent so we can supply our own renderer instance
-            FOUserAgent userAgent = new FOUserAgent();
+            FOUserAgent userAgent = fopFactory.newFOUserAgent();
             userAgent.setRendererOverride(renderer);
             
             // Construct fop with desired output format

Modified: xmlgraphics/fop/branches/Temp_API_Finalization/examples/embedding/java/embedding/intermediate/ExampleConcat.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/branches/Temp_API_Finalization/examples/embedding/java/embedding/intermediate/ExampleConcat.java?rev=384602&r1=384601&r2=384602&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_API_Finalization/examples/embedding/java/embedding/intermediate/ExampleConcat.java (original)
+++ xmlgraphics/fop/branches/Temp_API_Finalization/examples/embedding/java/embedding/intermediate/ExampleConcat.java Thu Mar  9 12:24:59 2006
@@ -142,7 +142,7 @@
         try {
             //Setup fonts and user agent
             FontInfo fontInfo = new FontInfo();
-            FOUserAgent userAgent = new FOUserAgent();
+            FOUserAgent userAgent = fopFactory.newFOUserAgent();
 
             //Construct the AreaTreeModel that will received the individual pages
             AreaTreeModel treeModel = new RenderPagesModel(userAgent, 

Modified: xmlgraphics/fop/branches/Temp_API_Finalization/examples/embedding/java/embedding/intermediate/ExampleStamp.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/branches/Temp_API_Finalization/examples/embedding/java/embedding/intermediate/ExampleStamp.java?rev=384602&r1=384601&r2=384602&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_API_Finalization/examples/embedding/java/embedding/intermediate/ExampleStamp.java (original)
+++ xmlgraphics/fop/branches/Temp_API_Finalization/examples/embedding/java/embedding/intermediate/ExampleStamp.java Thu Mar  9 12:24:59 2006
@@ -30,6 +30,7 @@
 import javax.xml.transform.stream.StreamSource;
 
 import org.apache.fop.apps.FOUserAgent;
+import org.apache.fop.apps.FopFactory;
 import org.apache.fop.apps.MimeConstants;
 import org.apache.fop.area.AreaTreeModel;
 import org.apache.fop.area.AreaTreeParser;
@@ -46,6 +47,9 @@
  */
 public class ExampleStamp {
 
+    // configure fopFactory as desired
+    private FopFactory fopFactory = FopFactory.newInstance();
+    
     /**
      * Stamps an intermediate file and renders it to a PDF file.
      * @param atfile the intermediate file (area tree XML)
@@ -63,7 +67,7 @@
         try {
             //Setup fonts and user agent
             FontInfo fontInfo = new FontInfo();
-            FOUserAgent userAgent = new FOUserAgent();
+            FOUserAgent userAgent = fopFactory.newFOUserAgent();
 
             //Construct the AreaTreeModel that will received the individual pages
             AreaTreeModel treeModel = new RenderPagesModel(userAgent, 

Modified: xmlgraphics/fop/branches/Temp_API_Finalization/src/java/org/apache/fop/apps/FOUserAgent.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/branches/Temp_API_Finalization/src/java/org/apache/fop/apps/FOUserAgent.java?rev=384602&r1=384601&r2=384602&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_API_Finalization/src/java/org/apache/fop/apps/FOUserAgent.java (original)
+++ xmlgraphics/fop/branches/Temp_API_Finalization/src/java/org/apache/fop/apps/FOUserAgent.java Thu Mar  9 12:24:59 2006
@@ -109,9 +109,10 @@
     protected String keywords = null;
     
     /**
-     * Default constructor. <b>Provided for compatibility only. Please use the methods from 
-     * FopFactory to construct FOUserAgent instances!</b>
+     * Default constructor
      * @see org.apache.fop.apps.FopFactory
+     * @deprecated Provided for compatibility only. Please use the methods from 
+     *             FopFactory to construct FOUserAgent instances!
      */
     public FOUserAgent() {
         this(FopFactory.newInstance());

Modified: xmlgraphics/fop/branches/Temp_API_Finalization/src/java/org/apache/fop/tools/TestConverter.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/branches/Temp_API_Finalization/src/java/org/apache/fop/tools/TestConverter.java?rev=384602&r1=384601&r2=384602&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_API_Finalization/src/java/org/apache/fop/tools/TestConverter.java (original)
+++ xmlgraphics/fop/branches/Temp_API_Finalization/src/java/org/apache/fop/tools/TestConverter.java Thu Mar  9 12:24:59 2006
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2005 The Apache Software Foundation.
+ * Copyright 1999-2006 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.
@@ -25,7 +25,7 @@
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 
-import org.apache.fop.apps.Fop;
+import org.apache.fop.apps.FopFactory;
 import org.apache.fop.apps.FOUserAgent;
 import org.apache.fop.apps.MimeConstants;
 import org.apache.fop.cli.InputHandler;
@@ -48,6 +48,9 @@
  */
 public class TestConverter {
     
+    // configure fopFactory as desired
+    private FopFactory fopFactory = FopFactory.newInstance();
+    
     private boolean failOnly = false;
     private String outputFormat = MimeConstants.MIME_FOP_AREA_TREE;
     private File destdir;
@@ -284,7 +287,7 @@
                                                          + xsl), null);
             }
 
-            FOUserAgent userAgent = new FOUserAgent();
+            FOUserAgent userAgent = fopFactory.newFOUserAgent();
             userAgent.setBaseURL(baseURL);
 
             userAgent.getRendererOptions().put("fineDetail", new Boolean(false));

Modified: xmlgraphics/fop/branches/Temp_API_Finalization/src/java/org/apache/fop/tools/anttasks/Fop.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/branches/Temp_API_Finalization/src/java/org/apache/fop/tools/anttasks/Fop.java?rev=384602&r1=384601&r2=384602&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_API_Finalization/src/java/org/apache/fop/tools/anttasks/Fop.java (original)
+++ xmlgraphics/fop/branches/Temp_API_Finalization/src/java/org/apache/fop/tools/anttasks/Fop.java Thu Mar  9 12:24:59 2006
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2005 The Apache Software Foundation.
+ * Copyright 1999-2006 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.
@@ -36,6 +36,7 @@
 // FOP
 import org.apache.fop.apps.FOPException;
 import org.apache.fop.apps.FOUserAgent;
+import org.apache.fop.apps.FopFactory;
 import org.apache.fop.apps.MimeConstants;
 import org.apache.fop.cli.InputHandler;
 
@@ -301,6 +302,9 @@
 
 class FOPTaskStarter {
 
+    // configure fopFactory as desired
+    private FopFactory fopFactory = FopFactory.newInstance();
+    
     private Fop task;
     private String baseURL = null;
 
@@ -536,7 +540,7 @@
         }
 
         try {
-            FOUserAgent userAgent = new FOUserAgent();
+            FOUserAgent userAgent = fopFactory.newFOUserAgent();
             userAgent.setBaseURL(this.baseURL);
             inputHandler.renderTo(userAgent, outputFormat, out);
         } catch (Exception ex) {

Modified: xmlgraphics/fop/branches/Temp_API_Finalization/test/java/org/apache/fop/GenericFOPTestCase.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/branches/Temp_API_Finalization/test/java/org/apache/fop/GenericFOPTestCase.java?rev=384602&r1=384601&r2=384602&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_API_Finalization/test/java/org/apache/fop/GenericFOPTestCase.java (original)
+++ xmlgraphics/fop/branches/Temp_API_Finalization/test/java/org/apache/fop/GenericFOPTestCase.java Thu Mar  9 12:24:59 2006
@@ -32,6 +32,7 @@
 
 import org.apache.fop.apps.Fop;
 import org.apache.fop.apps.FOUserAgent;
+import org.apache.fop.apps.FopFactory;
 import org.apache.fop.apps.MimeConstants;
 import org.apache.fop.util.DigestFilter;
 import org.xml.sax.InputSource;
@@ -46,6 +47,9 @@
  */
 public final class GenericFOPTestCase extends TestCase {
 
+    // configure fopFactory as desired
+    private FopFactory fopFactory = FopFactory.newInstance();
+    
     protected SAXParserFactory parserFactory;
 
     public static Test suite() {
@@ -110,7 +114,7 @@
 
     private void renderPDF(String fo, String digestIn, String digestOut)
         throws Exception {
-        FOUserAgent foUserAgent = new FOUserAgent();
+        FOUserAgent foUserAgent = fopFactory.newFOUserAgent();
         foUserAgent.setCreationDate(new Date(10000));
         MessageDigest outDigest = MessageDigest.getInstance("MD5");
         DigestOutputStream out =

Modified: xmlgraphics/fop/branches/Temp_API_Finalization/test/java/org/apache/fop/URIResolutionTestCase.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/branches/Temp_API_Finalization/test/java/org/apache/fop/URIResolutionTestCase.java?rev=384602&r1=384601&r2=384602&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_API_Finalization/test/java/org/apache/fop/URIResolutionTestCase.java (original)
+++ xmlgraphics/fop/branches/Temp_API_Finalization/test/java/org/apache/fop/URIResolutionTestCase.java Thu Mar  9 12:24:59 2006
@@ -40,8 +40,8 @@
 import org.apache.fop.apps.FOPException;
 import org.apache.fop.apps.FOUserAgent;
 import org.apache.fop.apps.Fop;
+import org.apache.fop.apps.FopFactory;
 import org.apache.fop.apps.MimeConstants;
-import org.apache.fop.image.ImageFactory;
 import org.apache.fop.render.xml.XMLRenderer;
 import org.apache.xpath.XPathAPI;
 import org.apache.xpath.objects.XObject;
@@ -52,6 +52,9 @@
  */
 public class URIResolutionTestCase extends AbstractFOPTestCase {
 
+    // configure fopFactory as desired
+    private FopFactory fopFactory = FopFactory.newInstance();
+    
     private SAXTransformerFactory tfactory 
             = (SAXTransformerFactory)SAXTransformerFactory.newInstance();
 
@@ -79,7 +82,7 @@
     }
     
     private void innerTestFO1(boolean withStream) throws Exception {
-        FOUserAgent ua = new FOUserAgent();
+        FOUserAgent ua = fopFactory.newFOUserAgent();
 
         //Reset the image caches to force URI resolution!
         ua.getFactory().getImageFactory().clearCaches();
@@ -112,7 +115,7 @@
         //TODO This will only work when we can do URI resolution inside Batik!
         File foFile = new File(getBaseDir(), "test/xml/uri-resolution2.fo");
         
-        FOUserAgent ua = new FOUserAgent();
+        FOUserAgent ua = fopFactory.newFOUserAgent();
         MyURIResolver resolver = new MyURIResolver(false); 
         ua.setURIResolver(resolver);
         ua.setBaseURL(foFile.getParentFile().toURL().toString());

Modified: xmlgraphics/fop/branches/Temp_API_Finalization/test/java/org/apache/fop/intermediate/AreaTreeParserTestCase.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/branches/Temp_API_Finalization/test/java/org/apache/fop/intermediate/AreaTreeParserTestCase.java?rev=384602&r1=384601&r2=384602&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_API_Finalization/test/java/org/apache/fop/intermediate/AreaTreeParserTestCase.java (original)
+++ xmlgraphics/fop/branches/Temp_API_Finalization/test/java/org/apache/fop/intermediate/AreaTreeParserTestCase.java Thu Mar  9 12:24:59 2006
@@ -41,6 +41,7 @@
 import org.apache.commons.io.output.ByteArrayOutputStream;
 import org.apache.fop.apps.FOUserAgent;
 import org.apache.fop.apps.Fop;
+import org.apache.fop.apps.FopFactory;
 import org.apache.fop.apps.MimeConstants;
 import org.apache.fop.area.AreaTreeModel;
 import org.apache.fop.area.AreaTreeParser;
@@ -58,6 +59,9 @@
  */
 public class AreaTreeParserTestCase extends XMLTestCase {
 
+    // configure fopFactory as desired
+    private FopFactory fopFactory = FopFactory.newInstance();
+    
     private static SAXTransformerFactory tFactory 
             = (SAXTransformerFactory)SAXTransformerFactory.newInstance();
     private static Templates stylesheet = null;
@@ -162,7 +166,7 @@
     }
     
     private FOUserAgent createUserAgent() {
-        FOUserAgent userAgent = new FOUserAgent();
+        FOUserAgent userAgent = fopFactory.newFOUserAgent();
         try {
             userAgent.setBaseURL(testDir.toURL().toExternalForm());
         } catch (MalformedURLException e) {

Modified: xmlgraphics/fop/branches/Temp_API_Finalization/test/java/org/apache/fop/layoutengine/LayoutEngineTester.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/branches/Temp_API_Finalization/test/java/org/apache/fop/layoutengine/LayoutEngineTester.java?rev=384602&r1=384601&r2=384602&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_API_Finalization/test/java/org/apache/fop/layoutengine/LayoutEngineTester.java (original)
+++ xmlgraphics/fop/branches/Temp_API_Finalization/test/java/org/apache/fop/layoutengine/LayoutEngineTester.java Thu Mar  9 12:24:59 2006
@@ -42,6 +42,7 @@
 import org.apache.fop.apps.FOPException;
 import org.apache.fop.apps.FOUserAgent;
 import org.apache.fop.apps.Fop;
+import org.apache.fop.apps.FopFactory;
 import org.apache.fop.apps.FormattingResults;
 import org.apache.fop.apps.MimeConstants;
 import org.apache.fop.layoutmgr.ElementListObserver;
@@ -59,6 +60,9 @@
 
     private static final Map CHECK_CLASSES = new java.util.HashMap();
     
+    // configure fopFactory as desired
+    private FopFactory fopFactory = FopFactory.newInstance();
+    
     private SAXTransformerFactory tfactory 
             = (SAXTransformerFactory)SAXTransformerFactory.newInstance();
 
@@ -128,7 +132,7 @@
             athandler.setResult(domres);
             
             //Setup FOP for area tree rendering
-            FOUserAgent ua = new FOUserAgent();
+            FOUserAgent ua = fopFactory.newFOUserAgent();
             ua.setBaseURL(testFile.getParentFile().toURL().toString());
             XMLRenderer atrenderer = new XMLRenderer();
             atrenderer.setUserAgent(ua);

Modified: xmlgraphics/fop/branches/Temp_API_Finalization/test/java/org/apache/fop/visual/AbstractPSPDFBitmapProducer.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/branches/Temp_API_Finalization/test/java/org/apache/fop/visual/AbstractPSPDFBitmapProducer.java?rev=384602&r1=384601&r2=384602&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_API_Finalization/test/java/org/apache/fop/visual/AbstractPSPDFBitmapProducer.java (original)
+++ xmlgraphics/fop/branches/Temp_API_Finalization/test/java/org/apache/fop/visual/AbstractPSPDFBitmapProducer.java Thu Mar  9 12:24:59 2006
@@ -36,6 +36,7 @@
 import org.apache.commons.io.IOUtils;
 import org.apache.fop.apps.FOUserAgent;
 import org.apache.fop.apps.Fop;
+import org.apache.fop.apps.FopFactory;
 
 /**
  * BitmapProducer implementation that uses the PS or PDF renderer and an external converter 
@@ -63,6 +64,9 @@
 public abstract class AbstractPSPDFBitmapProducer extends AbstractBitmapProducer 
             implements Configurable {
 
+    // configure fopFactory as desired
+    private FopFactory fopFactory = FopFactory.newInstance();
+    
     private String converter;
     private boolean deleteTempFiles;
     
@@ -106,7 +110,7 @@
     /** @see org.apache.fop.visual.BitmapProducer */
     public BufferedImage produce(File src, ProducerContext context) {
         try {
-            FOUserAgent userAgent = new FOUserAgent();
+            FOUserAgent userAgent = fopFactory.newFOUserAgent();
             userAgent.setTargetResolution(context.getTargetResolution());
             userAgent.setBaseURL(src.getParentFile().toURL().toString());
 

Modified: xmlgraphics/fop/branches/Temp_API_Finalization/test/java/org/apache/fop/visual/BitmapProducerJava2D.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/branches/Temp_API_Finalization/test/java/org/apache/fop/visual/BitmapProducerJava2D.java?rev=384602&r1=384601&r2=384602&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_API_Finalization/test/java/org/apache/fop/visual/BitmapProducerJava2D.java (original)
+++ xmlgraphics/fop/branches/Temp_API_Finalization/test/java/org/apache/fop/visual/BitmapProducerJava2D.java Thu Mar  9 12:24:59 2006
@@ -34,6 +34,7 @@
 import org.apache.commons.io.IOUtils;
 import org.apache.fop.apps.FOUserAgent;
 import org.apache.fop.apps.Fop;
+import org.apache.fop.apps.FopFactory;
 import org.apache.fop.apps.MimeConstants;
 
 /**
@@ -51,6 +52,9 @@
  */
 public class BitmapProducerJava2D extends AbstractBitmapProducer implements Configurable {
 
+    // configure fopFactory as desired
+    private FopFactory fopFactory = FopFactory.newInstance();
+    
     private boolean deleteTempFiles;
 
     /** @see org.apache.avalon.framework.configuration.Configurable */
@@ -61,7 +65,7 @@
     /** @see org.apache.fop.visual.BitmapProducer */
     public BufferedImage produce(File src, ProducerContext context) {
         try {
-            FOUserAgent userAgent = new FOUserAgent();
+            FOUserAgent userAgent = fopFactory.newFOUserAgent();
             userAgent.setTargetResolution(context.getTargetResolution());
             userAgent.setBaseURL(src.getParentFile().toURL().toString());
             



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org