diff options
author | Tore Engvig <tore@apache.org> | 2001-07-30 20:29:35 +0000 |
---|---|---|
committer | Tore Engvig <tore@apache.org> | 2001-07-30 20:29:35 +0000 |
commit | e0edd215721150e6c04ac49706622d6189cb0b42 (patch) | |
tree | 6b59b872d9c0e93f99316ea2f421209b71a97755 /src/org/apache/fop/configuration | |
parent | eb57915dec9bcd907e495595efac60dbf3579ad8 (diff) | |
download | xmlgraphics-fop-e0edd215721150e6c04ac49706622d6189cb0b42.tar.gz xmlgraphics-fop-e0edd215721150e6c04ac49706622d6189cb0b42.zip |
Formatted code according to code standards.
Changed license to use short license.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@194380 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/org/apache/fop/configuration')
-rw-r--r-- | src/org/apache/fop/configuration/Configuration.java | 360 | ||||
-rw-r--r-- | src/org/apache/fop/configuration/ConfigurationParser.java | 142 | ||||
-rw-r--r-- | src/org/apache/fop/configuration/ConfigurationReader.java | 83 | ||||
-rw-r--r-- | src/org/apache/fop/configuration/FontInfo.java | 10 | ||||
-rw-r--r-- | src/org/apache/fop/configuration/FontTriplet.java | 3 |
5 files changed, 320 insertions, 278 deletions
diff --git a/src/org/apache/fop/configuration/Configuration.java b/src/org/apache/fop/configuration/Configuration.java index ec860c8e9..ad9deedae 100644 --- a/src/org/apache/fop/configuration/Configuration.java +++ b/src/org/apache/fop/configuration/Configuration.java @@ -1,6 +1,7 @@ -/* +/* + * $Id$ * Copyright (C) 2001 The Apache Software Foundation. All rights reserved. - * For details on use and redistribution please refer to the + * For details on use and redistribution please refer to the * LICENSE file included with these sources. */ @@ -12,32 +13,41 @@ import java.util.Enumeration; import org.apache.fop.messaging.MessageHandler; /** - * a configuration class for all general configuration aspects except those - * related to specific renderers. All configuration is stored - * in key / value pairs. The value can be a String, a list of Strings - * or a map, containing a list of key / value pairs. + * a configuration class for all general configuration aspects except those + * related to specific renderers. All configuration is stored + * in key / value pairs. The value can be a String, a list of Strings + * or a map, containing a list of key / value pairs. * */ public class Configuration { - /** defines role types */ + /** + * defines role types + */ public final static int STANDARD = 0; public final static int PDF = 1; public final static int AWT = 2; - /** stores the configuration information */ - private static Hashtable standardConfiguration = new Hashtable(30);; - private static Hashtable pdfConfiguration = new Hashtable(20); - private static Hashtable awtConfiguration = new Hashtable(20); + /** + * stores the configuration information + */ + private static Hashtable standardConfiguration = new Hashtable(30); + ; + private static Hashtable pdfConfiguration = new Hashtable(20); + private static Hashtable awtConfiguration = new Hashtable(20); - /** contains a Hashtable of existing Hashtables */ + /** + * contains a Hashtable of existing Hashtables + */ private static Hashtable configuration = new Hashtable(3); - /** loads the configuration types into the configuration Hashtable */ + /** + * loads the configuration types into the configuration Hashtable + */ static { - configuration.put("standard",standardConfiguration); - configuration.put("pdf",pdfConfiguration); - configuration.put("awt",awtConfiguration); + configuration.put("standard", standardConfiguration); + configuration.put("pdf", pdfConfiguration); + configuration.put("awt", awtConfiguration); } public static Hashtable getConfiguration() { @@ -48,105 +58,117 @@ public class Configuration { * general access method * * @param key a string containing the key value for the configuration value - * role detemines the configuration target + * role detemines the configuration target * @return Object containing the value; normally you would use one of the - * convenience methods, which return the correct form. - * null if the key is not defined. + * convenience methods, which return the correct form. + * null if the key is not defined. */ - public static Object getValue (String key, int role) { + public static Object getValue(String key, int role) { switch (role) { - case Configuration.STANDARD: - return standardConfiguration.get(key); - case Configuration.PDF: - return pdfConfiguration.get(key); - case Configuration.AWT: - return awtConfiguration.get(key); - default: - return standardConfiguration.get(key); + case Configuration.STANDARD: + return standardConfiguration.get(key); + case Configuration.PDF: + return pdfConfiguration.get(key); + case Configuration.AWT: + return awtConfiguration.get(key); + default: + return standardConfiguration.get(key); } - }; + } + + ; /** - * convenience methods to access strings values in the configuration - * @param key a string containing the key value for the configuration value - * role detemines the configuration target - * @return String a string containing the value - * null if the key is not defined. + * convenience methods to access strings values in the configuration + * @param key a string containing the key value for the configuration value + * role detemines the configuration target + * @return String a string containing the value + * null if the key is not defined. */ public static String getStringValue(String key, int role) { - Object obj = Configuration.getValue (key, role); + Object obj = Configuration.getValue(key, role); if (obj instanceof String) { - return (String) obj; + return (String)obj; } else { return null; } - }; + } + + ; /** - * convenience methods to access int values in the configuration - * @param key a string containing the key value for the configuration value - * role detemines the configuration target - * @return int a int containing the value - * -1 if the key is not defined. + * convenience methods to access int values in the configuration + * @param key a string containing the key value for the configuration value + * role detemines the configuration target + * @return int a int containing the value + * -1 if the key is not defined. */ public static int getIntValue(String key, int role) { - Object obj = Configuration.getValue (key, role); + Object obj = Configuration.getValue(key, role); if (obj instanceof String) { - return Integer.parseInt((String) obj); + return Integer.parseInt((String)obj); } else { return -1; } - }; + } + + ; /** - * convenience methods to access boolean values in the configuration - * @param key a string containing the key value for the configuration value - * role detemines the configuration target - * @return Boolean true or false as value - * null if the key is not defined. + * convenience methods to access boolean values in the configuration + * @param key a string containing the key value for the configuration value + * role detemines the configuration target + * @return Boolean true or false as value + * null if the key is not defined. */ public static Boolean getBooleanValue(String key, int role) { - Object obj = Configuration.getValue (key, role); - if (obj instanceof String) { - return new Boolean((String)obj); - } else if (obj instanceof Boolean) { - return (Boolean) obj; - } else { - return null; - } - }; + Object obj = Configuration.getValue(key, role); + if (obj instanceof String) { + return new Boolean((String)obj); + } else if (obj instanceof Boolean) { + return (Boolean)obj; + } else { + return null; + } + } + + ; /** - * convenience methods to access list values in the configuration - * @param key a string containing the key value for the configuration value - * role detemines the configuration target - * @return Vector a Vector containing the values - * null if the key is not defined. + * convenience methods to access list values in the configuration + * @param key a string containing the key value for the configuration value + * role detemines the configuration target + * @return Vector a Vector containing the values + * null if the key is not defined. */ public static Vector getListValue(String key, int role) { - Object obj = Configuration.getValue (key, role); + Object obj = Configuration.getValue(key, role); if (obj instanceof Vector) { - return (Vector) obj; + return (Vector)obj; } else { return null; } - }; + } + + ; /** - * convenience methods to access map/hashtable values in the configuration - * @param key a string containing the key value for the configuration value - * role detemines the configuration target - * @return Hashtable a Hashtable containing the values - * null if the key is not defined. + * convenience methods to access map/hashtable values in the configuration + * @param key a string containing the key value for the configuration value + * role detemines the configuration target + * @return Hashtable a Hashtable containing the values + * null if the key is not defined. */ public static Hashtable getHashtableValue(String key, int role) { - Object obj = Configuration.getValue (key, role); + Object obj = Configuration.getValue(key, role); if (obj instanceof Hashtable) { - return (Hashtable) obj; + return (Hashtable)obj; } else { return null; } - }; + } + + ; /** @@ -155,132 +177,135 @@ public class Configuration { * * @param key a string containing the key value for the configuration value * @return Object containing the value; normally you would use one of the - * convenience methods, which return the correct form. - * null if the key is not defined. + * convenience methods, which return the correct form. + * null if the key is not defined. */ - public static Object getValue (String key) { + public static Object getValue(String key) { return Configuration.getValue(key, Configuration.STANDARD); } /** - * convenience methods to access strings values in the standard configuration - * - * @param key a string containing the key value for the configuration value - * @return String a string containing the value - * null if the key is not defined. - */ + * convenience methods to access strings values in the standard configuration + * + * @param key a string containing the key value for the configuration value + * @return String a string containing the value + * null if the key is not defined. + */ public static String getStringValue(String key) { return Configuration.getStringValue(key, Configuration.STANDARD); } /** - * convenience methods to access int values in the standard configuration - * - * @param key a string containing the key value for the configuration value - * @return int a int containing the value - * -1 if the key is not defined. - */ + * convenience methods to access int values in the standard configuration + * + * @param key a string containing the key value for the configuration value + * @return int a int containing the value + * -1 if the key is not defined. + */ public static int getIntValue(String key) { return Configuration.getIntValue(key, Configuration.STANDARD); } /** - * convenience methods to access boolean values in the configuration - * - * @param key a string containing the key value for the configuration value - * @return boolean true or false as value - * null if the key is not defined. - */ + * convenience methods to access boolean values in the configuration + * + * @param key a string containing the key value for the configuration value + * @return boolean true or false as value + * null if the key is not defined. + */ public static Boolean getBooleanValue(String key) { return Configuration.getBooleanValue(key, Configuration.STANDARD); } /** - * convenience methods to access list values in the standard configuration - * - * @param key a string containing the key value for the configuration value - * @return Vector a Vector containing the values - * null if the key is not defined. - */ + * convenience methods to access list values in the standard configuration + * + * @param key a string containing the key value for the configuration value + * @return Vector a Vector containing the values + * null if the key is not defined. + */ public static Vector getListValue(String key) { return Configuration.getListValue(key, Configuration.STANDARD); } /** - * convenience methods to access map/hashtable values in the standard configuration - * - * @param key a string containing the key value for the configuration value - * @return Hashtable a Hashtable containing the values - * null if the key is not defined. - */ + * convenience methods to access map/hashtable values in the standard configuration + * + * @param key a string containing the key value for the configuration value + * @return Hashtable a Hashtable containing the values + * null if the key is not defined. + */ public static Hashtable getHashtableValue(String key) { return Configuration.getHashtableValue(key, Configuration.STANDARD); } /** - * method to access fonts values in the standard configuration - * - * @param key a string containing the key value for the configuration value - * @return Hashtable a Hashtable containing the values - * null if the key is not defined. - */ - public static Vector getFonts() { - return (Vector) Configuration.getValue("fonts", Configuration.STANDARD); - } - + * method to access fonts values in the standard configuration + * + * @param key a string containing the key value for the configuration value + * @return Hashtable a Hashtable containing the values + * null if the key is not defined. + */ + public static Vector getFonts() { + return (Vector)Configuration.getValue("fonts", + Configuration.STANDARD); + } + /** - * initializes this configuration - * @param config contains the configuration information - */ + * initializes this configuration + * @param config contains the configuration information + */ public static void setup(int role, Hashtable config) { switch (role) { - case Configuration.STANDARD: - standardConfiguration = config; - break; - case Configuration.PDF: - pdfConfiguration = config; - break; - case Configuration.AWT: - awtConfiguration = config; - break; - default: - MessageHandler.errorln("Can't setup configuration. Unknown configuration role/target"); + case Configuration.STANDARD: + standardConfiguration = config; + break; + case Configuration.PDF: + pdfConfiguration = config; + break; + case Configuration.AWT: + awtConfiguration = config; + break; + default: + MessageHandler.errorln("Can't setup configuration. Unknown configuration role/target"); } } /** - * adds information to the configuration map/hashtable in key,value form - * @param key a string containing the key value for the configuration value - * value the configuration information - * role detemines the configuration target - * @param value an Object containing the value; can be a String, a Vector or a Hashtable - */ + * adds information to the configuration map/hashtable in key,value form + * @param key a string containing the key value for the configuration value + * value the configuration information + * role detemines the configuration target + * @param value an Object containing the value; can be a String, a Vector or a Hashtable + */ public static void put(String key, Object value, int role) { switch (role) { - case Configuration.STANDARD: - standardConfiguration.put(key, value); - break; - case Configuration.PDF: - pdfConfiguration.put(key, value); - break; - case Configuration.AWT: - awtConfiguration.put(key, value); - break; - default: - standardConfiguration.put(key, value); - MessageHandler.errorln( - "Unknown role for new configuration entry. " + - "Putting key:" + key + " - value:" + value + " into standard configuration."); + case Configuration.STANDARD: + standardConfiguration.put(key, value); + break; + case Configuration.PDF: + pdfConfiguration.put(key, value); + break; + case Configuration.AWT: + awtConfiguration.put(key, value); + break; + default: + standardConfiguration.put(key, value); + MessageHandler.errorln("Unknown role for new configuration entry. " + + "Putting key:" + key + " - value:" + + value + " into standard configuration."); } - }; + } + + ; /** - * adds information to the standard configuration map/hashtable in key,value form - * @param key a string containing the key value for the configuration value - * value the configuration information - * role detemines the configuration target - * @param value an Object containing the value; can be a String, a Vector or a Hashtable + * adds information to the standard configuration map/hashtable in key,value form + * @param key a string containing the key value for the configuration value + * value the configuration information + * role detemines the configuration target + * @param value an Object containing the value; can be a String, a Vector or a Hashtable */ public static void put(String key, Object value) { @@ -288,8 +313,8 @@ public class Configuration { } /** - * debug methods, which writes out all information in this configuration - */ + * debug methods, which writes out all information in this configuration + */ public static void dumpConfiguration() { String key; Object value; @@ -298,20 +323,21 @@ public class Configuration { Enumeration enum; String tmp; System.out.println("Dumping configuration: "); - Hashtable [] configs = {standardConfiguration, - pdfConfiguration, awtConfiguration}; - for (int i = 0; i < configs.length ; i++) { + Hashtable[] configs = { + standardConfiguration, pdfConfiguration, awtConfiguration + }; + for (int i = 0; i < configs.length; i++) { MessageHandler.logln("----------------------"); configuration = configs[i]; Enumeration enumeration = configuration.keys(); while (enumeration.hasMoreElements()) { - key = (String) enumeration.nextElement(); + key = (String)enumeration.nextElement(); MessageHandler.logln("key: " + key); value = configuration.get(key); if (value instanceof String) { MessageHandler.logln(" value: " + value); } else if (value instanceof Vector) { - list = (Vector) value; + list = (Vector)value; enum = list.elements(); MessageHandler.log(" values: "); while (enum.hasMoreElements()) { @@ -319,11 +345,11 @@ public class Configuration { } MessageHandler.logln(""); } else if (value instanceof Hashtable) { - map = (Hashtable) value; + map = (Hashtable)value; enum = map.keys(); MessageHandler.log(" values: "); while (enum.hasMoreElements()) { - tmp = (String) enum.nextElement(); + tmp = (String)enum.nextElement(); MessageHandler.log(" " + tmp + ":" + map.get(tmp)); } MessageHandler.logln(""); diff --git a/src/org/apache/fop/configuration/ConfigurationParser.java b/src/org/apache/fop/configuration/ConfigurationParser.java index e06b99f43..3cce731aa 100644 --- a/src/org/apache/fop/configuration/ConfigurationParser.java +++ b/src/org/apache/fop/configuration/ConfigurationParser.java @@ -1,4 +1,5 @@ /* + * $Id$ * Copyright (C) 2001 The Apache Software Foundation. All rights reserved. * For details on use and redistribution please refer to the * LICENSE file included with these sources. @@ -7,16 +8,16 @@ package org.apache.fop.configuration; -//sax +// sax import org.xml.sax.helpers.DefaultHandler; import org.xml.sax.Attributes; import org.xml.sax.Locator; -//java +// java import java.util.Hashtable; import java.util.Vector; -//fop +// fop import org.apache.fop.messaging.MessageHandler; @@ -39,58 +40,64 @@ public class ConfigurationParser extends DefaultHandler { private final int LIST = 1; private final int MAP = 2; - //state of parser + // state of parser private int status = OUT; private int datatype = -1; - //store the result configuration + // store the result configuration private static Hashtable configuration; private static Hashtable activeConfiguration; - //stores key for new config entry + // stores key for new config entry private String key = ""; private Vector keyStack = new Vector(); - //stores string value + // stores string value private String value = ""; - //stores key for new config entry + // stores key for new config entry private String subkey = ""; - //stores list value - private Vector list = new Vector (15); + // stores list value + private Vector list = new Vector(15); - //stores hashtable value + // stores hashtable value private Hashtable map = new Hashtable(15); - /** locator for line number information */ + /** + * locator for line number information + */ private Locator locator; - /** determines role / target of configuration information, default is standard */ + /** + * determines role / target of configuration information, default is standard + */ private String role = "standard"; - //stores fonts + // stores fonts private Vector fontList = null; - //stores information on one font + // stores information on one font private FontInfo fontInfo = null; - //stores information on a font triplet + // stores information on a font triplet private FontTriplet fontTriplet = null; - //information on a font + // information on a font private String fontName, metricsFile, embedFile, kerningAsString; private boolean kerning; private Vector fontTriplets; - //information on a font triplet + // information on a font triplet private String fontTripletName, weight, style; public void startDocument() { configuration = Configuration.getConfiguration(); } - /** get locator for position information */ + /** + * get locator for position information + */ public void setDocumentLocator(Locator locator) { this.locator = locator; } @@ -98,8 +105,8 @@ public class ConfigurationParser extends DefaultHandler { /** * extracts the element and attribute name and sets the fitting status and datatype values */ - public void startElement(String uri, String localName, - String qName, Attributes attributes) { + public void startElement(String uri, String localName, String qName, + Attributes attributes) { if (localName.equals("key")) { status += IN_KEY; } else if (localName.equals("value")) { @@ -109,16 +116,16 @@ public class ConfigurationParser extends DefaultHandler { } else if (localName.equals("subentry")) { status += IN_SUBENTRY; } else if (localName.equals("entry")) { - //role=standard as default + // role=standard as default if (attributes.getLength() == 0) { role = "standard"; - //retrieve attribute value for "role" which determines configuration target + // retrieve attribute value for "role" which determines configuration target } else { role = attributes.getValue("role"); } - } else if (localName.equals("configuration")) { - } else if (localName.equals("fonts")) { //list of fonts starts - fontList = new Vector (10); + } else if (localName.equals("configuration")) {} + else if (localName.equals("fonts")) { // list of fonts starts + fontList = new Vector(10); } else if (localName.equals("font")) { kerningAsString = attributes.getValue("kerning"); if (kerningAsString.equalsIgnoreCase("yes")) { @@ -137,11 +144,11 @@ public class ConfigurationParser extends DefaultHandler { fontTriplet = new FontTriplet(fontTripletName, weight, style); fontTriplets.addElement(fontTriplet); } else { - //to make sure that user knows about false tag - MessageHandler.errorln( - "Unknown tag in configuration file: " + localName); + // to make sure that user knows about false tag + MessageHandler.errorln("Unknown tag in configuration file: " + + localName); } - } //end startElement + } // end startElement /** * stores subentries or entries into their hashes (map for subentries, configuration for entry) @@ -149,14 +156,14 @@ public class ConfigurationParser extends DefaultHandler { public void endElement(String uri, String localName, String qName) { if (localName.equals("entry")) { switch (datatype) { - case STRING: - this.store(role, key, value); - break; - case LIST: - this.store(role, key, list); - break; - case MAP: - this.store(role, key, map); + case STRING: + this.store(role, key, value); + break; + case LIST: + this.store(role, key, list); + break; + case MAP: + this.store(role, key, map); } status = OUT; role = "standard"; @@ -164,7 +171,7 @@ public class ConfigurationParser extends DefaultHandler { keyStack.removeElementAt(keyStack.size() - 1); } if (keyStack.size() > 0) { - key = (String) keyStack.elementAt(keyStack.size() - 1); + key = (String)keyStack.elementAt(keyStack.size() - 1); } else { key = ""; } @@ -176,7 +183,7 @@ public class ConfigurationParser extends DefaultHandler { keyStack.removeElementAt(keyStack.size() - 1); } if (keyStack.size() > 0) { - key = (String) keyStack.elementAt(keyStack.size() - 1); + key = (String)keyStack.elementAt(keyStack.size() - 1); } else { key = ""; } @@ -200,8 +207,7 @@ public class ConfigurationParser extends DefaultHandler { embedFile = null; fontName = null; kerningAsString = ""; - } else if (localName.equals("font-triplet")) { - } + } else if (localName.equals("font-triplet")) {} } /** @@ -209,30 +215,30 @@ public class ConfigurationParser extends DefaultHandler { * variables */ public void characters(char[] ch, int start, int length) { - char characters [] = new char [length]; + char characters[] = new char[length]; System.arraycopy(ch, start, characters, 0, length); String text = new String(characters); switch (status) { - case IN_KEY: - key = text; - break; - case IN_LIST + IN_SUBENTRY + IN_KEY: - subkey = text; - break; - case IN_VALUE: - value = text; - datatype = STRING; - break; - case IN_LIST + IN_VALUE: - list.addElement(text); - datatype = LIST; - break; - case IN_LIST + IN_SUBENTRY + IN_VALUE: - value = text; - datatype = MAP; - break; + case IN_KEY: + key = text; + break; + case IN_LIST + IN_SUBENTRY + IN_KEY: + subkey = text; + break; + case IN_VALUE: + value = text; + datatype = STRING; + break; + case IN_LIST + IN_VALUE: + list.addElement(text); + datatype = LIST; + break; + case IN_LIST + IN_SUBENTRY + IN_VALUE: + value = text; + datatype = MAP; + break; } - } //end characters + } // end characters /** * stores configuration entry into configuration hashtable according to the role @@ -241,14 +247,16 @@ public class ConfigurationParser extends DefaultHandler { * @param key a string containing the key value for the configuration * @param value a string containing the value for the configuration */ - private void store (String role, String key, Object value) { - activeConfiguration = (Hashtable) configuration.get(role); + private void store(String role, String key, Object value) { + activeConfiguration = (Hashtable)configuration.get(role); if (activeConfiguration != null) { activeConfiguration.put(key, value); } else { - MessageHandler.errorln("Unknown role >" + role + - "< for new configuration entry. \n" + - "Putting configuration with key:" + key + " into standard configuration."); + MessageHandler.errorln("Unknown role >" + role + + "< for new configuration entry. \n" + + "Putting configuration with key:" + key + + " into standard configuration."); } } + } diff --git a/src/org/apache/fop/configuration/ConfigurationReader.java b/src/org/apache/fop/configuration/ConfigurationReader.java index 1d92f3afb..3f982407f 100644 --- a/src/org/apache/fop/configuration/ConfigurationReader.java +++ b/src/org/apache/fop/configuration/ConfigurationReader.java @@ -1,4 +1,5 @@ -/* $Id$ +/* + * $Id$ * Copyright (C) 2001 The Apache Software Foundation. All rights reserved. * For details on use and redistribution please refer to the * LICENSE file included with these sources. @@ -6,38 +7,43 @@ package org.apache.fop.configuration; -//sax +// sax import org.xml.sax.helpers.DefaultHandler; import org.xml.sax.XMLReader; import org.xml.sax.SAXException; import java.io.IOException; import org.xml.sax.InputSource; -//fop +// fop import org.apache.fop.apps.Driver; import org.apache.fop.messaging.MessageHandler; import org.apache.fop.apps.FOPException; import org.apache.fop.configuration.Configuration; /** - * entry class for reading configuration from file and creating a configuration - * class. typical use looks like that: <br> + * entry class for reading configuration from file and creating a configuration + * class. typical use looks like that: <br> * - * <code>ConfigurationReader reader = new ConfigurationReader ("config.xml","standard"); - * try { - * reader.start(); - * } catch (org.apache.fop.apps.FOPException error) { - * reader.dumpError(error); - * } - * </code> - * Once the configuration has been setup, the information can be accessed with - * the methods of StandardConfiguration. + * <code>ConfigurationReader reader = new ConfigurationReader ("config.xml","standard"); + * try { + * reader.start(); + * } catch (org.apache.fop.apps.FOPException error) { + * reader.dumpError(error); + * } + * </code> + * Once the configuration has been setup, the information can be accessed with + * the methods of StandardConfiguration. */ public class ConfigurationReader { - /** show a full dump on error */ + + /** + * show a full dump on error + */ private static boolean errorDump = false; - /** inputsource for configuration file */ + /** + * inputsource for configuration file + */ private InputSource filename; @@ -45,14 +51,14 @@ public class ConfigurationReader { * creates a configuration reader * @param filename the file which contains the configuration information */ - public ConfigurationReader (InputSource filename) { + public ConfigurationReader(InputSource filename) { this.filename = filename; } /** * intantiates parser and starts parsing of config file */ - public void start () throws FOPException { + public void start() throws FOPException { XMLReader parser = createParser(); // setting the parser features @@ -60,7 +66,8 @@ public class ConfigurationReader { parser.setFeature("http://xml.org/sax/features/namespace-prefixes", false); } catch (SAXException e) { - throw new FOPException("You need a parser which supports SAX version 2",e); + throw new FOPException("You need a parser which supports SAX version 2", + e); } ConfigurationParser configurationParser = new ConfigurationParser(); parser.setContentHandler(configurationParser); @@ -69,12 +76,11 @@ public class ConfigurationReader { parser.parse(filename); } catch (SAXException e) { if (e.getException() instanceof FOPException) { - throw (FOPException) e.getException(); + throw (FOPException)e.getException(); } else { throw new FOPException(e); } - } - catch (IOException e) { + } catch (IOException e) { throw new FOPException(e); } } @@ -88,26 +94,22 @@ public class ConfigurationReader { public static XMLReader createParser() throws FOPException { String parserClassName = Driver.getParserClassName(); if (errorDump) { - MessageHandler.logln( "configuration reader using SAX parser " + - parserClassName); + MessageHandler.logln("configuration reader using SAX parser " + + parserClassName); } try { - return (XMLReader) Class.forName( - parserClassName).newInstance(); + return (XMLReader)Class.forName(parserClassName).newInstance(); } catch (ClassNotFoundException e) { throw new FOPException("Could not find " + parserClassName, e); - } - catch (InstantiationException e) { - throw new FOPException("Could not instantiate " + - parserClassName, e); - } - catch (IllegalAccessException e) { - throw new FOPException("Could not access " + - parserClassName, e); - } - catch (ClassCastException e) { - throw new FOPException(parserClassName + " is not a SAX driver",e); + } catch (InstantiationException e) { + throw new FOPException("Could not instantiate " + + parserClassName, e); + } catch (IllegalAccessException e) { + throw new FOPException("Could not access " + parserClassName, e); + } catch (ClassCastException e) { + throw new FOPException(parserClassName + " is not a SAX driver", + e); } } @@ -118,8 +120,8 @@ public class ConfigurationReader { if (errorDump) { if (e instanceof SAXException) { e.printStackTrace(); - if (((SAXException) e).getException() != null) { - ((SAXException) e).getException().printStackTrace(); + if (((SAXException)e).getException() != null) { + ((SAXException)e).getException().printStackTrace(); } } else { e.printStackTrace(); @@ -128,10 +130,11 @@ public class ConfigurationReader { } /** - * long or short error messages + * long or short error messages * */ public void setDumpError(boolean dumpError) { errorDump = dumpError; } + } diff --git a/src/org/apache/fop/configuration/FontInfo.java b/src/org/apache/fop/configuration/FontInfo.java index 07af6b12b..e552e0cd4 100644 --- a/src/org/apache/fop/configuration/FontInfo.java +++ b/src/org/apache/fop/configuration/FontInfo.java @@ -1,7 +1,8 @@ /* + * $Id$ * Copyright (C) 2001 The Apache Software Foundation. All rights reserved. * For details on use and redistribution please refer to the - * LICENSE file included with these sources." + * LICENSE file included with these sources. */ @@ -18,8 +19,8 @@ public class FontInfo { private boolean kerning; private Vector fontTriplets; - public FontInfo (String name, String metricsFile, boolean kerning, - Vector fontTriplets, String embedFile) { + public FontInfo(String name, String metricsFile, boolean kerning, + Vector fontTriplets, String embedFile) { this.name = name; this.metricsFile = metricsFile; this.embedFile = embedFile; @@ -30,12 +31,15 @@ public class FontInfo { public String getMetricsFile() { return metricsFile; } + public String getEmbedFile() { return embedFile; } + public boolean getKerning() { return kerning; } + public Vector getFontTriplets() { return fontTriplets; } diff --git a/src/org/apache/fop/configuration/FontTriplet.java b/src/org/apache/fop/configuration/FontTriplet.java index d5e927d6f..b39ab3edf 100644 --- a/src/org/apache/fop/configuration/FontTriplet.java +++ b/src/org/apache/fop/configuration/FontTriplet.java @@ -1,7 +1,8 @@ /* + * $Id$ * Copyright (C) 2001 The Apache Software Foundation. All rights reserved. * For details on use and redistribution please refer to the - * LICENSE file included with these sources." + * LICENSE file included with these sources. */ |