diff options
23 files changed, 11 insertions, 1295 deletions
diff --git a/lib/Compare.class b/lib/Compare.class Binary files differdeleted file mode 100644 index 714ffface..000000000 --- a/lib/Compare.class +++ /dev/null diff --git a/lib/Compare.java b/lib/Compare.java deleted file mode 100644 index 762063b55..000000000 --- a/lib/Compare.java +++ /dev/null @@ -1,198 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * <http://www.apache.org/>. - */ - -import java.util.*; -import java.io.*; -import org.apache.tools.ant.Task; -import org.apache.tools.ant.BuildException; -import java.text.DateFormat; - - /** This class is an extension of Ant, a script utility from - * jakarta.apache.org. - * It provides methods to compare two files - */ - -public class Compare { - private String referenceDirectory, testDirectory; - private String [] filenameList; - private String filenames; - private static boolean IDENTICAL_FILES = true; - private static boolean NOTIDENTICAL_FILES = false; - private BufferedInputStream oldfileInput; - private BufferedInputStream newfileInput; - - //sets directory for test files - public void setTestDirectory(String testDirectory) { - if (!(testDirectory.endsWith("/") | testDirectory.endsWith("\\"))) { - testDirectory += File.separator; - } - this.testDirectory = testDirectory; - } - - //sets directory for reference files - public void setReferenceDirectory(String referenceDirectory) { - if (!(referenceDirectory.endsWith("/") | referenceDirectory.endsWith("\\"))) { - referenceDirectory += File.separator; - } - this.referenceDirectory = referenceDirectory; - } - - public void setFilenames (String filenames) { - StringTokenizer tokens = new StringTokenizer(filenames,","); - Vector filenameListTmp = new Vector(20); - while (tokens.hasMoreTokens()) { - filenameListTmp.addElement(tokens.nextToken()); - } - filenameList = new String [filenameListTmp.size()] ; - filenameListTmp.copyInto((String[]) filenameList); - } - - private boolean compareBytes (File oldFile, File newFile) { - try { - oldfileInput = new BufferedInputStream(new FileInputStream(oldFile)); - newfileInput = new BufferedInputStream(new FileInputStream(newFile)); - int charactO = 0; - int charactN = 0; - boolean identical = true; - - while (identical & (charactO != -1)) { - if (charactO == charactN) { - charactO = oldfileInput.read(); - charactN = newfileInput.read(); - } else { - return NOTIDENTICAL_FILES; - } - } - return IDENTICAL_FILES; - } catch (IOException io) { - System.err.println("Task Compare - Error: \n" + io.toString()); - } - return NOTIDENTICAL_FILES; - } - - private boolean compareFileSize(File oldFile, File newFile) { - if (oldFile.length() != newFile.length()) { - return NOTIDENTICAL_FILES; - } else { - return IDENTICAL_FILES; - } - } //end: compareBytes - - private boolean filesExist (File oldFile, File newFile) { - if (!oldFile.exists()) { - System.err.println("Task Compare - ERROR: File " - + referenceDirectory + oldFile.getName() - + " doesn't exist!"); - return false; - } else if (!newFile.exists()) { - System.err.println("Task Compare - ERROR: File " - + testDirectory + newFile.getName() + " doesn't exist!"); - return false; - } else { - return true; - } - } - - public void writeHeader (PrintWriter results) { - String dateTime = DateFormat.getDateTimeInstance(DateFormat.MEDIUM,DateFormat.MEDIUM).format(new Date()); - results.println("<html><head><title>Test Results</title></head><body>\n"); - results.println("<h2>Compare Results<br>"); - results.println("<font size='1'>created " + dateTime + "</font></h2>"); - results.println("<table cellpadding='10' border='2'><thead><th align='center'>reference file</th><th align='center'>test file</th>" - + "<th align='center'>identical?</th></thead>"); - - - } - - //main method of task compare - public void execute () throws BuildException { - boolean identical = false; - File oldFile; - File newFile; - try { - PrintWriter results = new PrintWriter (new FileWriter("results.html"),true); - this.writeHeader(results); - for (int i = 0; i < filenameList.length; i++) { - oldFile = new File (referenceDirectory + filenameList[i]); - newFile = new File (testDirectory + filenameList[i]); - if (filesExist(oldFile, newFile)) { - identical = compareFileSize(oldFile, newFile); - if (identical) { - identical = compareBytes(oldFile,newFile); - } - if (!identical) { - System.out.println("Task Compare: \nFiles " + referenceDirectory - + oldFile.getName()+ " - " + testDirectory - + newFile.getName() + " are *not* identical."); - results.println("<tr><td><a href='" + referenceDirectory + oldFile.getName() + "'>" - + oldFile.getName() + "</a> </td><td> <a href='" - + testDirectory + newFile.getName() +"'>" - + newFile.getName() +"</a>" - + " </td><td><font color='red'>No</font></td></tr>"); - } else { - results.println("<tr><td><a href='" + referenceDirectory + oldFile.getName() + "'>" - + oldFile.getName() + "</a> </td><td> <a href='" - + testDirectory + newFile.getName() + "'>" - + newFile.getName() + "</a>" - + " </td><td>Yes</td></tr>"); - } - } - } - results.println("</table></html>"); - } catch (IOException ioe) { - System.err.println("ERROR: " + ioe); - } - } //end: execute() -} - diff --git a/lib/CompileXMLFiles.class b/lib/CompileXMLFiles.class Binary files differdeleted file mode 100644 index a0ce839d2..000000000 --- a/lib/CompileXMLFiles.class +++ /dev/null diff --git a/lib/CompileXMLFiles.java b/lib/CompileXMLFiles.java deleted file mode 100644 index 531e7d36b..000000000 --- a/lib/CompileXMLFiles.java +++ /dev/null @@ -1,294 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * <http://www.apache.org/>. - * - * - */ - - /** This class is an extension of Ant, a script utility from - jakarta.apache.org. - It takes a couple of xml files conforming to the xml-site dtd and - writes them all into one xml file, deleting any reference to - the proprietary protocol sbk. The configFile determines what files - are read in what sequence. - */ -// Ant -import org.apache.tools.ant.Task; -import org.apache.tools.ant.BuildException; - - -// SAX -import org.xml.sax.Parser; -import org.xml.sax.InputSource; -import org.xml.sax.SAXException; -import org.xml.sax.SAXParseException; -import org.xml.sax.Locator; -import org.xml.sax.AttributeList; - -// Java -import java.io.*; -import java.util.*; -import java.net.URL; - -public class CompileXMLFiles extends Task - implements org.xml.sax.EntityResolver, - org.xml.sax.DTDHandler, - org.xml.sax.DocumentHandler, - org.xml.sax.ErrorHandler { - private String configFile, outFile; - private String [] filenameList; - private String filenames; - private Vector files = new Vector(); - - //sets name of configuration file, which must - //be an xml file conforming to the book.dtd used by xml-site - public void setConfigFile(String configFile) { - this.configFile = configFile; - } - - public void setOutFile(String outFile) { - this.outFile = outFile; - } - - - //main method of this task - public void execute () throws BuildException { - boolean errors = false; - - if (!(new File(configFile).exists())) { - errors = true; - System.err.println("Task CompileXMLFiles - ERROR: config file " + configFile + " is missing."); - } - - Parser parser = createParser(); - - if (parser == null) { - System.err.println("Task CompileXMLFiles - ERROR: Unable to create SAX parser"); - errors = true; - } - parser.setDocumentHandler(this); - try { - parser.parse(CompileXMLFiles.fileInputSource(configFile)); - } catch (SAXException e) { - System.out.println(e); - } catch (IOException ioe) { - System.out.println(ioe); - } - } //end: execute() - - - /*the following methods belong to the sax parser and implement the Document Handler*/ - public InputSource resolveEntity (String publicId, String systemId) - throws SAXException - { - return null; - } - - public void notationDecl (String name, String publicId, String systemId) - { - // no op - } - - public void unparsedEntityDecl (String name, String publicId, - String systemId, String notationName) - { - // no op - } - - public void setDocumentLocator (Locator locator) - { - // no op - } - - public void startDocument () - throws SAXException - { - // no op - } - - /* After the cnfiguration file has been parsed all files which - have been collected in the ArrayList files are concatinated - and written to a new (temporary) file */ - public void endDocument () - throws SAXException - { - String line, filename; - BufferedReader in; - Enumeration iterator = files.elements(); - try { - BufferedWriter out = - new BufferedWriter (new FileWriter("compileXMLFiles-tmp.xml")); - out.write("<?xml version=\"1.0\"?>\n" + - "<!DOCTYPE documentation [\n" + - "<!ENTITY nbsp \" \">\n" + - "]>\n<documentation>"); - while (iterator.hasMoreElements()) { - filename = (String) iterator.nextElement(); - in = new BufferedReader(new FileReader(filename)); - while ((line = in.readLine()) != null) { - //kill the lines pointing to the sbk protocol and the xml declaration - if (line.indexOf("<!DOCTYPE ")!= -1 || line.indexOf("<?xml ")!= -1 ) { - line = ""; - } - out.write(line+"\n"); - } - out.flush(); - } - out.write("\n</documentation>"); - out.close(); - } catch (Exception e) { - System.out.println(e); - } - - } - - public void startElement (String name, AttributeList atts) - throws SAXException { - String id, label, source; - if (name.equals("document") || name.equals("entry")) { - source = atts.getValue("source"); - files.addElement(source); - } - } - public void endElement (String name) - throws SAXException - { - // no op - } - - public void characters (char ch[], int start, int length) - throws SAXException - { - // no op - } - - public void ignorableWhitespace (char ch[], int start, int length) - throws SAXException - { - // no op - } - public void processingInstruction (String target, String data) - throws SAXException - { - // no op - } - - public void warning (SAXParseException e) - throws SAXException - { - // no op - } - public void error (SAXParseException e) - throws SAXException - { - // no op - } - - public void fatalError (SAXParseException e) - throws SAXException - { - throw e; - } - - /* ------------------------*/ - /** - * creates a SAX parser, using the value of org.xml.sax.parser - * defaulting to org.apache.xerces.parsers.SAXParser - * - * @return the created SAX parser - */ - static Parser createParser() { - String parserClassName = System.getProperty("org.xml.sax.parser"); - if (parserClassName == null) { - parserClassName = "org.apache.xerces.parsers.SAXParser"; - } - System.err.println("using SAX parser " + parserClassName); - - try { - return (Parser) Class.forName(parserClassName).newInstance(); - } catch (ClassNotFoundException e) { - System.err.println("Could not find " + parserClassName); - } catch (InstantiationException e) { - System.err.println("Could not instantiate " + parserClassName); - } catch (IllegalAccessException e) { - System.err.println("Could not access " + parserClassName); - } catch (ClassCastException e) { - System.err.println(parserClassName + " is not a SAX driver"); - } - return null; - } - - /** - * create an InputSource from a file name - * - * @param filename the name of the file - * @return the InputSource created - */ - protected static InputSource fileInputSource(String filename) { - - /* this code adapted from James Clark's in XT */ - File file = new File(filename); - String path = file.getAbsolutePath(); - String fSep = System.getProperty("file.separator"); - if (fSep != null && fSep.length() == 1) - path = path.replace(fSep.charAt(0), '/'); - if (path.length() > 0 && path.charAt(0) != '/') - path = '/' + path; - try { - return new InputSource(new URL("file", null, path).toString()); - } catch (java.net.MalformedURLException e) { - throw new Error("unexpected MalformedURLException"); - } - } - -} - diff --git a/lib/Fop.class b/lib/Fop.class Binary files differdeleted file mode 100644 index 3efe0e708..000000000 --- a/lib/Fop.class +++ /dev/null diff --git a/lib/Fop.java b/lib/Fop.java deleted file mode 100644 index d304cc3ed..000000000 --- a/lib/Fop.java +++ /dev/null @@ -1,211 +0,0 @@ -/* - - ============================================================================ - The Apache Software License, Version 1.1 - ============================================================================ - - Copyright (C) 1999 The Apache Software Foundation. All rights reserved. - - Redistribution and use in source and binary forms, with or without modifica- - tion, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - 3. The end-user documentation included with the redistribution, if any, must - include the following acknowledgment: "This product includes software - developed by the Apache Software Foundation (http://www.apache.org/)." - Alternately, this acknowledgment may appear in the software itself, if - and wherever such third-party acknowledgments normally appear. - - 4. The names "Fop" and "Apache Software Foundation" must not be used to - endorse or promote products derived from this software without prior - written permission. For written permission, please contact - apache@apache.org. - - 5. Products derived from this software may not be called "Apache", nor may - "Apache" appear in their name, without prior written permission of the - Apache Software Foundation. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- - DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - This software consists of voluntary contributions made by many individuals - on behalf of the Apache Software Foundation and was originally created by - James Tauber <jtauber@jtauber.com>. For more information on the Apache - Software Foundation, please see <http://www.apache.org/>. - - */ - -// Ant -import org.apache.tools.ant.Task; -import org.apache.tools.ant.BuildException; - - -// SAX -import org.xml.sax.XMLReader; -import org.xml.sax.InputSource; -import org.xml.sax.SAXException; -import org.xml.sax.SAXParseException; - -// Java -import java.io.*; -import java.net.URL; - -// FOP -import org.apache.fop.messaging.MessageHandler; -import org.apache.fop.apps.*; - -/** - * extension to Ant which allows usage of Fop in the - * same way as org.apache.fop.apps.CommandLine (the code is adapted from this class) - * Gets input and output filenames from the script file <br/> - * needed libraries: Sax 2 parser (defaults to Xerces-J), Jimi for images, w3c.jar - * containing org.w3c.dom.svg etc. for svg support - */ - -public class Fop { - String fofile, pdffile; - - /** - * sets the name of the input file - * @param String name of the input fo file - */ - public void setFofile(String fofile) { - this.fofile = fofile; - } - - /** - * sets the name of the output file - * @param String name of the output pdf file - */ - public void setPdffile(String pdffile) { - this.pdffile = pdffile; - } - - - /** - * creates a SAX parser, using the value of org.xml.sax.parser - * defaulting to org.apache.xerces.parsers.SAXParser - * - * @return the created SAX parser - */ - static XMLReader createParser() { - String parserClassName = System.getProperty("org.xml.sax.parser"); - if (parserClassName == null) { - parserClassName = "org.apache.xerces.parsers.SAXParser"; - } - MessageHandler.logln("using SAX parser " + parserClassName); - - try { - return (XMLReader) Class.forName( - parserClassName).newInstance(); - } catch (ClassNotFoundException e) { - MessageHandler.errorln("Could not find " + parserClassName); - } - catch (InstantiationException e) { - MessageHandler.errorln("Could not instantiate " + - parserClassName); - } - catch (IllegalAccessException e) { - MessageHandler.errorln("Could not access " + parserClassName); - } - catch (ClassCastException e) { - MessageHandler.errorln(parserClassName + " is not a SAX driver"); - } - return null; - } // end: createParser - - /** - * create an InputSource from a file name - * - * @param filename the name of the file - * @return the InputSource created - */ - protected static InputSource fileInputSource(String filename) { - - /* this code adapted from James Clark's in XT */ - File file = new File(filename); - String path = file.getAbsolutePath(); - String fSep = System.getProperty("file.separator"); - if (fSep != null && fSep.length() == 1) - path = path.replace(fSep.charAt(0), '/'); - if (path.length() > 0 && path.charAt(0) != '/') - path = '/' + path; - try { - return new InputSource(new URL("file", null, path).toString()); - } catch (java.net.MalformedURLException e) { - throw new Error("unexpected MalformedURLException"); - } - } // end: fileInputSource - - /** - * main method, starts execution of this task - * - */ - public void execute () throws BuildException { - Driver driver = new Driver(); - driver.setBaseDir(fofile); - boolean errors = false; - String version = Version.getVersion(); - MessageHandler.logln("=======================\nTask " + - version + "\nconverting file " + fofile + " to " + pdffile); - - if (!(new File(fofile).exists())) { - errors = true; - MessageHandler.errorln( - "Task Fop - ERROR: Formatting objects file " + - fofile + " missing."); - } - - XMLReader parser = createParser(); - - if (parser == null) { - MessageHandler.errorln("Task Fop - ERROR: Unable to create SAX parser"); - errors = true; - } - - // setting the parser features - try { - parser.setFeature("http://xml.org/sax/features/namespace-prefixes", - true); - } catch (SAXException e) { - MessageHandler.errorln("Error in setting up parser feature namespace-prefixes"); - MessageHandler.errorln("You need a parser which supports SAX version 2"); - System.exit(1); - } - - if (!errors) { - try { - driver.setRenderer("org.apache.fop.render.pdf.PDFRenderer", - version); - driver.addElementMapping("org.apache.fop.fo.StandardElementMapping"); - driver.addElementMapping("org.apache.fop.svg.SVGElementMapping"); - driver.addPropertyList("org.apache.fop.fo.StandardPropertyListMapping"); - driver.addPropertyList("org.apache.fop.svg.SVGPropertyListMapping"); - driver.setOutputStream(new FileOutputStream(pdffile)); - driver.buildFOTree(parser, fileInputSource(fofile)); - driver.format(); - driver.render(); - } catch (Exception e) { - MessageHandler.errorln("Task Fop - FATAL ERROR: " + - e.getMessage()); - System.exit(1); - } - } - MessageHandler.logln("=======================\n"); - } // end: execute -} - diff --git a/lib/SerializeHyphPattern.class b/lib/SerializeHyphPattern.class Binary files differdeleted file mode 100644 index 375be27a0..000000000 --- a/lib/SerializeHyphPattern.class +++ /dev/null diff --git a/lib/SerializeHyphPattern.java b/lib/SerializeHyphPattern.java deleted file mode 100644 index f43f6d762..000000000 --- a/lib/SerializeHyphPattern.java +++ /dev/null @@ -1,198 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * <http://www.apache.org/>. - */ - -//package org.apache.tools.ant.taskdefs; - -import org.apache.tools.ant.taskdefs.MatchingTask; -import org.apache.tools.ant.DirectoryScanner; -import java.net.*; -import java.io.*; -import java.util.*; -import org.xml.sax.SAXException; - -//fop -import org.apache.fop.layout.hyphenation.HyphenationTree; -import org.apache.fop.layout.hyphenation.HyphenationException; - -/** - * SerializeHyphPattern - */ - - -public class SerializeHyphPattern extends MatchingTask { - private File sourceDir, targetDir; - private boolean errorDump = false; - - /** - * Main method, which is called by ant. - */ - public void execute () throws org.apache.tools.ant.BuildException { - DirectoryScanner ds = this.getDirectoryScanner(sourceDir); - String[] files = ds.getIncludedFiles(); - for (int i = 0; i < files.length ; i++) { - processFile(files[i].substring(0, files[i].length() - 4)); - } - } //end execute - - - /** - * Sets the source directory - * - */ - public void setSourceDir (String sourceDir) { - File dir = new File(sourceDir); - if (!dir.exists()) { - System.err.println("Fatal Error: source directory " + - sourceDir + " for hyphenation files doesn't exist."); - System.exit(1); - } - this.sourceDir = dir; - } - - /** - * Sets the target directory - * - */ - public void setTargetDir (String targetDir) { - File dir = new File(targetDir); - this.targetDir = dir; - } - - /** - * more error information - * - */ - public void setErrorDump (boolean errorDump) { - this.errorDump = errorDump; - } - - - /* - * checks whether input or output files exists or the latter is older than input file - * and start build if necessary - */ - private void processFile (String filename) { - File infile = new File (sourceDir , filename + ".xml"); - File outfile = new File(targetDir , filename + ".hyp"); - long outfileLastModified = outfile.lastModified(); - boolean startProcess = true; - - startProcess = rebuild(infile, outfile); - if (startProcess) { - buildPatternFile(infile, outfile); - } - } - - /* - * serializes pattern files - */ - private void buildPatternFile (File infile, File outfile) { - System.out.println("Processing " + infile); - HyphenationTree hTree = new HyphenationTree(); - try { - hTree.loadPatterns(infile.toString()); - if (errorDump) { - System.out.println("Stats: "); - hTree.printStats(); - } - } catch (HyphenationException ex) { - System.err.println("Can't load patterns from xml file " + - infile + " - Maybe hyphenation.dtd is missing?"); - if (errorDump) { - System.err.println(ex.toString()); - } - } - //serialize class - try { - ObjectOutputStream out = new ObjectOutputStream ( - new FileOutputStream(outfile)); - out.writeObject(hTree); - out.close(); - } catch (IOException ioe) { - System.err.println("Can't write compiled pattern file: " + - outfile); - System.err.println(ioe); - } - } - - /** - * Checks for existence of output file and compares - * dates with input and stylesheet file - */ - private boolean rebuild (File infile, File outfile) { - if (outfile.exists()) { - //checks whether output file is older than input file - if (outfile.lastModified() < infile.lastModified()) { - return true; - } - } else { - //if output file does not exist, start process - return true; - } - return false; - } //end rebuild - -/* - //quick access for debugging - public static void main (String args[]) { - SerializeHyphPattern ser = new SerializeHyphPattern(); - ser.setIncludes("*.xml"); - ser.setSourceDir("\\xml-fop\\hyph\\"); - ser.setTargetDir("\\xml-fop\\hyph\\"); - ser.execute(); - } -*/ - - -} diff --git a/lib/Xslt$StylesheetCache.class b/lib/Xslt$StylesheetCache.class Binary files differdeleted file mode 100644 index cf70376ef..000000000 --- a/lib/Xslt$StylesheetCache.class +++ /dev/null diff --git a/lib/Xslt.class b/lib/Xslt.class Binary files differdeleted file mode 100644 index 335ee24d3..000000000 --- a/lib/Xslt.class +++ /dev/null diff --git a/lib/Xslt.java b/lib/Xslt.java deleted file mode 100644 index 59bae69b0..000000000 --- a/lib/Xslt.java +++ /dev/null @@ -1,387 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * <http://www.apache.org/>. - */ - -//package org.apache.tools.ant.taskdefs; - -import org.apache.tools.ant.Task; -import java.net.*; -import java.io.*; -import java.util.*; -import org.apache.xalan.xslt.*; -import org.w3c.dom.*; -import org.xml.sax.SAXException; - - -/** - * Task to call the XSLT processor Xalan (part of xml.apache.org), which converts xml files - * from a source to an output using a stylesheet file - * - * <p> - * This task can take the following arguments: - * <ul> - * <li>infile - * <li>xsltfile - * <li>outfile - * <li>smart - * <li>dependent - * </ul> - * <p> - * Of these arguments, <b>infile, outfile</b> and <b>xsltfile</b> are required. - * <p>smart defaults to 'no'. The other allowed value is 'yes'. If smart is set to 'yes' - * <P> - * xalan is only called if either the outfile is older than the infile or the stylesheet - * or the outfile doesn't exist. - * <P> - * <p>dependent defaults to 'none'. Other possible values: a comma delimited list of file names - * which date is checked against the output file. This way you can name files which, if - * they have been modified, initiate a restart of the xslt process, like external entities etc. - * <p> - * @author Fotis Jannidis <a href="mailto:fotis@jannidis.de">fotis@jannidis.de</a> - * @author Kelly A. Campbell <a href="mailto:camk@camk.net">camk@camk.net</a> - */ - - -public class Xslt extends Task { - private String infile, outfile, xsltfile, mergefile; - private String smart = "no"; //defaults to do conversion everytime task is called - private String dependent = "none"; //defaults to no dependencies - private boolean startXslt = false; - - - - /** - * Sets the input file - * - */ - public void setInfile (String infile) { - this.infile = infile; - } - - public void setMergefile (String mergefile) { - this.mergefile = mergefile; - } - - /** - * Sets the stylesheet file - * - */ - public void setXsltfile (String xsltfile) { - this.xsltfile = xsltfile; - } - - /** - * Sets the output file - * - */ - public void setOutfile (String outfile) { - this.outfile = outfile; - } - - /** - * Sets the value for smart - * - * @param option valid values: - * <ul> - * <li>yes: check whether output file is older than input or stylesheet - * <li>no: (default) do conversion everytime task is called - * </ul> - */ - public void setSmart (String smart) { - this.smart = smart; - } - - /** - * Sets the value for dependent - * - * @param option valid values: - * <ul> - * <li>none: (default) - * <li>comma delimited list of files whose existence and date is checked - * against the output file - * </ul> - */ - public void setDependent (String dependent) { - this.dependent = dependent; - } - - - /** - * Builds a document from the given file, merging the mergefile onto the end of the root node - */ - private org.w3c.dom.Document buildDocument(String xmlFile) - throws IOException, SAXException { - try { - - javax.xml.parsers.DocumentBuilder docBuilder = - javax.xml.parsers.DocumentBuilderFactory.newInstance(). - newDocumentBuilder(); - Document doc = docBuilder.parse(new FileInputStream(xmlFile)); - - if (mergefile != null && !mergefile.equals("")) { - - File mergefileF = new File(mergefile); - - Document mergedoc = - docBuilder.parse(new FileInputStream(mergefileF)); - Node mergenode = - doc.importNode(mergedoc.getDocumentElement(), true); - doc.getDocumentElement().appendChild(mergenode); - } - - return doc; - } catch (javax.xml.parsers.ParserConfigurationException e) { - System.out.println("Task xslt - SAX ERROR:\n " + - e.getMessage()); - } - return null; - } - - - /** - * Calls Xalan and does the transformation - * - */ - private void transform(String xmlSourceURL, String xslURL, - String outputURL) throws java.io.IOException, - java.net.MalformedURLException, org.xml.sax.SAXException { - StylesheetRoot stylesheet = StylesheetCache.getStylesheet(xsltfile); - - org.w3c.dom.Document source = buildDocument(infile); - - - // Create the 3 objects the XSLTProcessor needs to perform the transformation. - org.apache.xalan.xslt.XSLTInputSource xmlSource = - new org.apache.xalan.xslt.XSLTInputSource (source); - org.apache.xalan.xslt.XSLTResultTarget xmlResult = - new org.apache.xalan.xslt.XSLTResultTarget (outfile); - - // Perform the transformation. - System.out.println("============================"); - System.out.println("xslt \nin: " + infile + "\nstyle: " + - xsltfile + "\nout: " + outfile); - System.out.println("============================"); - - stylesheet.process(XSLTProcessorFactory.getProcessor(new org.apache.xalan.xpath.xdom.XercesLiaison()), - xmlSource, xmlResult); - - } //end transform - - /** - * Catches the errors transform() can throw and - * returns meaningfull error messages - */ - private void startTransform () { - try { - transform (infile, xsltfile, outfile); - } catch (org.xml.sax.SAXException saxerror) { - System.out.println("Task xslt - SAX ERROR:\n " + saxerror); - } - catch (MalformedURLException urlerror) { - System.out.println("Task xslt - URL ERROR:\n " + urlerror); - } - catch (IOException ioerror) { - System.out.println("Task xslt - IO ERROR:\n " + ioerror); - } - } //end startTransform - - /** - * Checks for existence of output file and compares - * dates with input and stylesheet file - */ - private boolean smartCheck (File outfileF, - long outfileLastModified, File infileF, File xsltfileF) { - - if (outfileF.exists()) { - //checks whether output file is older than input file or xslt stylesheet file - if ((outfileLastModified < infileF.lastModified()) | - (outfileLastModified < xsltfileF.lastModified())) { - return true; - } - } else { - //if output file does not exist, start xslt process - return true; - } - return false; - } //end smartCheck - - /** - * Checks for existence and date of dependent files - * This could be folded together with smartCheck by using - * a general routine but it wouldn't be as fast as now - */ - private boolean dependenciesCheck(File outfileF, - long outfileLastModified) { - String dependentFileName; - File dependentFile; - StringTokenizer tokens = new StringTokenizer(dependent, ","); - while (tokens.hasMoreTokens()) { - dependentFileName = (String) tokens.nextToken(); - dependentFile = new File (dependentFileName); - //check: does dependent file exist - if (dependentFile.exists()) { - //check dates - if ((outfileLastModified < dependentFile.lastModified())) { - return true; - } - } else { - System.err.println( - "Task xslt - ERROR in attribute 'dependent':\n file " + - dependentFileName + " does not exist."); - } - } - return false; - } //end dependenciesCheck - - /** - * Main method, which is called by ant. - * Checks for the value of smart and calls startTransform accordingly - */ - public void execute () throws org.apache.tools.ant.BuildException { - - File outfileF = new File (outfile); - File infileF = new File(infile); - File xsltfileF = new File (xsltfile); - long outfileLastModified = outfileF.lastModified(); - boolean startFileExist = true; - - //checks whether input and stylesheet exist. - //this could be left to the parser, but this solution does make problems if smart is set to yes - if (!infileF.exists()) { - System.err.println( - "Task xslt - ERROR:\n Input file " + infile + - " does not exist!"); - startFileExist = false; - } else if (!xsltfileF.exists()) { - System.err.println( - "Task xslt - ERROR:\n Stylesheet file " + - xsltfile + " does not exist!"); - startFileExist = false; - } - - //checks attribute 'smart' - if (smart.equals("no")) { - startXslt = true; - //if attribute smart = 'yes' - } else if (smart.equals("yes")) { - startXslt = smartCheck (outfileF, outfileLastModified, - infileF, xsltfileF); - //checks dependent files against output file, makes only sense if smartCheck returns false - if (!dependent.equals("none") & (startXslt == false)) { - startXslt = - dependenciesCheck(outfileF, outfileLastModified); - } - //returns error message, if smart has another value as 'yes' or 'no' - } else { - System.err.println("Task xslt - ERROR: Allowed values for the attribute smart are 'yes' or 'no'"); - } - if (startFileExist & startXslt) { - startTransform(); - } - } //end execute - - //quick access for debugging - //usage XSLT infile xsltfile outfile (smart is 'yes') - /* - public static void main (String args[]) { - Xslt xslt = new Xslt(); - xslt.setInfile(args[0]); - xslt.setXsltfile(args[1]); - xslt.setOutfile(args[2]); - xslt.setSmart("yes"); - xslt.setDependent("test1,test2"); - xslt.execute(); -} */ - - /** - * Cache for stylesheets we've already processed - */ - protected static class StylesheetCache { - /** Cache of compiled stylesheets (filename, StylesheetRoot) */ - private static Hashtable _stylesheetCache = new Hashtable(); - - /** - * Returns a compiled StylesheetRoot object for a given filename - */ - public static StylesheetRoot getStylesheet(String xsltFilename) - throws org.xml.sax.SAXException { - if (_stylesheetCache.containsKey(xsltFilename)) { - return (StylesheetRoot)_stylesheetCache.get(xsltFilename); - } - - // Use XSLTProcessor to instantiate an XSLTProcessor. - org.apache.xalan.xslt.XSLTProcessor processor = - org.apache.xalan.xslt.XSLTProcessorFactory.getProcessor( - new org.apache.xalan.xpath.xdom.XercesLiaison()); - - - org.apache.xalan.xslt.XSLTInputSource xslSheet = - new org.apache.xalan.xslt.XSLTInputSource ( - xsltFilename); - - // Perform the transformation. - System.out.println("****************************"); - System.out.println("xslt compile \nin: " + xsltFilename); - System.out.println("****************************"); - - StylesheetRoot compiledSheet = - processor.processStylesheet(xslSheet); - - _stylesheetCache.put(xsltFilename, compiledSheet); - return compiledSheet; - } - } - - - -} diff --git a/lib/org/apache/fop/layout/hyphenation/ByteVector.class b/lib/org/apache/fop/layout/hyphenation/ByteVector.class Binary files differdeleted file mode 100644 index 9423fa680..000000000 --- a/lib/org/apache/fop/layout/hyphenation/ByteVector.class +++ /dev/null diff --git a/lib/org/apache/fop/layout/hyphenation/CharVector.class b/lib/org/apache/fop/layout/hyphenation/CharVector.class Binary files differdeleted file mode 100644 index 03a169304..000000000 --- a/lib/org/apache/fop/layout/hyphenation/CharVector.class +++ /dev/null diff --git a/lib/org/apache/fop/layout/hyphenation/Hyphen.class b/lib/org/apache/fop/layout/hyphenation/Hyphen.class Binary files differdeleted file mode 100644 index 3dcce3150..000000000 --- a/lib/org/apache/fop/layout/hyphenation/Hyphen.class +++ /dev/null diff --git a/lib/org/apache/fop/layout/hyphenation/Hyphenation.class b/lib/org/apache/fop/layout/hyphenation/Hyphenation.class Binary files differdeleted file mode 100644 index bbf7058a3..000000000 --- a/lib/org/apache/fop/layout/hyphenation/Hyphenation.class +++ /dev/null diff --git a/lib/org/apache/fop/layout/hyphenation/HyphenationException.class b/lib/org/apache/fop/layout/hyphenation/HyphenationException.class Binary files differdeleted file mode 100644 index db37e151d..000000000 --- a/lib/org/apache/fop/layout/hyphenation/HyphenationException.class +++ /dev/null diff --git a/lib/org/apache/fop/layout/hyphenation/HyphenationTree.class b/lib/org/apache/fop/layout/hyphenation/HyphenationTree.class Binary files differdeleted file mode 100644 index 53badedaa..000000000 --- a/lib/org/apache/fop/layout/hyphenation/HyphenationTree.class +++ /dev/null diff --git a/lib/org/apache/fop/layout/hyphenation/PatternConsumer.class b/lib/org/apache/fop/layout/hyphenation/PatternConsumer.class Binary files differdeleted file mode 100644 index be95645a6..000000000 --- a/lib/org/apache/fop/layout/hyphenation/PatternConsumer.class +++ /dev/null diff --git a/lib/org/apache/fop/layout/hyphenation/PatternParser.class b/lib/org/apache/fop/layout/hyphenation/PatternParser.class Binary files differdeleted file mode 100644 index a14e741f4..000000000 --- a/lib/org/apache/fop/layout/hyphenation/PatternParser.class +++ /dev/null diff --git a/lib/org/apache/fop/layout/hyphenation/TernaryTree$Iterator$Item.class b/lib/org/apache/fop/layout/hyphenation/TernaryTree$Iterator$Item.class Binary files differdeleted file mode 100644 index ff5dc5f23..000000000 --- a/lib/org/apache/fop/layout/hyphenation/TernaryTree$Iterator$Item.class +++ /dev/null diff --git a/lib/org/apache/fop/layout/hyphenation/TernaryTree$Iterator.class b/lib/org/apache/fop/layout/hyphenation/TernaryTree$Iterator.class Binary files differdeleted file mode 100644 index 60318bb7d..000000000 --- a/lib/org/apache/fop/layout/hyphenation/TernaryTree$Iterator.class +++ /dev/null diff --git a/lib/org/apache/fop/layout/hyphenation/TernaryTree.class b/lib/org/apache/fop/layout/hyphenation/TernaryTree.class Binary files differdeleted file mode 100644 index abafb6773..000000000 --- a/lib/org/apache/fop/layout/hyphenation/TernaryTree.class +++ /dev/null diff --git a/lib/readme b/lib/readme index 3dafbcf89..6b059a267 100644 --- a/lib/readme +++ b/lib/readme @@ -1,12 +1,16 @@ This directory contains some libraries or class files necessary for compiling, running or testing Fop. -ant.jar Ant is the scripting tool which is used to build Fop or to run - the test scripts. see build.xml in root for more information -w3c.jar the svg library from the w3 consortium +ant.jar Ant is the scripting tool which is used to build Fop or to run + the test scripts. see build.xml in root for more information +w3c.jar the svg library from the w3 consortium -Compare.java a ant task which compares files -Fop.java a ant task which allows calling Fop from Ant -Xslt.java a ant task which allows calling Xalan from Ant -SerializeHyphPattern a ant task which serializes hyphenation patterns for quicker access + +buildtools.jar Ant tasks required for building FOP. Rebuild with + build.sh -f buildtools.xml in the top level directory. + (Note: if you are going to check in a new version of + buildtools.jar, make sure you have both Xalan 1 and + Xalan 2 in the classpath when building it.) + +stylebook.jar Jar used for creating the FOP website
\ No newline at end of file |