diff options
author | Glen Mazza <gmazza@apache.org> | 2004-07-24 05:47:45 +0000 |
---|---|---|
committer | Glen Mazza <gmazza@apache.org> | 2004-07-24 05:47:45 +0000 |
commit | 3bcfed2d9b7e68e4bfcf6738bf5c9a28063d59d5 (patch) | |
tree | 9b75a0917ed78fffc5ee848e06ab5bba3315d0b1 /examples/embedding | |
parent | 7796f1b60829f28d3173b658871cd0fa46d4c258 (diff) | |
download | xmlgraphics-fop-3bcfed2d9b7e68e4bfcf6738bf5c9a28063d59d5.tar.gz xmlgraphics-fop-3bcfed2d9b7e68e4bfcf6738bf5c9a28063d59d5.zip |
Combined the apps.Driver class into apps.Fop. (195 LOC total.) Primary
benefit is to make Fop self-documenting in external code, also none of the
API ideas called for retention of the Driver class (even if there were
different ideas for its replacement).
Let's try this for a few weeks, if it confuses people too much (or when
the API starts to grow again) we can bring back Driver, possibly under
a different name, apps.FopProcess, perhaps.
See also:
http://marc.theaimsgroup.com/?l=fop-dev&m=108947697611032&w=2
http://marc.theaimsgroup.com/?l=fop-dev&m=108966015504506&w=2
http://marc.theaimsgroup.com/?l=fop-dev&m=108942673103344&w=2
http://marc.theaimsgroup.com/?l=fop-dev&m=108958756030147&w=2
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@197827 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'examples/embedding')
5 files changed, 25 insertions, 25 deletions
diff --git a/examples/embedding/java/embedding/ExampleDOM2PDF.java b/examples/embedding/java/embedding/ExampleDOM2PDF.java index 372ff274a..783c7a7ad 100644 --- a/examples/embedding/java/embedding/ExampleDOM2PDF.java +++ b/examples/embedding/java/embedding/ExampleDOM2PDF.java @@ -40,7 +40,7 @@ import org.w3c.dom.Node; import org.w3c.dom.Text; // FOP -import org.apache.fop.apps.Driver; +import org.apache.fop.apps.Fop; /** @@ -61,15 +61,15 @@ public class ExampleDOM2PDF { */ public void convertDOM2PDF(Document xslfoDoc, File pdf) { try { - // Construct driver with desired output format - Driver driver = new Driver(Driver.RENDER_PDF); + // Construct fop with desired output format + Fop fop = new Fop(Fop.RENDER_PDF); // Setup output OutputStream out = new java.io.FileOutputStream(pdf); out = new java.io.BufferedOutputStream(out); try { - driver.setOutputStream(out); + fop.setOutputStream(out); // Setup Identity Transformer TransformerFactory factory = TransformerFactory.newInstance(); @@ -79,7 +79,7 @@ public class ExampleDOM2PDF { Source src = new DOMSource(xslfoDoc); // Resulting SAX events (the generated FO) must be piped through to FOP - Result res = new SAXResult(driver.getDefaultHandler()); + Result res = new SAXResult(fop.getDefaultHandler()); // Start XSLT transformation and FOP processing transformer.transform(src, res); diff --git a/examples/embedding/java/embedding/ExampleFO2PDF.java b/examples/embedding/java/embedding/ExampleFO2PDF.java index 2cac20729..388cdcaf4 100644 --- a/examples/embedding/java/embedding/ExampleFO2PDF.java +++ b/examples/embedding/java/embedding/ExampleFO2PDF.java @@ -35,7 +35,7 @@ import javax.xml.transform.sax.SAXResult; // FOP -import org.apache.fop.apps.Driver; +import org.apache.fop.apps.Fop; import org.apache.fop.apps.FOPException; /** @@ -55,14 +55,14 @@ public class ExampleFO2PDF { OutputStream out = null; try { - // Construct driver with desired output format - Driver driver = new Driver(Driver.RENDER_PDF); + // Construct fop with desired output format + Fop fop = new Fop(Fop.RENDER_PDF); // Setup output stream. Note: Using BufferedOutputStream // for performance reasons (helpful with FileOutputStreams). out = new FileOutputStream(pdf); out = new BufferedOutputStream(out); - driver.setOutputStream(out); + fop.setOutputStream(out); // Setup JAXP using identity transformer TransformerFactory factory = TransformerFactory.newInstance(); @@ -72,7 +72,7 @@ public class ExampleFO2PDF { Source src = new StreamSource(fo); // Resulting SAX events (the generated FO) must be piped through to FOP - Result res = new SAXResult(driver.getDefaultHandler()); + Result res = new SAXResult(fop.getDefaultHandler()); // Start XSLT transformation and FOP processing transformer.transform(src, res); diff --git a/examples/embedding/java/embedding/ExampleFO2PDFUsingSAXParser.java b/examples/embedding/java/embedding/ExampleFO2PDFUsingSAXParser.java index de152b125..612f78974 100644 --- a/examples/embedding/java/embedding/ExampleFO2PDFUsingSAXParser.java +++ b/examples/embedding/java/embedding/ExampleFO2PDFUsingSAXParser.java @@ -36,7 +36,7 @@ import org.xml.sax.helpers.DefaultHandler; import org.xml.sax.SAXException; // FOP -import org.apache.fop.apps.Driver; +import org.apache.fop.apps.Fop; import org.apache.fop.apps.FOPException; /** @@ -63,14 +63,14 @@ public class ExampleFO2PDFUsingSAXParser { OutputStream out = null; try { - // Construct driver and setup output format - Driver driver = new Driver(Driver.RENDER_PDF); + // Construct fop and setup output format + Fop fop = new Fop(Fop.RENDER_PDF); // Setup output stream. Note: Using BufferedOutputStream // for performance reasons (helpful with FileOutputStreams). out = new FileOutputStream(pdf); out = new BufferedOutputStream(out); - driver.setOutputStream(out); + fop.setOutputStream(out); // Setup SAX parser // throws FactoryConfigurationError @@ -81,7 +81,7 @@ public class ExampleFO2PDFUsingSAXParser { // Obtain FOP's DefaultHandler // throws FOPException - DefaultHandler dh = driver.getDefaultHandler(); + DefaultHandler dh = fop.getDefaultHandler(); // Start parsing and FOP processing // throws SAXException, IOException diff --git a/examples/embedding/java/embedding/ExampleObj2PDF.java b/examples/embedding/java/embedding/ExampleObj2PDF.java index e68bc69c8..ba3b99f77 100644 --- a/examples/embedding/java/embedding/ExampleObj2PDF.java +++ b/examples/embedding/java/embedding/ExampleObj2PDF.java @@ -33,7 +33,7 @@ import javax.xml.transform.stream.StreamSource; import javax.xml.transform.sax.SAXResult; // FOP -import org.apache.fop.apps.Driver; +import org.apache.fop.apps.Fop; import org.apache.fop.apps.FOPException; import embedding.model.ProjectTeam; @@ -55,14 +55,14 @@ public class ExampleObj2PDF { public void convertProjectTeam2PDF(ProjectTeam team, File xslt, File pdf) throws IOException, FOPException, TransformerException { - // Construct driver with desired output format - Driver driver = new Driver(Driver.RENDER_PDF); + // Construct fop with desired output format + Fop fop = new Fop(Fop.RENDER_PDF); // Setup output OutputStream out = new java.io.FileOutputStream(pdf); out = new java.io.BufferedOutputStream(out); try { - driver.setOutputStream(out); + fop.setOutputStream(out); // Setup XSLT TransformerFactory factory = TransformerFactory.newInstance(); @@ -72,7 +72,7 @@ public class ExampleObj2PDF { Source src = team.getSourceForProjectTeam(); // Resulting SAX events (the generated FO) must be piped through to FOP - Result res = new SAXResult(driver.getDefaultHandler()); + Result res = new SAXResult(fop.getDefaultHandler()); // Start XSLT transformation and FOP processing transformer.transform(src, res); diff --git a/examples/embedding/java/embedding/ExampleXML2PDF.java b/examples/embedding/java/embedding/ExampleXML2PDF.java index fa99b843e..3f82b3e94 100644 --- a/examples/embedding/java/embedding/ExampleXML2PDF.java +++ b/examples/embedding/java/embedding/ExampleXML2PDF.java @@ -32,7 +32,7 @@ import javax.xml.transform.stream.StreamSource; import javax.xml.transform.sax.SAXResult; //FOP -import org.apache.fop.apps.Driver; +import org.apache.fop.apps.Fop; import org.apache.fop.apps.FOPException; /** @@ -66,15 +66,15 @@ public class ExampleXML2PDF { System.out.println(); System.out.println("Transforming..."); - // Construct driver with desired output format - Driver driver = new Driver(Driver.RENDER_PDF); + // Construct fop with desired output format + Fop fop = new Fop(Fop.RENDER_PDF); // Setup output OutputStream out = new java.io.FileOutputStream(pdffile); out = new java.io.BufferedOutputStream(out); try { - driver.setOutputStream(out); + fop.setOutputStream(out); // Setup XSLT TransformerFactory factory = TransformerFactory.newInstance(); @@ -87,7 +87,7 @@ public class ExampleXML2PDF { Source src = new StreamSource(xmlfile); // Resulting SAX events (the generated FO) must be piped through to FOP - Result res = new SAXResult(driver.getDefaultHandler()); + Result res = new SAXResult(fop.getDefaultHandler()); // Start XSLT transformation and FOP processing transformer.transform(src, res); |