diff options
author | Simon Steiner <ssteiner@apache.org> | 2019-01-22 11:53:31 +0000 |
---|---|---|
committer | Simon Steiner <ssteiner@apache.org> | 2019-01-22 11:53:31 +0000 |
commit | e82460e4937fd9206bba32e2659fdfb9e2830db8 (patch) | |
tree | bb6466138b9620bdb1c5d37a05995b7fed59d88d | |
parent | d5b0798c2b6bd1aa8c65e5c744beb5d5096d1e54 (diff) | |
download | xmlgraphics-fop-e82460e4937fd9206bba32e2659fdfb9e2830db8.tar.gz xmlgraphics-fop-e82460e4937fd9206bba32e2659fdfb9e2830db8.zip |
FOP-2733: Drop dependency on Avalon-Framework
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1851806 13f79535-47bb-0310-9956-ffa450edef68
73 files changed, 863 insertions, 396 deletions
diff --git a/fop-core/pom.xml b/fop-core/pom.xml index 45af7badf..ae061197d 100644 --- a/fop-core/pom.xml +++ b/fop-core/pom.xml @@ -88,16 +88,6 @@ <version>1.8.2</version> </dependency> <dependency> - <groupId>org.apache.avalon.framework</groupId> - <artifactId>avalon-framework-api</artifactId> - <version>${avalon.version}</version> - </dependency> - <dependency> - <groupId>org.apache.avalon.framework</groupId> - <artifactId>avalon-framework-impl</artifactId> - <version>${avalon.version}</version> - </dependency> - <dependency> <groupId>org.apache.pdfbox</groupId> <artifactId>fontbox</artifactId> <version>2.0.13</version> diff --git a/fop-core/src/main/java/org/apache/fop/activity/ContainerUtil.java b/fop-core/src/main/java/org/apache/fop/activity/ContainerUtil.java new file mode 100644 index 000000000..00476d504 --- /dev/null +++ b/fop-core/src/main/java/org/apache/fop/activity/ContainerUtil.java @@ -0,0 +1,48 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* $Id: Accessibility.java 1343632 2012-05-29 09:48:03Z vhennebert $ */ +package org.apache.fop.activity; + +import org.apache.fop.configuration.Configurable; +import org.apache.fop.configuration.Configuration; +import org.apache.fop.configuration.ConfigurationException; + +public final class ContainerUtil { + + private ContainerUtil() { + // Never invoked. + } + + public static void configure(Configurable configurable, Configuration configuration) { + try { + configurable.configure(configuration); + } catch (ConfigurationException e) { + e.printStackTrace(); + throw new IllegalStateException(e); + } + } + + public static void initialize(Initializable initializable) { + try { + initializable.initialize(); + } catch (Exception e) { + e.printStackTrace(); + throw new IllegalStateException(e); + } + } +} diff --git a/fop-core/src/main/java/org/apache/fop/activity/Initializable.java b/fop-core/src/main/java/org/apache/fop/activity/Initializable.java new file mode 100644 index 000000000..9c46b70b3 --- /dev/null +++ b/fop-core/src/main/java/org/apache/fop/activity/Initializable.java @@ -0,0 +1,24 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* $Id: Accessibility.java 1343632 2012-05-29 09:48:03Z vhennebert $ */ +package org.apache.fop.activity; + +public interface Initializable { + + void initialize() throws Exception; +} diff --git a/fop-core/src/main/java/org/apache/fop/apps/FOUserAgent.java b/fop-core/src/main/java/org/apache/fop/apps/FOUserAgent.java index 2aaa2ad22..51c0d8869 100644 --- a/fop-core/src/main/java/org/apache/fop/apps/FOUserAgent.java +++ b/fop-core/src/main/java/org/apache/fop/apps/FOUserAgent.java @@ -30,8 +30,6 @@ import java.util.Map; import javax.xml.transform.Source; import javax.xml.transform.stream.StreamSource; -import org.apache.avalon.framework.configuration.Configuration; -import org.apache.avalon.framework.configuration.ConfigurationException; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -47,6 +45,8 @@ import org.apache.fop.accessibility.Accessibility; import org.apache.fop.accessibility.DummyStructureTreeEventHandler; import org.apache.fop.accessibility.StructureTreeEventHandler; import org.apache.fop.apps.io.InternalResourceResolver; +import org.apache.fop.configuration.Configuration; +import org.apache.fop.configuration.ConfigurationException; import org.apache.fop.events.DefaultEventBroadcaster; import org.apache.fop.events.Event; import org.apache.fop.events.EventBroadcaster; diff --git a/fop-core/src/main/java/org/apache/fop/apps/FopConfParser.java b/fop-core/src/main/java/org/apache/fop/apps/FopConfParser.java index c68226db5..7dcbae34c 100644 --- a/fop-core/src/main/java/org/apache/fop/apps/FopConfParser.java +++ b/fop-core/src/main/java/org/apache/fop/apps/FopConfParser.java @@ -31,9 +31,6 @@ import java.util.Map; import org.xml.sax.SAXException; -import org.apache.avalon.framework.configuration.Configuration; -import org.apache.avalon.framework.configuration.ConfigurationException; -import org.apache.avalon.framework.configuration.DefaultConfigurationBuilder; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -43,6 +40,9 @@ import org.apache.xmlgraphics.io.ResourceResolver; import org.apache.fop.apps.io.InternalResourceResolver; import org.apache.fop.apps.io.ResourceResolverFactory; +import org.apache.fop.configuration.Configuration; +import org.apache.fop.configuration.ConfigurationException; +import org.apache.fop.configuration.DefaultConfigurationBuilder; import org.apache.fop.fonts.FontManagerConfigurator; import org.apache.fop.hyphenation.HyphenationTreeCache; import org.apache.fop.hyphenation.Hyphenator; diff --git a/fop-core/src/main/java/org/apache/fop/apps/FopFactory.java b/fop-core/src/main/java/org/apache/fop/apps/FopFactory.java index 100b028e9..2e640ce6d 100644 --- a/fop-core/src/main/java/org/apache/fop/apps/FopFactory.java +++ b/fop-core/src/main/java/org/apache/fop/apps/FopFactory.java @@ -30,7 +30,6 @@ import java.util.Set; import org.xml.sax.SAXException; -import org.apache.avalon.framework.configuration.Configuration; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -41,6 +40,7 @@ import org.apache.xmlgraphics.util.UnitConv; import org.apache.fop.apps.io.InternalResourceResolver; import org.apache.fop.apps.io.ResourceResolverFactory; +import org.apache.fop.configuration.Configuration; import org.apache.fop.fo.ElementMapping; import org.apache.fop.fo.ElementMappingRegistry; import org.apache.fop.fonts.FontManager; diff --git a/fop-core/src/main/java/org/apache/fop/apps/FopFactoryBuilder.java b/fop-core/src/main/java/org/apache/fop/apps/FopFactoryBuilder.java index 92f0e8a17..84f85cdbd 100644 --- a/fop-core/src/main/java/org/apache/fop/apps/FopFactoryBuilder.java +++ b/fop-core/src/main/java/org/apache/fop/apps/FopFactoryBuilder.java @@ -26,8 +26,6 @@ import java.util.HashSet; import java.util.Map; import java.util.Set; -import org.apache.avalon.framework.configuration.Configuration; - import org.apache.xmlgraphics.image.loader.ImageContext; import org.apache.xmlgraphics.image.loader.ImageManager; import org.apache.xmlgraphics.image.loader.impl.AbstractImageSessionContext.FallbackResolver; @@ -35,6 +33,7 @@ import org.apache.xmlgraphics.io.ResourceResolver; import org.apache.fop.apps.io.InternalResourceResolver; import org.apache.fop.apps.io.ResourceResolverFactory; +import org.apache.fop.configuration.Configuration; import org.apache.fop.fonts.FontManager; import org.apache.fop.layoutmgr.LayoutManagerMaker; diff --git a/fop-core/src/main/java/org/apache/fop/apps/FopFactoryConfig.java b/fop-core/src/main/java/org/apache/fop/apps/FopFactoryConfig.java index 47df64599..37482244b 100644 --- a/fop-core/src/main/java/org/apache/fop/apps/FopFactoryConfig.java +++ b/fop-core/src/main/java/org/apache/fop/apps/FopFactoryConfig.java @@ -23,13 +23,12 @@ import java.net.URI; import java.util.Map; import java.util.Set; -import org.apache.avalon.framework.configuration.Configuration; - import org.apache.xmlgraphics.image.loader.ImageManager; import org.apache.xmlgraphics.image.loader.impl.AbstractImageSessionContext.FallbackResolver; import org.apache.xmlgraphics.io.ResourceResolver; import org.apache.fop.apps.io.InternalResourceResolver; +import org.apache.fop.configuration.Configuration; import org.apache.fop.fonts.FontManager; import org.apache.fop.layoutmgr.LayoutManagerMaker; diff --git a/fop-core/src/main/java/org/apache/fop/cli/Main.java b/fop-core/src/main/java/org/apache/fop/cli/Main.java index e082265f1..b8ba68df9 100644 --- a/fop-core/src/main/java/org/apache/fop/cli/Main.java +++ b/fop-core/src/main/java/org/apache/fop/cli/Main.java @@ -112,9 +112,6 @@ public final class Main { try { //System.out.println(Thread.currentThread().getContextClassLoader()); Class clazz = Class.forName("org.apache.commons.io.IOUtils"); - if (clazz != null) { - clazz = Class.forName("org.apache.avalon.framework.configuration.Configuration"); - } return (clazz != null); } catch (Exception e) { return false; diff --git a/fop-core/src/main/java/org/apache/fop/configuration/Configurable.java b/fop-core/src/main/java/org/apache/fop/configuration/Configurable.java new file mode 100644 index 000000000..79f87b768 --- /dev/null +++ b/fop-core/src/main/java/org/apache/fop/configuration/Configurable.java @@ -0,0 +1,24 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* $Id: Accessibility.java 1343632 2012-05-29 09:48:03Z vhennebert $ */ +package org.apache.fop.configuration; + +public interface Configurable { + + void configure(Configuration cfg) throws ConfigurationException; +} diff --git a/fop-core/src/main/java/org/apache/fop/configuration/Configuration.java b/fop-core/src/main/java/org/apache/fop/configuration/Configuration.java new file mode 100644 index 000000000..674a91f39 --- /dev/null +++ b/fop-core/src/main/java/org/apache/fop/configuration/Configuration.java @@ -0,0 +1,61 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* $Id: Accessibility.java 1343632 2012-05-29 09:48:03Z vhennebert $ */ +package org.apache.fop.configuration; + +public interface Configuration { + + Configuration getChild(String key); + + Configuration getChild(String key, boolean required); + + Configuration[] getChildren(String key); + + String[] getAttributeNames(); + + String getAttribute(String key) throws ConfigurationException; + + String getAttribute(String key, String defaultValue); + + boolean getAttributeAsBoolean(String key, boolean defaultValue); + + float getAttributeAsFloat(String key) throws ConfigurationException; + + float getAttributeAsFloat(String key, float defaultValue); + + int getAttributeAsInteger(String key, int defaultValue); + + String getValue() throws ConfigurationException; + + String getValue(String defaultValue); + + boolean getValueAsBoolean() throws ConfigurationException; + + boolean getValueAsBoolean(boolean defaultValue); + + int getValueAsInteger() throws ConfigurationException; + + int getValueAsInteger(int defaultValue); + + float getValueAsFloat() throws ConfigurationException; + + float getValueAsFloat(float defaultValue); + + String getLocation(); + +} diff --git a/fop-core/src/main/java/org/apache/fop/configuration/ConfigurationException.java b/fop-core/src/main/java/org/apache/fop/configuration/ConfigurationException.java new file mode 100644 index 000000000..66b68ab72 --- /dev/null +++ b/fop-core/src/main/java/org/apache/fop/configuration/ConfigurationException.java @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* $Id: Accessibility.java 1343632 2012-05-29 09:48:03Z vhennebert $ */ +package org.apache.fop.configuration; + +public class ConfigurationException extends Exception { + + public ConfigurationException(String message) { + super(message); + } + + public ConfigurationException(String message, Throwable cause) { + super(message, cause); + } +} diff --git a/fop-core/src/main/java/org/apache/fop/configuration/DefaultConfiguration.java b/fop-core/src/main/java/org/apache/fop/configuration/DefaultConfiguration.java new file mode 100644 index 000000000..22f28a170 --- /dev/null +++ b/fop-core/src/main/java/org/apache/fop/configuration/DefaultConfiguration.java @@ -0,0 +1,293 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* $Id: Accessibility.java 1343632 2012-05-29 09:48:03Z vhennebert $ */ +package org.apache.fop.configuration; + +import java.io.StringWriter; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.transform.OutputKeys; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerException; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; + +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.NamedNodeMap; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; + +public class DefaultConfiguration implements Configuration { + + static final DocumentBuilderFactory DBF = DocumentBuilderFactory.newInstance(); + + static { + DBF.setNamespaceAware(false); + DBF.setValidating(false); + DBF.setIgnoringComments(true); + DBF.setIgnoringElementContentWhitespace(true); + DBF.setExpandEntityReferences(true); + } + + /** + * @deprecated For debug only. + */ + public static String toString(Document document) { + try { + Transformer transformer = TransformerFactory.newInstance().newTransformer(); + transformer.setOutputProperty(OutputKeys.INDENT, "yes"); + transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2"); + //initialize StreamResult with File object to save to file + StreamResult result = new StreamResult(new StringWriter()); + DOMSource source = new DOMSource(document); + transformer.transform(source, result); + return result.getWriter().toString(); + } catch (TransformerException e) { + throw new IllegalStateException(e); + } + } + + private Element element; + + public DefaultConfiguration(String key) { + DocumentBuilder builder = null; + try { + builder = DBF.newDocumentBuilder(); + } catch (ParserConfigurationException e) { + e.printStackTrace(); + throw new IllegalStateException(e); + } + Document doc = builder.newDocument(); + // create the root element node + element = doc.createElement(key); + doc.appendChild(element); + } + + DefaultConfiguration(Element element) { + this.element = element; + } + + Element getElement() { + return element; + } + + public void addChild(DefaultConfiguration configuration) { + Element node = (Element) element.getOwnerDocument().importNode(configuration.getElement(), true); + element.appendChild(node); + } + + String getValue0() { + String result = element.getTextContent(); + if (result == null) { + result = ""; + } + return result; + } + + @Override + public Configuration getChild(String key) { + NodeList nl = element.getElementsByTagName(key); + for (int i = 0; i < nl.getLength(); ++i) { + Node n = nl.item(i); + if (n.getNodeName().equals(key)) { + return new DefaultConfiguration((Element) n); + } + } + return NullConfiguration.INSTANCE; + } + + @Override + public Configuration getChild(String key, boolean required) { + Configuration result = getChild(key); + if (!required && result == NullConfiguration.INSTANCE) { + return null; + } + if (required && (result == null || result == NullConfiguration.INSTANCE)) { + // throw new IllegalStateException("No child '" + key + "'"); + return NullConfiguration.INSTANCE; + } + return result; + } + + @Override + public Configuration[] getChildren(String key) { + NodeList nl = element.getElementsByTagName(key); + Configuration[] result = new Configuration[nl.getLength()]; + for (int i = 0; i < nl.getLength(); ++i) { + Node n = nl.item(i); + result[i] = new DefaultConfiguration((Element) n); + } + return result; + } + + @Override + public String[] getAttributeNames() { + NamedNodeMap nnm = element.getAttributes(); + String[] result = new String[nnm.getLength()]; + for (int i = 0; i < nnm.getLength(); ++i) { + Node n = nnm.item(i); + result[i] = n.getNodeName(); + } + return result; + } + + @Override + public String getAttribute(String key) { + String result = element.getAttribute(key); + if ("".equals(result)) { + result = null; + } + return result; + } + + @Override + public String getAttribute(String key, String defaultValue) { + String result = getAttribute(key); + if (result == null || "".equals(result)) { + result = defaultValue; + } + return result; + } + + @Override + public boolean getAttributeAsBoolean(String key, boolean defaultValue) { + String result = getAttribute(key); + if (result == null || "".equals(result)) { + return defaultValue; + } + return "true".equalsIgnoreCase(result) || "yes".equalsIgnoreCase(result); + } + + @Override + public float getAttributeAsFloat(String key) throws ConfigurationException { + return Float.parseFloat(getAttribute(key)); + } + + @Override + public float getAttributeAsFloat(String key, float defaultValue) { + String result = getAttribute(key); + if (result == null || "".equals(result)) { + return defaultValue; + } + return Float.parseFloat(result); + } + + @Override + public int getAttributeAsInteger(String key, int defaultValue) { + String result = getAttribute(key); + if (result == null || "".equals(result)) { + return defaultValue; + } + return Integer.parseInt(result); + } + + @Override + public String getValue() throws ConfigurationException { + String result = getValue0(); + if (result == null || "".equals(result)) { + throw new ConfigurationException("No value in " + element.getNodeName()); + } + return result; + } + + @Override + public String getValue(String defaultValue) { + String result = getValue0(); + if (result == null || "".equals(result)) { + result = defaultValue; + } + return result; + } + + @Override + public boolean getValueAsBoolean() throws ConfigurationException { + return Boolean.parseBoolean(getValue0()); + } + + @Override + public boolean getValueAsBoolean(boolean defaultValue) { + String result = getValue0().trim(); + if ("".equals(result)) { + return defaultValue; + } + return Boolean.parseBoolean(result); + } + + @Override + public int getValueAsInteger() throws ConfigurationException { + try { + return Integer.parseInt(getValue0()); + } catch (NumberFormatException e) { + throw new ConfigurationException("Not an integer", e); + } + } + + @Override + public int getValueAsInteger(int defaultValue) { + String result = getValue0(); + if (result == null || "".equals(result)) { + return defaultValue; + } + return Integer.parseInt(result); + } + + @Override + public float getValueAsFloat() throws ConfigurationException { + try { + return Float.parseFloat(getValue0()); + } catch (NumberFormatException e) { + throw new ConfigurationException("Not a float", e); + } + } + + @Override + public float getValueAsFloat(float defaultValue) { + String result = getValue0(); + if (result == null || "".equals(result)) { + return defaultValue; + } + return Float.parseFloat(getValue0()); + } + + @Override + public String getLocation() { + List<String> path = new ArrayList<String>(); + for (Node el = element; el != null; el = el.getParentNode()) { + if (el instanceof Element) { + path.add(((Element) el).getTagName()); + } + } + Collections.reverse(path); + + StringBuilder sb = new StringBuilder(); + for (String s : path) { + if (sb.length() > 0) { + sb.append("/"); + } + sb.append(s); + } + return sb.toString(); + } +} diff --git a/fop-core/src/main/java/org/apache/fop/configuration/DefaultConfigurationBuilder.java b/fop-core/src/main/java/org/apache/fop/configuration/DefaultConfigurationBuilder.java new file mode 100644 index 000000000..5abf8f499 --- /dev/null +++ b/fop-core/src/main/java/org/apache/fop/configuration/DefaultConfigurationBuilder.java @@ -0,0 +1,76 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* $Id: Accessibility.java 1343632 2012-05-29 09:48:03Z vhennebert $ */ +package org.apache.fop.configuration; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.ParserConfigurationException; + +import org.w3c.dom.DOMException; +import org.w3c.dom.Document; +import org.xml.sax.SAXException; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +public class DefaultConfigurationBuilder { + + private static final Log LOG = LogFactory.getLog(DefaultConfigurationBuilder.class.getName()); + + public DefaultConfiguration build(InputStream confStream) throws ConfigurationException { + try { + DocumentBuilder builder = DefaultConfiguration.DBF.newDocumentBuilder(); + Document document = builder.parse(confStream); + return new DefaultConfiguration(document.getDocumentElement()); + } catch (DOMException e) { + throw new ConfigurationException("xml parse error", e); + } catch (ParserConfigurationException e) { + throw new ConfigurationException("xml parse error", e); + } catch (IOException e) { + throw new ConfigurationException("xml parse error", e); + } catch (SAXException e) { + throw new ConfigurationException("xml parse error", e); + } finally { + try { + confStream.close(); + } catch (IOException e) { + throw new IllegalStateException(e); + } + } + } + + public DefaultConfiguration buildFromFile(File file) throws ConfigurationException { + try { + DocumentBuilder builder = DefaultConfiguration.DBF.newDocumentBuilder(); + Document document = builder.parse(file); + return new DefaultConfiguration(document.getDocumentElement()); + } catch (DOMException e) { + throw new ConfigurationException("xml parse error", e); + } catch (ParserConfigurationException e) { + throw new ConfigurationException("xml parse error", e); + } catch (IOException e) { + throw new ConfigurationException("xml parse error", e); + } catch (SAXException e) { + throw new ConfigurationException("xml parse error", e); + } + } +} diff --git a/fop-core/src/main/java/org/apache/fop/configuration/NullConfiguration.java b/fop-core/src/main/java/org/apache/fop/configuration/NullConfiguration.java new file mode 100644 index 000000000..a15ed9ef9 --- /dev/null +++ b/fop-core/src/main/java/org/apache/fop/configuration/NullConfiguration.java @@ -0,0 +1,124 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* $Id: Accessibility.java 1343632 2012-05-29 09:48:03Z vhennebert $ */ +package org.apache.fop.configuration; + +final class NullConfiguration implements Configuration { + + static final NullConfiguration INSTANCE = new NullConfiguration(); + + private NullConfiguration() { + + } + + @Override + public Configuration getChild(String key) { + return INSTANCE; + } + + @Override + public Configuration getChild(String key, boolean required) { + return INSTANCE; + } + + @Override + public Configuration[] getChildren(String key) { + return new Configuration[0]; + } + + @Override + public String[] getAttributeNames() { + return new String[0]; + } + + @Override + public String getAttribute(String key) throws ConfigurationException { + return ""; + } + + @Override + public String getAttribute(String key, String defaultValue) { + return defaultValue; + } + + @Override + public boolean getAttributeAsBoolean(String key, boolean defaultValue) { + return defaultValue; + } + + @Override + public float getAttributeAsFloat(String key) throws ConfigurationException { + return 0; + } + + @Override + public float getAttributeAsFloat(String key, float defaultValue) { + return defaultValue; + } + + @Override + public int getAttributeAsInteger(String key, int defaultValue) { + return defaultValue; + } + + @Override + public String getValue() throws ConfigurationException { + // return null; + throw new ConfigurationException("missing value"); + } + + @Override + public String getValue(String defaultValue) { + return defaultValue; + } + + @Override + public boolean getValueAsBoolean() throws ConfigurationException { + return false; + } + + @Override + public boolean getValueAsBoolean(boolean defaultValue) { + return defaultValue; + } + + @Override + public int getValueAsInteger() throws ConfigurationException { + return 0; + } + + @Override + public int getValueAsInteger(int defaultValue) { + return defaultValue; + } + + @Override + public float getValueAsFloat() throws ConfigurationException { + return 0; + } + + @Override + public float getValueAsFloat(float defaultValue) { + return defaultValue; + } + + @Override + public String getLocation() { + return "<no-location>"; + } +} diff --git a/fop-core/src/main/java/org/apache/fop/fonts/DefaultFontConfig.java b/fop-core/src/main/java/org/apache/fop/fonts/DefaultFontConfig.java index af162ee35..a1663756c 100644 --- a/fop-core/src/main/java/org/apache/fop/fonts/DefaultFontConfig.java +++ b/fop-core/src/main/java/org/apache/fop/fonts/DefaultFontConfig.java @@ -23,12 +23,12 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; -import org.apache.avalon.framework.configuration.Configuration; -import org.apache.avalon.framework.configuration.ConfigurationException; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.fop.apps.FOPException; +import org.apache.fop.configuration.Configuration; +import org.apache.fop.configuration.ConfigurationException; import org.apache.fop.events.EventProducer; import org.apache.fop.util.LogUtil; diff --git a/fop-core/src/main/java/org/apache/fop/fonts/FontConfig.java b/fop-core/src/main/java/org/apache/fop/fonts/FontConfig.java index 167baf09e..db4b724c2 100644 --- a/fop-core/src/main/java/org/apache/fop/fonts/FontConfig.java +++ b/fop-core/src/main/java/org/apache/fop/fonts/FontConfig.java @@ -19,9 +19,8 @@ package org.apache.fop.fonts; -import org.apache.avalon.framework.configuration.Configuration; - import org.apache.fop.apps.FOPException; +import org.apache.fop.configuration.Configuration; import org.apache.fop.events.EventProducer; /** @@ -45,6 +44,6 @@ public interface FontConfig { * @throws FOPException if an error occurs creating the font configuration object */ FontConfig parse(Configuration cfg, FontManager fontManager, boolean strict, - EventProducer eventProducer) throws FOPException; + EventProducer eventProducer) throws FOPException; } } diff --git a/fop-core/src/main/java/org/apache/fop/fonts/FontManagerConfigurator.java b/fop-core/src/main/java/org/apache/fop/fonts/FontManagerConfigurator.java index 01502c5c2..dbe430ad4 100644 --- a/fop-core/src/main/java/org/apache/fop/fonts/FontManagerConfigurator.java +++ b/fop-core/src/main/java/org/apache/fop/fonts/FontManagerConfigurator.java @@ -24,8 +24,6 @@ import java.net.URISyntaxException; import java.util.List; import java.util.regex.Pattern; -import org.apache.avalon.framework.configuration.Configuration; -import org.apache.avalon.framework.configuration.ConfigurationException; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -34,6 +32,8 @@ import org.apache.xmlgraphics.io.ResourceResolver; import org.apache.fop.apps.FOPException; import org.apache.fop.apps.io.InternalResourceResolver; import org.apache.fop.apps.io.ResourceResolverFactory; +import org.apache.fop.configuration.Configuration; +import org.apache.fop.configuration.ConfigurationException; import org.apache.fop.fonts.substitute.FontSubstitutions; import org.apache.fop.fonts.substitute.FontSubstitutionsConfigurator; import org.apache.fop.util.LogUtil; diff --git a/fop-core/src/main/java/org/apache/fop/fonts/substitute/FontSubstitutionsConfigurator.java b/fop-core/src/main/java/org/apache/fop/fonts/substitute/FontSubstitutionsConfigurator.java index 885a4d2a1..2c38c3f63 100644 --- a/fop-core/src/main/java/org/apache/fop/fonts/substitute/FontSubstitutionsConfigurator.java +++ b/fop-core/src/main/java/org/apache/fop/fonts/substitute/FontSubstitutionsConfigurator.java @@ -19,9 +19,8 @@ package org.apache.fop.fonts.substitute; -import org.apache.avalon.framework.configuration.Configuration; - import org.apache.fop.apps.FOPException; +import org.apache.fop.configuration.Configuration; /** * Configures a font substitution catalog diff --git a/fop-core/src/main/java/org/apache/fop/render/RendererConfig.java b/fop-core/src/main/java/org/apache/fop/render/RendererConfig.java index 4b3b63a51..d629a2716 100644 --- a/fop-core/src/main/java/org/apache/fop/render/RendererConfig.java +++ b/fop-core/src/main/java/org/apache/fop/render/RendererConfig.java @@ -19,10 +19,9 @@ package org.apache.fop.render; -import org.apache.avalon.framework.configuration.Configuration; - import org.apache.fop.apps.FOPException; import org.apache.fop.apps.FOUserAgent; +import org.apache.fop.configuration.Configuration; import org.apache.fop.fonts.FontConfig; /** diff --git a/fop-core/src/main/java/org/apache/fop/render/RendererConfigOption.java b/fop-core/src/main/java/org/apache/fop/render/RendererConfigOption.java index 5b670d07a..632932d74 100644 --- a/fop-core/src/main/java/org/apache/fop/render/RendererConfigOption.java +++ b/fop-core/src/main/java/org/apache/fop/render/RendererConfigOption.java @@ -26,4 +26,6 @@ package org.apache.fop.render; public interface RendererConfigOption { /** The name of the option. */ String getName(); + + Object getDefaultValue(); } diff --git a/fop-core/src/main/java/org/apache/fop/render/XMLHandlerConfigurator.java b/fop-core/src/main/java/org/apache/fop/render/XMLHandlerConfigurator.java index ac50da273..6c594b9a2 100644 --- a/fop-core/src/main/java/org/apache/fop/render/XMLHandlerConfigurator.java +++ b/fop-core/src/main/java/org/apache/fop/render/XMLHandlerConfigurator.java @@ -19,13 +19,13 @@ package org.apache.fop.render; -import org.apache.avalon.framework.configuration.Configuration; -import org.apache.avalon.framework.configuration.ConfigurationException; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.fop.apps.FOPException; import org.apache.fop.apps.FOUserAgent; +import org.apache.fop.configuration.Configuration; +import org.apache.fop.configuration.ConfigurationException; /** * Configurator for XMLHandler objects. diff --git a/fop-core/src/main/java/org/apache/fop/render/afp/AFPFontConfig.java b/fop-core/src/main/java/org/apache/fop/render/afp/AFPFontConfig.java index 1ebc4b83e..f6a0a2a75 100644 --- a/fop-core/src/main/java/org/apache/fop/render/afp/AFPFontConfig.java +++ b/fop-core/src/main/java/org/apache/fop/render/afp/AFPFontConfig.java @@ -27,8 +27,6 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; -import org.apache.avalon.framework.configuration.Configuration; -import org.apache.avalon.framework.configuration.ConfigurationException; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -44,6 +42,8 @@ import org.apache.fop.afp.fonts.RasterFont; import org.apache.fop.afp.util.AFPResourceAccessor; import org.apache.fop.apps.FOPException; import org.apache.fop.apps.io.InternalResourceResolver; +import org.apache.fop.configuration.Configuration; +import org.apache.fop.configuration.ConfigurationException; import org.apache.fop.events.EventProducer; import org.apache.fop.fonts.EmbedFontInfo; import org.apache.fop.fonts.FontConfig; @@ -85,7 +85,7 @@ public final class AFPFontConfig implements FontConfig { /** {@inheritDoc}} */ public AFPFontConfig parse(Configuration cfg, FontManager fontManager, boolean strict, - EventProducer eventProducer) throws FOPException { + EventProducer eventProducer) throws FOPException { try { return new ParserHelper(cfg, fontManager, strict, (AFPEventProducer) eventProducer).fontConfig; diff --git a/fop-core/src/main/java/org/apache/fop/render/afp/AFPInfo.java b/fop-core/src/main/java/org/apache/fop/render/afp/AFPInfo.java index 647a8a7c0..b20d12895 100644 --- a/fop-core/src/main/java/org/apache/fop/render/afp/AFPInfo.java +++ b/fop-core/src/main/java/org/apache/fop/render/afp/AFPInfo.java @@ -19,12 +19,11 @@ package org.apache.fop.render.afp; -import org.apache.avalon.framework.configuration.Configuration; - import org.apache.fop.afp.AFPGraphics2D; import org.apache.fop.afp.AFPPaintingState; import org.apache.fop.afp.AFPResourceInfo; import org.apache.fop.afp.AFPResourceManager; +import org.apache.fop.configuration.Configuration; import org.apache.fop.fonts.FontInfo; /** diff --git a/fop-core/src/main/java/org/apache/fop/render/afp/AFPRendererConfig.java b/fop-core/src/main/java/org/apache/fop/render/afp/AFPRendererConfig.java index 062933df6..d6b81e676 100644 --- a/fop-core/src/main/java/org/apache/fop/render/afp/AFPRendererConfig.java +++ b/fop-core/src/main/java/org/apache/fop/render/afp/AFPRendererConfig.java @@ -23,8 +23,6 @@ import java.net.URI; import java.net.URISyntaxException; import java.util.EnumMap; -import org.apache.avalon.framework.configuration.Configuration; -import org.apache.avalon.framework.configuration.ConfigurationException; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -38,6 +36,8 @@ import org.apache.fop.apps.FOPException; import org.apache.fop.apps.FOUserAgent; import org.apache.fop.apps.MimeConstants; import org.apache.fop.apps.io.InternalResourceResolver; +import org.apache.fop.configuration.Configuration; +import org.apache.fop.configuration.ConfigurationException; import org.apache.fop.fonts.FontManager; import org.apache.fop.render.RendererConfig; import org.apache.fop.render.afp.AFPFontConfig.AFPFontInfoConfigParser; diff --git a/fop-core/src/main/java/org/apache/fop/render/afp/AFPRendererContext.java b/fop-core/src/main/java/org/apache/fop/render/afp/AFPRendererContext.java index c05666863..c5a44ff61 100644 --- a/fop-core/src/main/java/org/apache/fop/render/afp/AFPRendererContext.java +++ b/fop-core/src/main/java/org/apache/fop/render/afp/AFPRendererContext.java @@ -21,12 +21,11 @@ package org.apache.fop.render.afp; import java.util.Map; -import org.apache.avalon.framework.configuration.Configuration; - import org.apache.fop.afp.AFPPaintingState; import org.apache.fop.afp.AFPResourceInfo; import org.apache.fop.afp.AFPResourceManager; import org.apache.fop.afp.modca.ResourceObject; +import org.apache.fop.configuration.Configuration; import org.apache.fop.render.AbstractRenderer; import org.apache.fop.render.ImageHandlerUtil; import org.apache.fop.render.RendererContext; @@ -58,7 +57,7 @@ public class AFPRendererContext extends RendererContext { info.setHeight((Integer) getProperty(RendererContextConstants.HEIGHT)); info.setX((Integer) getProperty(RendererContextConstants.XPOS)); info.setY((Integer) getProperty(RendererContextConstants.YPOS)); - info.setHandlerConfiguration((Configuration)getProperty( + info.setHandlerConfiguration((Configuration) getProperty( RendererContextConstants.HANDLER_CONFIGURATION)); info.setFontInfo((org.apache.fop.fonts.FontInfo)getProperty( AFPRendererContextConstants.AFP_FONT_INFO)); diff --git a/fop-core/src/main/java/org/apache/fop/render/afp/AFPRendererOption.java b/fop-core/src/main/java/org/apache/fop/render/afp/AFPRendererOption.java index d573570d0..33e4da11c 100644 --- a/fop-core/src/main/java/org/apache/fop/render/afp/AFPRendererOption.java +++ b/fop-core/src/main/java/org/apache/fop/render/afp/AFPRendererOption.java @@ -61,4 +61,9 @@ public enum AFPRendererOption implements RendererConfigOption { public Class<?> getType() { return type; } + + @Override + public Object getDefaultValue() { + return null; + } } diff --git a/fop-core/src/main/java/org/apache/fop/render/afp/AFPShadingMode.java b/fop-core/src/main/java/org/apache/fop/render/afp/AFPShadingMode.java index 7e963148a..e634b9b13 100644 --- a/fop-core/src/main/java/org/apache/fop/render/afp/AFPShadingMode.java +++ b/fop-core/src/main/java/org/apache/fop/render/afp/AFPShadingMode.java @@ -49,7 +49,7 @@ public enum AFPShadingMode { * @return the enumeration object */ public static AFPShadingMode getValueOf(String name) { - if (COLOR.getName().equalsIgnoreCase(name)) { + if (name == null || "".equals(name) || COLOR.getName().equalsIgnoreCase(name)) { return COLOR; } else if (DITHERED.getName().equalsIgnoreCase(name)) { return DITHERED; diff --git a/fop-core/src/main/java/org/apache/fop/render/bitmap/BitmapRendererConfig.java b/fop-core/src/main/java/org/apache/fop/render/bitmap/BitmapRendererConfig.java index 551827fef..99bc14960 100644 --- a/fop-core/src/main/java/org/apache/fop/render/bitmap/BitmapRendererConfig.java +++ b/fop-core/src/main/java/org/apache/fop/render/bitmap/BitmapRendererConfig.java @@ -23,10 +23,9 @@ import java.awt.Color; import java.awt.image.BufferedImage; import java.util.EnumMap; -import org.apache.avalon.framework.configuration.Configuration; - import org.apache.fop.apps.FOPException; import org.apache.fop.apps.FOUserAgent; +import org.apache.fop.configuration.Configuration; import org.apache.fop.fonts.DefaultFontConfig; import org.apache.fop.fonts.DefaultFontConfig.DefaultFontConfigParser; import org.apache.fop.fonts.FontEventAdapter; @@ -170,7 +169,18 @@ public class BitmapRendererConfig implements RendererConfig { } private String getValue(Configuration cfg, BitmapRendererOption option) { - return cfg.getChild(option.getName()).getValue(null); + Object defaultValue = option.getDefaultValue(); + Object result = cfg.getChild(option.getName()).getValue(null); + if (result == null || "".equals(result)) { + result = defaultValue; + } + if (result == null) { + return null; + } + if (result instanceof Color) { + return ColorUtil.colorToString((Color) result); + } + return result.toString(); } public String getMimeType() { diff --git a/fop-core/src/main/java/org/apache/fop/render/bitmap/PNGRendererConfig.java b/fop-core/src/main/java/org/apache/fop/render/bitmap/PNGRendererConfig.java index 26553bc69..8e98ddd25 100644 --- a/fop-core/src/main/java/org/apache/fop/render/bitmap/PNGRendererConfig.java +++ b/fop-core/src/main/java/org/apache/fop/render/bitmap/PNGRendererConfig.java @@ -17,12 +17,11 @@ package org.apache.fop.render.bitmap; -import org.apache.avalon.framework.configuration.Configuration; - import org.apache.xmlgraphics.util.MimeConstants; import org.apache.fop.apps.FOPException; import org.apache.fop.apps.FOUserAgent; +import org.apache.fop.configuration.Configuration; import org.apache.fop.fonts.DefaultFontConfig; import org.apache.fop.fonts.DefaultFontConfig.DefaultFontConfigParser; import org.apache.fop.fonts.FontEventAdapter; diff --git a/fop-core/src/main/java/org/apache/fop/render/bitmap/TIFFRendererConfig.java b/fop-core/src/main/java/org/apache/fop/render/bitmap/TIFFRendererConfig.java index c8d71ba17..c339e02d1 100644 --- a/fop-core/src/main/java/org/apache/fop/render/bitmap/TIFFRendererConfig.java +++ b/fop-core/src/main/java/org/apache/fop/render/bitmap/TIFFRendererConfig.java @@ -21,13 +21,12 @@ package org.apache.fop.render.bitmap; import java.util.EnumMap; -import org.apache.avalon.framework.configuration.Configuration; - import org.apache.xmlgraphics.image.writer.Endianness; import org.apache.fop.apps.FOPException; import org.apache.fop.apps.FOUserAgent; import org.apache.fop.apps.MimeConstants; +import org.apache.fop.configuration.Configuration; import org.apache.fop.fonts.DefaultFontConfig; import org.apache.fop.fonts.DefaultFontConfig.DefaultFontConfigParser; import org.apache.fop.fonts.FontEventAdapter; diff --git a/fop-core/src/main/java/org/apache/fop/render/intermediate/IFRendererConfig.java b/fop-core/src/main/java/org/apache/fop/render/intermediate/IFRendererConfig.java index 7fc7be063..f972dcb05 100644 --- a/fop-core/src/main/java/org/apache/fop/render/intermediate/IFRendererConfig.java +++ b/fop-core/src/main/java/org/apache/fop/render/intermediate/IFRendererConfig.java @@ -19,10 +19,9 @@ package org.apache.fop.render.intermediate; -import org.apache.avalon.framework.configuration.Configuration; - import org.apache.fop.apps.FOPException; import org.apache.fop.apps.FOUserAgent; +import org.apache.fop.configuration.Configuration; import org.apache.fop.fonts.DefaultFontConfig; import org.apache.fop.fonts.DefaultFontConfig.DefaultFontConfigParser; import org.apache.fop.fonts.FontConfig; diff --git a/fop-core/src/main/java/org/apache/fop/render/java2d/Java2DRendererConfig.java b/fop-core/src/main/java/org/apache/fop/render/java2d/Java2DRendererConfig.java index 141b61bf9..14d31e1c8 100644 --- a/fop-core/src/main/java/org/apache/fop/render/java2d/Java2DRendererConfig.java +++ b/fop-core/src/main/java/org/apache/fop/render/java2d/Java2DRendererConfig.java @@ -21,10 +21,9 @@ package org.apache.fop.render.java2d; import java.util.EnumMap; -import org.apache.avalon.framework.configuration.Configuration; - import org.apache.fop.apps.FOPException; import org.apache.fop.apps.FOUserAgent; +import org.apache.fop.configuration.Configuration; import org.apache.fop.fonts.DefaultFontConfig; import org.apache.fop.fonts.DefaultFontConfig.DefaultFontConfigParser; import org.apache.fop.fonts.FontEventAdapter; diff --git a/fop-core/src/main/java/org/apache/fop/render/java2d/Java2DRendererOption.java b/fop-core/src/main/java/org/apache/fop/render/java2d/Java2DRendererOption.java index b25f05889..8b6ca99a0 100644 --- a/fop-core/src/main/java/org/apache/fop/render/java2d/Java2DRendererOption.java +++ b/fop-core/src/main/java/org/apache/fop/render/java2d/Java2DRendererOption.java @@ -34,4 +34,9 @@ public enum Java2DRendererOption implements RendererConfigOption { public String getName() { return name; } + + @Override + public Object getDefaultValue() { + return null; + } } diff --git a/fop-core/src/main/java/org/apache/fop/render/pcl/Java2DRendererOption.java b/fop-core/src/main/java/org/apache/fop/render/pcl/Java2DRendererOption.java index 7a0a4a77e..58e778f21 100644 --- a/fop-core/src/main/java/org/apache/fop/render/pcl/Java2DRendererOption.java +++ b/fop-core/src/main/java/org/apache/fop/render/pcl/Java2DRendererOption.java @@ -25,19 +25,25 @@ import org.apache.fop.render.RendererConfigOption; */ public enum Java2DRendererOption implements RendererConfigOption { - RENDERING_MODE("rendering", PCLRenderingMode.class), - TEXT_RENDERING("text-rendering", Boolean.class), - DISABLE_PJL("disable-pjl", Boolean.class), - OPTIMIZE_RESOURCES("optimize-resources", Boolean.class), - MODE_COLOR("color", Boolean.class); + RENDERING_MODE("rendering", PCLRenderingMode.class, PCLRenderingMode.QUALITY), + TEXT_RENDERING("text-rendering", Boolean.class, Boolean.FALSE), + DISABLE_PJL("disable-pjl", Boolean.class, Boolean.FALSE), + OPTIMIZE_RESOURCES("optimize-resources", Boolean.class, Boolean.FALSE), + MODE_COLOR("color", Boolean.class, Boolean.FALSE); private final String name; private final Class<?> type; - private Java2DRendererOption(String name, Class<?> type) { + private final Object defaultValue; + + private Java2DRendererOption(String name, Class<?> type, Object defaultValue) { this.name = name; this.type = type; + this.defaultValue = defaultValue; + if (defaultValue != null && !(type.isAssignableFrom(defaultValue.getClass()))) { + throw new IllegalArgumentException("default value " + defaultValue + " is not of type " + type); + } } /** {@inheritDoc} */ @@ -48,4 +54,9 @@ public enum Java2DRendererOption implements RendererConfigOption { Class<?> getType() { return type; } + + @Override + public Object getDefaultValue() { + return defaultValue; + } } diff --git a/fop-core/src/main/java/org/apache/fop/render/pcl/PCLRendererConfig.java b/fop-core/src/main/java/org/apache/fop/render/pcl/PCLRendererConfig.java index 06aebba71..1a1c3727e 100644 --- a/fop-core/src/main/java/org/apache/fop/render/pcl/PCLRendererConfig.java +++ b/fop-core/src/main/java/org/apache/fop/render/pcl/PCLRendererConfig.java @@ -22,11 +22,10 @@ package org.apache.fop.render.pcl; import java.util.EnumMap; import java.util.Map; -import org.apache.avalon.framework.configuration.Configuration; - import org.apache.fop.apps.FOPException; import org.apache.fop.apps.FOUserAgent; import org.apache.fop.apps.MimeConstants; +import org.apache.fop.configuration.Configuration; import org.apache.fop.fonts.DefaultFontConfig; import org.apache.fop.fonts.DefaultFontConfig.DefaultFontConfigParser; import org.apache.fop.fonts.FontEventAdapter; diff --git a/fop-core/src/main/java/org/apache/fop/render/pdf/PDFRendererConfig.java b/fop-core/src/main/java/org/apache/fop/render/pdf/PDFRendererConfig.java index 84ac45f40..851189cd7 100644 --- a/fop-core/src/main/java/org/apache/fop/render/pdf/PDFRendererConfig.java +++ b/fop-core/src/main/java/org/apache/fop/render/pdf/PDFRendererConfig.java @@ -25,15 +25,14 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import org.apache.avalon.framework.configuration.Configuration; -import org.apache.avalon.framework.configuration.ConfigurationException; - import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.fop.apps.FOPException; import org.apache.fop.apps.FOUserAgent; import org.apache.fop.apps.MimeConstants; +import org.apache.fop.configuration.Configuration; +import org.apache.fop.configuration.ConfigurationException; import org.apache.fop.fonts.DefaultFontConfig; import org.apache.fop.fonts.DefaultFontConfig.DefaultFontConfigParser; import org.apache.fop.fonts.FontEventAdapter; @@ -217,7 +216,12 @@ public final class PDFRendererConfig implements RendererConfig { private String parseConfig(Configuration cfg, RendererConfigOption option) { Configuration child = cfg.getChild(option.getName()); - return child.getValue(null); + String value = child.getValue(null); + if (value == null || "".equals(value)) { + Object v = option.getDefaultValue(); + return v == null ? null : v.toString(); + } + return value; } private boolean doesValueExist(Configuration cfg, RendererConfigOption option) { diff --git a/fop-core/src/main/java/org/apache/fop/render/pdf/PDFSVGHandler.java b/fop-core/src/main/java/org/apache/fop/render/pdf/PDFSVGHandler.java index 70a1ad800..467a1f180 100644 --- a/fop-core/src/main/java/org/apache/fop/render/pdf/PDFSVGHandler.java +++ b/fop-core/src/main/java/org/apache/fop/render/pdf/PDFSVGHandler.java @@ -22,10 +22,10 @@ package org.apache.fop.render.pdf; import java.io.OutputStream; import java.util.Map; -import org.apache.avalon.framework.configuration.Configuration; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.apache.fop.configuration.Configuration; import org.apache.fop.fonts.FontInfo; import org.apache.fop.pdf.PDFDocument; import org.apache.fop.pdf.PDFPage; diff --git a/fop-core/src/main/java/org/apache/fop/render/ps/PSRendererConfig.java b/fop-core/src/main/java/org/apache/fop/render/ps/PSRendererConfig.java index 4df5e6bad..c0d28ff96 100644 --- a/fop-core/src/main/java/org/apache/fop/render/ps/PSRendererConfig.java +++ b/fop-core/src/main/java/org/apache/fop/render/ps/PSRendererConfig.java @@ -22,14 +22,14 @@ package org.apache.fop.render.ps; import java.util.EnumMap; import java.util.Locale; -import org.apache.avalon.framework.configuration.Configuration; -import org.apache.avalon.framework.configuration.ConfigurationException; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.fop.apps.FOPException; import org.apache.fop.apps.FOUserAgent; import org.apache.fop.apps.MimeConstants; +import org.apache.fop.configuration.Configuration; +import org.apache.fop.configuration.ConfigurationException; import org.apache.fop.fonts.DefaultFontConfig; import org.apache.fop.fonts.DefaultFontConfig.DefaultFontConfigParser; import org.apache.fop.fonts.FontEventAdapter; diff --git a/fop-core/src/main/java/org/apache/fop/render/ps/PSSVGHandler.java b/fop-core/src/main/java/org/apache/fop/render/ps/PSSVGHandler.java index ad8af8a49..3cb58049e 100644 --- a/fop-core/src/main/java/org/apache/fop/render/ps/PSSVGHandler.java +++ b/fop-core/src/main/java/org/apache/fop/render/ps/PSSVGHandler.java @@ -26,8 +26,6 @@ import java.util.Map; import org.w3c.dom.Document; -import org.apache.avalon.framework.configuration.Configuration; - import org.apache.batik.bridge.BridgeContext; import org.apache.batik.bridge.GVTBuilder; import org.apache.batik.gvt.GraphicsNode; @@ -35,6 +33,7 @@ import org.apache.batik.gvt.GraphicsNode; import org.apache.xmlgraphics.java2d.ps.PSGraphics2D; import org.apache.xmlgraphics.ps.PSGenerator; +import org.apache.fop.configuration.Configuration; import org.apache.fop.fonts.FontInfo; import org.apache.fop.image.loader.batik.BatikUtil; import org.apache.fop.render.AbstractGenericSVGHandler; diff --git a/fop-core/src/main/java/org/apache/fop/render/txt/TxtRendererConfig.java b/fop-core/src/main/java/org/apache/fop/render/txt/TxtRendererConfig.java index bd6f07c4a..76128d42b 100644 --- a/fop-core/src/main/java/org/apache/fop/render/txt/TxtRendererConfig.java +++ b/fop-core/src/main/java/org/apache/fop/render/txt/TxtRendererConfig.java @@ -21,11 +21,10 @@ package org.apache.fop.render.txt; import java.util.EnumMap; -import org.apache.avalon.framework.configuration.Configuration; - import org.apache.fop.apps.FOPException; import org.apache.fop.apps.FOUserAgent; import org.apache.fop.apps.MimeConstants; +import org.apache.fop.configuration.Configuration; import org.apache.fop.fonts.DefaultFontConfig; import org.apache.fop.fonts.DefaultFontConfig.DefaultFontConfigParser; import org.apache.fop.fonts.FontEventAdapter; diff --git a/fop-core/src/main/java/org/apache/fop/svg/AbstractFOPTranscoder.java b/fop-core/src/main/java/org/apache/fop/svg/AbstractFOPTranscoder.java index debd55c1e..0b3e6985f 100644 --- a/fop-core/src/main/java/org/apache/fop/svg/AbstractFOPTranscoder.java +++ b/fop-core/src/main/java/org/apache/fop/svg/AbstractFOPTranscoder.java @@ -28,10 +28,6 @@ import javax.xml.transform.stream.StreamSource; import org.w3c.dom.DOMImplementation; import org.xml.sax.EntityResolver; -import org.apache.avalon.framework.configuration.Configurable; -import org.apache.avalon.framework.configuration.Configuration; -import org.apache.avalon.framework.configuration.ConfigurationException; -import org.apache.avalon.framework.configuration.DefaultConfiguration; import org.apache.commons.logging.Log; import org.apache.commons.logging.impl.SimpleLog; @@ -55,6 +51,10 @@ import org.apache.xmlgraphics.image.loader.ImageSessionContext; import org.apache.xmlgraphics.image.loader.impl.AbstractImageSessionContext; import org.apache.xmlgraphics.util.UnitConv; +import org.apache.fop.configuration.Configurable; +import org.apache.fop.configuration.Configuration; +import org.apache.fop.configuration.ConfigurationException; +import org.apache.fop.configuration.DefaultConfiguration; import org.apache.fop.svg.font.FOPFontFamilyResolver; /** diff --git a/fop-core/src/main/java/org/apache/fop/svg/PDFDocumentGraphics2DConfigurator.java b/fop-core/src/main/java/org/apache/fop/svg/PDFDocumentGraphics2DConfigurator.java index a8e9307a7..1ecca82c7 100644 --- a/fop-core/src/main/java/org/apache/fop/svg/PDFDocumentGraphics2DConfigurator.java +++ b/fop-core/src/main/java/org/apache/fop/svg/PDFDocumentGraphics2DConfigurator.java @@ -23,12 +23,11 @@ import java.io.File; import java.net.URI; import java.util.List; -import org.apache.avalon.framework.configuration.Configuration; -import org.apache.avalon.framework.configuration.ConfigurationException; - import org.apache.fop.apps.FOPException; import org.apache.fop.apps.io.InternalResourceResolver; import org.apache.fop.apps.io.ResourceResolverFactory; +import org.apache.fop.configuration.Configuration; +import org.apache.fop.configuration.ConfigurationException; import org.apache.fop.fonts.DefaultFontConfig; import org.apache.fop.fonts.DefaultFontConfigurator; import org.apache.fop.fonts.EmbedFontInfo; diff --git a/fop-core/src/main/java/org/apache/fop/svg/PDFTranscoder.java b/fop-core/src/main/java/org/apache/fop/svg/PDFTranscoder.java index 1481f7028..ee8e64dcd 100644 --- a/fop-core/src/main/java/org/apache/fop/svg/PDFTranscoder.java +++ b/fop-core/src/main/java/org/apache/fop/svg/PDFTranscoder.java @@ -27,8 +27,6 @@ import java.io.OutputStream; import org.w3c.dom.Document; import org.w3c.dom.svg.SVGLength; -import org.apache.avalon.framework.configuration.Configuration; - import org.apache.batik.bridge.BridgeContext; import org.apache.batik.bridge.UnitProcessor; import org.apache.batik.ext.awt.RenderingHintsKeyExt; @@ -37,6 +35,7 @@ import org.apache.batik.transcoder.TranscoderOutput; import org.apache.batik.transcoder.image.ImageTranscoder; import org.apache.fop.Version; +import org.apache.fop.configuration.Configuration; import org.apache.fop.fonts.FontInfo; import org.apache.fop.svg.font.FOPFontFamilyResolverImpl; diff --git a/fop-core/src/test/java/org/apache/fop/apps/AbstractRendererConfigParserTester.java b/fop-core/src/test/java/org/apache/fop/apps/AbstractRendererConfigParserTester.java index e4c9ceb44..555f73226 100644 --- a/fop-core/src/test/java/org/apache/fop/apps/AbstractRendererConfigParserTester.java +++ b/fop-core/src/test/java/org/apache/fop/apps/AbstractRendererConfigParserTester.java @@ -22,10 +22,9 @@ package org.apache.fop.apps; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -import org.apache.avalon.framework.configuration.Configuration; -import org.apache.avalon.framework.configuration.DefaultConfigurationBuilder; - import org.apache.fop.apps.FopConfBuilder.RendererConfBuilder; +import org.apache.fop.configuration.Configuration; +import org.apache.fop.configuration.DefaultConfigurationBuilder; import org.apache.fop.events.DefaultEventBroadcaster; import org.apache.fop.fonts.FontManager; import org.apache.fop.render.RendererConfig; diff --git a/fop-core/src/test/java/org/apache/fop/apps/AbstractRendererConfiguratorTest.java b/fop-core/src/test/java/org/apache/fop/apps/AbstractRendererConfiguratorTest.java index 2487c0a63..b0dbf440c 100644 --- a/fop-core/src/test/java/org/apache/fop/apps/AbstractRendererConfiguratorTest.java +++ b/fop-core/src/test/java/org/apache/fop/apps/AbstractRendererConfiguratorTest.java @@ -27,9 +27,8 @@ import org.xml.sax.SAXException; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -import org.apache.avalon.framework.configuration.ConfigurationException; - import org.apache.fop.apps.FopConfBuilder.RendererConfBuilder; +import org.apache.fop.configuration.ConfigurationException; import org.apache.fop.render.PrintRendererConfigurator; import org.apache.fop.render.intermediate.IFDocumentHandler; diff --git a/fop-core/src/test/java/org/apache/fop/apps/MutableConfig.java b/fop-core/src/test/java/org/apache/fop/apps/MutableConfig.java index a27a318cb..201408235 100644 --- a/fop-core/src/test/java/org/apache/fop/apps/MutableConfig.java +++ b/fop-core/src/test/java/org/apache/fop/apps/MutableConfig.java @@ -21,13 +21,12 @@ import java.net.URI; import java.util.Map; import java.util.Set; -import org.apache.avalon.framework.configuration.Configuration; - import org.apache.xmlgraphics.image.loader.ImageManager; import org.apache.xmlgraphics.image.loader.impl.AbstractImageSessionContext.FallbackResolver; import org.apache.xmlgraphics.io.ResourceResolver; import org.apache.fop.apps.io.InternalResourceResolver; +import org.apache.fop.configuration.Configuration; import org.apache.fop.fonts.FontManager; import org.apache.fop.layoutmgr.LayoutManagerMaker; diff --git a/fop-core/src/test/java/org/apache/fop/config/BaseUserConfigTest.java b/fop-core/src/test/java/org/apache/fop/config/BaseUserConfigTest.java index 1af57d985..90616c526 100644 --- a/fop-core/src/test/java/org/apache/fop/config/BaseUserConfigTest.java +++ b/fop-core/src/test/java/org/apache/fop/config/BaseUserConfigTest.java @@ -25,11 +25,11 @@ import java.io.InputStream; import org.xml.sax.SAXException; -import org.apache.avalon.framework.configuration.DefaultConfigurationBuilder; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.fop.apps.FOUserAgent; +import org.apache.fop.configuration.DefaultConfigurationBuilder; import org.apache.fop.render.pdf.BasePDFTest; import static org.apache.fop.FOPTestUtils.getBaseDir; diff --git a/fop-core/src/test/java/org/apache/fop/threading/AvalonAdapter.java b/fop-core/src/test/java/org/apache/fop/threading/AvalonAdapter.java index 5074d6b70..8a8bbf79a 100644 --- a/fop-core/src/test/java/org/apache/fop/threading/AvalonAdapter.java +++ b/fop-core/src/test/java/org/apache/fop/threading/AvalonAdapter.java @@ -19,7 +19,7 @@ package org.apache.fop.threading; -import org.apache.avalon.framework.logger.Logger; +import org.apache.commons.logging.Log; import org.apache.fop.events.Event; import org.apache.fop.events.EventFormatter; @@ -31,10 +31,10 @@ import org.apache.fop.events.model.EventSeverity; */ class AvalonAdapter implements EventListener { - private final Logger logger; + private final Log logger; private String filename; - public AvalonAdapter(Logger logger, String filename) { + public AvalonAdapter(Log logger, String filename) { this.logger = logger; this.filename = filename; } @@ -49,7 +49,7 @@ class AvalonAdapter implements EventListener { } else if (severity == EventSeverity.ERROR) { logger.error(filename + ": " + msg); } else if (severity == EventSeverity.FATAL) { - logger.fatalError(filename + ": " + msg); + logger.fatal(filename + ": " + msg); } else { assert false; } diff --git a/fop-core/src/test/java/org/apache/fop/threading/FOPTestbed.java b/fop-core/src/test/java/org/apache/fop/threading/FOPTestbed.java index b2d2ecb95..7f6319ba8 100644 --- a/fop-core/src/test/java/org/apache/fop/threading/FOPTestbed.java +++ b/fop-core/src/test/java/org/apache/fop/threading/FOPTestbed.java @@ -31,25 +31,27 @@ import javax.xml.transform.TransformerConfigurationException; import javax.xml.transform.TransformerFactory; import javax.xml.transform.stream.StreamSource; -import org.apache.avalon.framework.CascadingRuntimeException; -import org.apache.avalon.framework.activity.Executable; -import org.apache.avalon.framework.activity.Initializable; -import org.apache.avalon.framework.configuration.Configurable; -import org.apache.avalon.framework.configuration.Configuration; -import org.apache.avalon.framework.configuration.ConfigurationException; -import org.apache.avalon.framework.container.ContainerUtil; -import org.apache.avalon.framework.logger.AbstractLogEnabled; import org.apache.commons.io.IOUtils; import org.apache.commons.io.output.CountingOutputStream; import org.apache.commons.io.output.NullOutputStream; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import org.apache.fop.activity.ContainerUtil; +import org.apache.fop.activity.Initializable; +import org.apache.fop.configuration.Configurable; +import org.apache.fop.configuration.Configuration; +import org.apache.fop.configuration.ConfigurationException; /** * Testbed for multi-threading tests. The class can run a configurable set of task a number of * times in a configurable number of threads to easily reproduce multi-threading issues. */ -public class FOPTestbed extends AbstractLogEnabled +public class FOPTestbed implements Configurable, Initializable { + private static final Log LOG = LogFactory.getLog(FOPTestbed.class); + private int repeat; private List taskList = new java.util.ArrayList(); private int threads; @@ -85,7 +87,7 @@ public class FOPTestbed extends AbstractLogEnabled * Starts the stress test. */ public void doStressTest() { - getLogger().info("Starting stress test..."); + LOG.info("Starting stress test..."); long start = System.currentTimeMillis(); this.counter = 0; @@ -94,7 +96,7 @@ public class FOPTestbed extends AbstractLogEnabled List threadList = new java.util.LinkedList(); for (int ti = 0; ti < this.threads; ti++) { TaskRunner runner = new TaskRunner(); - ContainerUtil.enableLogging(runner, getLogger()); + // ContainerUtil.enableLogging(runner, logger); Thread thread = new Thread(workerGroup, runner, "Worker- " + ti); threadList.add(thread); } @@ -150,7 +152,7 @@ public class FOPTestbed extends AbstractLogEnabled } } - private class TaskRunner extends AbstractLogEnabled implements Runnable { + private class TaskRunner implements Runnable { public void run() { try { @@ -158,12 +160,12 @@ public class FOPTestbed extends AbstractLogEnabled for (Object aTaskList : taskList) { TaskDef def = (TaskDef) aTaskList; final Task task = new Task(def, counter++, foprocessor); - ContainerUtil.enableLogging(task, getLogger()); + // ContainerUtil.enableLogging(task, logger); task.execute(); } } } catch (Exception e) { - getLogger().error("Thread ended with an exception", e); + LOG.error("Thread ended with an exception", e); } } @@ -178,12 +180,12 @@ public class FOPTestbed extends AbstractLogEnabled Class clazz = Class.forName(this.fopCfg.getAttribute("class", "org.apache.fop.threading.FOProcessorImpl")); Processor fop = (Processor)clazz.getDeclaredConstructor().newInstance(); - ContainerUtil.enableLogging(fop, getLogger()); + // ContainerUtil.enableLogging(fop, logger); ContainerUtil.configure(fop, this.fopCfg); ContainerUtil.initialize(fop); return fop; } catch (Exception e) { - throw new CascadingRuntimeException("Error creating FO Processor", e); + throw new RuntimeException("Error creating FO Processor", e); } } @@ -243,7 +245,7 @@ public class FOPTestbed extends AbstractLogEnabled } - private class Task extends AbstractLogEnabled implements Executable { + private class Task { private TaskDef def; private int num; @@ -257,7 +259,7 @@ public class FOPTestbed extends AbstractLogEnabled public void execute() throws Exception { - getLogger().info("Processing: " + def); + LOG.info("Processing: " + def); long start = System.currentTimeMillis(); try { DecimalFormat df = new DecimalFormat("00000"); diff --git a/fop-core/src/test/java/org/apache/fop/threading/FOProcessorImpl.java b/fop-core/src/test/java/org/apache/fop/threading/FOProcessorImpl.java index 721830aee..b784b5c03 100644 --- a/fop-core/src/test/java/org/apache/fop/threading/FOProcessorImpl.java +++ b/fop-core/src/test/java/org/apache/fop/threading/FOProcessorImpl.java @@ -36,25 +36,29 @@ import javax.xml.transform.sax.SAXResult; import org.xml.sax.SAXException; -import org.apache.avalon.framework.activity.Initializable; -import org.apache.avalon.framework.configuration.Configurable; -import org.apache.avalon.framework.configuration.Configuration; -import org.apache.avalon.framework.configuration.ConfigurationException; -import org.apache.avalon.framework.logger.AbstractLogEnabled; import org.apache.commons.io.FilenameUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import org.apache.fop.activity.Initializable; 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.configuration.Configurable; +import org.apache.fop.configuration.Configuration; +import org.apache.fop.configuration.ConfigurationException; /** * Default implementation of the {@link Processor} interface using FOP. */ -public class FOProcessorImpl extends AbstractLogEnabled +public class FOProcessorImpl implements Processor, Configurable, Initializable { + private static final Log LOG = LogFactory.getLog(FOProcessorImpl.class); + private FopFactory fopFactory; private TransformerFactory factory = TransformerFactory.newInstance(); private URI userconfig; @@ -74,7 +78,7 @@ public class FOProcessorImpl extends AbstractLogEnabled public void initialize() throws Exception { if (this.userconfig != null) { - getLogger().debug("Setting user config: " + userconfig); + LOG.debug("Setting user config: " + userconfig); fopFactory = FopFactory.newInstance(new File(userconfig)); } else { fopFactory = FopFactory.newInstance(new File(".").toURI()); @@ -92,7 +96,7 @@ public class FOProcessorImpl extends AbstractLogEnabled URL url = new URL(src.getSystemId()); String filename = FilenameUtils.getName(url.getPath()); foUserAgent.getEventBroadcaster().addEventListener( - new AvalonAdapter(getLogger(), filename)); + new AvalonAdapter(LOG, filename)); } catch (MalformedURLException mfue) { throw new RuntimeException(mfue); } diff --git a/fop-core/src/test/java/org/apache/fop/threading/IFProcessorImpl.java b/fop-core/src/test/java/org/apache/fop/threading/IFProcessorImpl.java index 0dc87fa50..ed50e0521 100644 --- a/fop-core/src/test/java/org/apache/fop/threading/IFProcessorImpl.java +++ b/fop-core/src/test/java/org/apache/fop/threading/IFProcessorImpl.java @@ -35,17 +35,19 @@ import javax.xml.transform.stream.StreamResult; import org.xml.sax.ContentHandler; -import org.apache.avalon.framework.activity.Initializable; -import org.apache.avalon.framework.configuration.Configurable; -import org.apache.avalon.framework.configuration.Configuration; -import org.apache.avalon.framework.configuration.ConfigurationException; -import org.apache.avalon.framework.logger.AbstractLogEnabled; import org.apache.commons.io.FilenameUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import org.apache.fop.activity.Initializable; 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.configuration.Configurable; +import org.apache.fop.configuration.Configuration; +import org.apache.fop.configuration.ConfigurationException; import org.apache.fop.render.intermediate.IFDocumentHandler; import org.apache.fop.render.intermediate.IFException; import org.apache.fop.render.intermediate.IFParser; @@ -54,9 +56,12 @@ import org.apache.fop.render.intermediate.IFUtil; /** * Implementation of the {@link Processor} interface that renders IF XML to a final output format. */ -public class IFProcessorImpl extends AbstractLogEnabled +public class IFProcessorImpl implements Processor, Configurable, Initializable { + private static final Log LOGGER = LogFactory.getLog(IFProcessorImpl.class); + + private FopFactory fopFactory; private TransformerFactory factory = TransformerFactory.newInstance(); private String userconfig; @@ -73,7 +78,7 @@ public class IFProcessorImpl extends AbstractLogEnabled /** {@inheritDoc} */ public void initialize() throws Exception { if (this.userconfig != null) { - getLogger().debug("Setting user config: " + userconfig); + LOGGER.debug("Setting user config: " + userconfig); fopFactory = FopFactory.newInstance(new File(this.userconfig)); } else { fopFactory = FopFactory.newInstance(new File(".").toURI()); @@ -89,7 +94,7 @@ public class IFProcessorImpl extends AbstractLogEnabled URL url = new URL(src.getSystemId()); String filename = FilenameUtils.getName(url.getPath()); foUserAgent.getEventBroadcaster().addEventListener( - new AvalonAdapter(getLogger(), filename)); + new AvalonAdapter(LOGGER, filename)); } catch (MalformedURLException mfue) { throw new RuntimeException(mfue); } diff --git a/fop-core/src/test/java/org/apache/fop/threading/Main.java b/fop-core/src/test/java/org/apache/fop/threading/Main.java index d18ae405a..32812d078 100644 --- a/fop-core/src/test/java/org/apache/fop/threading/Main.java +++ b/fop-core/src/test/java/org/apache/fop/threading/Main.java @@ -23,11 +23,9 @@ import java.io.BufferedReader; import java.io.File; import java.io.IOException; -import org.apache.avalon.framework.ExceptionUtil; -import org.apache.avalon.framework.configuration.Configuration; -import org.apache.avalon.framework.configuration.DefaultConfigurationBuilder; -import org.apache.avalon.framework.container.ContainerUtil; -import org.apache.avalon.framework.logger.ConsoleLogger; +import org.apache.fop.activity.ContainerUtil; +import org.apache.fop.configuration.Configuration; +import org.apache.fop.configuration.DefaultConfigurationBuilder; /** * Starter class for the multi-threading testbed. @@ -61,7 +59,7 @@ public final class Main { //Setup testbed FOPTestbed testbed = new FOPTestbed(); - ContainerUtil.enableLogging(testbed, new ConsoleLogger(ConsoleLogger.LEVEL_INFO)); + // ContainerUtil.enableLogging(testbed, new ConsoleLogger(ConsoleLogger.LEVEL_INFO)); ContainerUtil.configure(testbed, cfg); ContainerUtil.initialize(testbed); @@ -70,7 +68,8 @@ public final class Main { System.exit(0); } catch (Exception e) { - System.err.println(ExceptionUtil.printStackTrace(e)); + // System.err.println(ExceptionUtil.printStackTrace(e)); + e.printStackTrace(System.err); System.exit(-1); } } diff --git a/fop-core/src/test/java/org/apache/fop/threading/Processor.java b/fop-core/src/test/java/org/apache/fop/threading/Processor.java index 2f37c02a1..2551e0039 100644 --- a/fop-core/src/test/java/org/apache/fop/threading/Processor.java +++ b/fop-core/src/test/java/org/apache/fop/threading/Processor.java @@ -24,10 +24,13 @@ import java.io.OutputStream; import javax.xml.transform.Source; import javax.xml.transform.Templates; +import org.apache.fop.activity.Initializable; +import org.apache.fop.configuration.Configurable; + /** * Represents a processor. */ -public interface Processor { +public interface Processor extends Configurable, Initializable { /** * Process a file. diff --git a/fop-core/src/test/java/org/apache/fop/visual/AbstractPSPDFBitmapProducer.java b/fop-core/src/test/java/org/apache/fop/visual/AbstractPSPDFBitmapProducer.java index 162a83756..5edae8074 100644 --- a/fop-core/src/test/java/org/apache/fop/visual/AbstractPSPDFBitmapProducer.java +++ b/fop-core/src/test/java/org/apache/fop/visual/AbstractPSPDFBitmapProducer.java @@ -32,14 +32,14 @@ import javax.xml.transform.Transformer; import javax.xml.transform.sax.SAXResult; import javax.xml.transform.stream.StreamSource; -import org.apache.avalon.framework.configuration.Configurable; -import org.apache.avalon.framework.configuration.Configuration; -import org.apache.avalon.framework.configuration.ConfigurationException; 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.configuration.Configurable; +import org.apache.fop.configuration.Configuration; +import org.apache.fop.configuration.ConfigurationException; import org.apache.fop.util.DefaultErrorListener; /** diff --git a/fop-core/src/test/java/org/apache/fop/visual/BatchDiffer.java b/fop-core/src/test/java/org/apache/fop/visual/BatchDiffer.java index cb78028f4..c9a2d477e 100644 --- a/fop-core/src/test/java/org/apache/fop/visual/BatchDiffer.java +++ b/fop-core/src/test/java/org/apache/fop/visual/BatchDiffer.java @@ -30,10 +30,6 @@ import javax.xml.transform.stream.StreamSource; import org.xml.sax.SAXException; -import org.apache.avalon.framework.configuration.Configuration; -import org.apache.avalon.framework.configuration.ConfigurationException; -import org.apache.avalon.framework.configuration.DefaultConfigurationBuilder; -import org.apache.avalon.framework.container.ContainerUtil; import org.apache.commons.io.FileUtils; import org.apache.commons.io.filefilter.AndFileFilter; import org.apache.commons.io.filefilter.IOFileFilter; @@ -44,6 +40,10 @@ import org.apache.commons.logging.LogFactory; import org.apache.xmlgraphics.image.writer.ImageWriterUtil; +import org.apache.fop.activity.ContainerUtil; +import org.apache.fop.configuration.Configuration; +import org.apache.fop.configuration.ConfigurationException; +import org.apache.fop.configuration.DefaultConfigurationBuilder; import org.apache.fop.layoutengine.LayoutEngineTestUtils; /** diff --git a/fop-core/src/test/java/org/apache/fop/visual/BitmapProducer.java b/fop-core/src/test/java/org/apache/fop/visual/BitmapProducer.java index 9326656f4..80a4fce0c 100644 --- a/fop-core/src/test/java/org/apache/fop/visual/BitmapProducer.java +++ b/fop-core/src/test/java/org/apache/fop/visual/BitmapProducer.java @@ -22,10 +22,12 @@ package org.apache.fop.visual; import java.awt.image.BufferedImage; import java.io.File; +import org.apache.fop.configuration.Configurable; + /** * Interface for a converter. */ -public interface BitmapProducer { +public interface BitmapProducer extends Configurable { /** * Produces a BufferedImage from the source file by invoking the FO processor and diff --git a/fop-core/src/test/java/org/apache/fop/visual/BitmapProducerJava2D.java b/fop-core/src/test/java/org/apache/fop/visual/BitmapProducerJava2D.java index c29de1e85..96a0d0f94 100644 --- a/fop-core/src/test/java/org/apache/fop/visual/BitmapProducerJava2D.java +++ b/fop-core/src/test/java/org/apache/fop/visual/BitmapProducerJava2D.java @@ -30,15 +30,15 @@ import javax.xml.transform.Transformer; import javax.xml.transform.sax.SAXResult; import javax.xml.transform.stream.StreamSource; -import org.apache.avalon.framework.configuration.Configurable; -import org.apache.avalon.framework.configuration.Configuration; -import org.apache.avalon.framework.configuration.ConfigurationException; 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; +import org.apache.fop.configuration.Configurable; +import org.apache.fop.configuration.Configuration; +import org.apache.fop.configuration.ConfigurationException; import org.apache.fop.util.DefaultErrorListener; /** diff --git a/fop-core/src/test/java/org/apache/fop/visual/ReferenceBitmapLoader.java b/fop-core/src/test/java/org/apache/fop/visual/ReferenceBitmapLoader.java index 29b0afd00..2100178f0 100644 --- a/fop-core/src/test/java/org/apache/fop/visual/ReferenceBitmapLoader.java +++ b/fop-core/src/test/java/org/apache/fop/visual/ReferenceBitmapLoader.java @@ -23,9 +23,9 @@ import java.awt.image.BufferedImage; import java.io.File; import java.net.URI; -import org.apache.avalon.framework.configuration.Configurable; -import org.apache.avalon.framework.configuration.Configuration; -import org.apache.avalon.framework.configuration.ConfigurationException; +import org.apache.fop.configuration.Configurable; +import org.apache.fop.configuration.Configuration; +import org.apache.fop.configuration.ConfigurationException; /** * BitmapProducer implementation that simply loads preproduced reference bitmaps from a @@ -47,7 +47,6 @@ public class ReferenceBitmapLoader extends AbstractBitmapProducer implements Con super(baseUri); } - /** @see org.apache.avalon.framework.configuration.Configurable */ public void configure(Configuration cfg) throws ConfigurationException { this.bitmapDirectory = new File(cfg.getChild("directory").getValue(null)); if (!bitmapDirectory.exists()) { diff --git a/fop-servlet/pom.xml b/fop-servlet/pom.xml index 8b28ed631..73779cd27 100644 --- a/fop-servlet/pom.xml +++ b/fop-servlet/pom.xml @@ -44,16 +44,6 @@ <artifactId>commons-logging</artifactId> <version>${commons.logging.version}</version> </dependency> - <dependency> - <groupId>org.apache.avalon.framework</groupId> - <artifactId>avalon-framework-api</artifactId> - <version>${avalon.version}</version> - </dependency> - <dependency> - <groupId>org.apache.avalon.framework</groupId> - <artifactId>avalon-framework-impl</artifactId> - <version>${avalon.version}</version> - </dependency> </dependencies> <build> @@ -63,8 +53,6 @@ <version>${war.plugin.version}</version> <configuration> <packagingIncludes> - WEB-INF/lib/avalon-framework-api-${avalon.version}.jar, - WEB-INF/lib/avalon-framework-impl-${avalon.version}.jar, WEB-INF/lib/batik-all-*.jar, WEB-INF/lib/commons-io-${commons.io.version}.jar, WEB-INF/lib/commons-logging-${commons.logging.version}.jar, diff --git a/fop-transcoder-allinone/pom.xml b/fop-transcoder-allinone/pom.xml index 13a03d40b..ca93d1251 100644 --- a/fop-transcoder-allinone/pom.xml +++ b/fop-transcoder-allinone/pom.xml @@ -42,17 +42,6 @@ <version>${commons.logging.version}</version> </dependency> <dependency> - <groupId>org.apache.avalon.framework</groupId> - <artifactId>avalon-framework-api</artifactId> - <version>${avalon.version}</version> - </dependency> - <dependency> - <groupId>org.apache.avalon.framework</groupId> - <artifactId>avalon-framework-impl</artifactId> - <version>${avalon.version}</version> - </dependency> - <!-- test deps --> - <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>${junit.version}</version> diff --git a/fop-transcoder-allinone/src/tools/resources/assembly/assembly.xml b/fop-transcoder-allinone/src/tools/resources/assembly/assembly.xml index 9913561e6..838edf610 100644 --- a/fop-transcoder-allinone/src/tools/resources/assembly/assembly.xml +++ b/fop-transcoder-allinone/src/tools/resources/assembly/assembly.xml @@ -22,10 +22,6 @@ <unpack>true</unpack> <unpackOptions> <includes> - <include>org/apache/avalon/framework/*</include> - <include>org/apache/avalon/framework/activity/*</include> - <include>org/apache/avalon/framework/configuration/*</include> - <include>org/apache/avalon/framework/container/*</include> <include>org/apache/commons/io/*.class</include> <include>org/apache/commons/io/filefilter/*.class</include> <include>org/apache/commons/io/output/*.class</include> diff --git a/fop/build.xml b/fop/build.xml index cc286b2bd..3547015fe 100644 --- a/fop/build.xml +++ b/fop/build.xml @@ -73,7 +73,6 @@ list of possible build targets. <fileset dir="${basedir}/.." id="dist.bin.lib"> <patternset id="dist.lib"> <include name="fop/lib/README*"/> - <include name="fop/lib/avalon-framework*"/> <include name="fop/lib/batik*"/> <include name="fop/lib/commons-io*"/> <include name="fop/lib/commons-logging*"/> @@ -597,7 +596,6 @@ list of possible build targets. <echo message="Creating the WAR file"/> <war warfile="${build.dir}/fop.war" webxml="${servlet.src.dir}/main/webapp/WEB-INF/web.xml"> <lib dir="${lib.dir}"> - <include name="avalon-framework*.jar"/> <include name="commons-logging*.jar"/> <include name="batik*.jar"/> <include name="commons-io*.jar"/> @@ -642,6 +640,7 @@ list of possible build targets. <include name="org/apache/fop/util/DecimalFormatCache*.class"/> <include name="org/apache/fop/util/ImageObject.class"/> <include name="org/apache/fop/util/HexEncoder.class"/> + <include name="org/apache/fop/configuration/**"/> </patternset> <!-- PDF transcoder --> <patternset> @@ -665,7 +664,6 @@ list of possible build targets. </fileset> <fileset dir="${lib.dir}" id="transcoder-lib-files"> <include name="commons-io*.jar"/> - <include name="avalon-framework*.jar"/> <include name="commons-logging*.jar"/> <include name="xmlgraphics-commons*.jar"/> </fileset> @@ -698,10 +696,6 @@ list of possible build targets. <mkdir dir="${transcoder-deps}"/> <unjar dest="${transcoder-deps}"> <patternset> - <include name="org/apache/avalon/framework/*"/> - <include name="org/apache/avalon/framework/activity/*"/> - <include name="org/apache/avalon/framework/configuration/*"/> - <include name="org/apache/avalon/framework/container/*"/> <include name="org/apache/commons/logging/**"/> <include name="org/apache/commons/io/*.class"/> <include name="org/apache/commons/io/filefilter/*.class"/> @@ -712,7 +706,6 @@ list of possible build targets. <mkdir dir="${transcoder-deps}/legal"/> <copy todir="${transcoder-deps}/legal"> <fileset dir="${lib.dir}"> - <include name="avalon.LICENSE.txt"/> <include name="commons-io.LICENSE.txt"/> <include name="commons-logging.LICENSE.txt"/> </fileset> diff --git a/fop/examples/embedding/build.xml b/fop/examples/embedding/build.xml index 0ad70d03c..2439f73f6 100644 --- a/fop/examples/embedding/build.xml +++ b/fop/examples/embedding/build.xml @@ -33,7 +33,6 @@ <!-- stuff --> <path id="project.class.path"> <fileset dir="${fop.lib.dir}"> - <include name="avalon-framework*.jar"/> <include name="batik*.jar"/> <include name="xml-apis*.jar"/> <include name="xerces*.jar"/> diff --git a/fop/examples/embedding/java/embedding/ExampleAWTViewer.java b/fop/examples/embedding/java/embedding/ExampleAWTViewer.java index 0d75a7319..24718ce49 100644 --- a/fop/examples/embedding/java/embedding/ExampleAWTViewer.java +++ b/fop/examples/embedding/java/embedding/ExampleAWTViewer.java @@ -31,8 +31,6 @@ import javax.xml.transform.TransformerFactory; import javax.xml.transform.sax.SAXResult; import javax.xml.transform.stream.StreamSource; -import org.apache.avalon.framework.ExceptionUtil; - import org.apache.fop.apps.FOPException; import org.apache.fop.apps.Fop; import org.apache.fop.apps.FopFactory; @@ -103,7 +101,7 @@ public class ExampleAWTViewer { System.out.println("Success!"); } catch (Exception e) { - System.err.println(ExceptionUtil.printStackTrace(e)); +// System.err.println(ExceptionUtil.printStackTrace(e)); System.exit(-1); } } diff --git a/fop/examples/embedding/java/embedding/ExampleEPS.java b/fop/examples/embedding/java/embedding/ExampleEPS.java index d35413f60..03540c41b 100644 --- a/fop/examples/embedding/java/embedding/ExampleEPS.java +++ b/fop/examples/embedding/java/embedding/ExampleEPS.java @@ -21,12 +21,12 @@ package embedding; import java.awt.Font; +import java.io.File; import java.io.FileOutputStream; import java.io.OutputStream; -import org.apache.avalon.framework.configuration.Configuration; -import org.apache.avalon.framework.configuration.DefaultConfigurationBuilder; - +import org.apache.fop.configuration.Configuration; +import org.apache.fop.configuration.DefaultConfigurationBuilder; import org.apache.xmlgraphics.java2d.GraphicContext; import org.apache.xmlgraphics.java2d.ps.EPSDocumentGraphics2D; @@ -43,7 +43,7 @@ public class ExampleEPS { try { String configFile = "examples/fop-eps.xconf"; DefaultConfigurationBuilder cfgBuilder = new DefaultConfigurationBuilder(); - Configuration c = cfgBuilder.buildFromFile(configFile); + Configuration c = cfgBuilder.buildFromFile(new File(configFile)); FontInfo fontInfo = PDFDocumentGraphics2DConfigurator.createFontInfo(c, false); diff --git a/fop/examples/embedding/java/embedding/ExampleJava2D2PDF.java b/fop/examples/embedding/java/embedding/ExampleJava2D2PDF.java index 7a9b12cd0..abe6d7f86 100644 --- a/fop/examples/embedding/java/embedding/ExampleJava2D2PDF.java +++ b/fop/examples/embedding/java/embedding/ExampleJava2D2PDF.java @@ -30,13 +30,13 @@ import java.io.StringReader; import javax.swing.JEditorPane; -import org.apache.avalon.framework.configuration.Configuration; -import org.apache.avalon.framework.configuration.ConfigurationException; -import org.apache.avalon.framework.configuration.DefaultConfiguration; import org.apache.commons.io.IOUtils; import org.apache.xmlgraphics.util.UnitConv; +import org.apache.fop.configuration.Configuration; +import org.apache.fop.configuration.ConfigurationException; +import org.apache.fop.configuration.DefaultConfiguration; import org.apache.fop.svg.PDFDocumentGraphics2D; import org.apache.fop.svg.PDFDocumentGraphics2DConfigurator; diff --git a/fop/lib/README.txt b/fop/lib/README.txt index e61bd8559..b570edfd1 100644 --- a/fop/lib/README.txt +++ b/fop/lib/README.txt @@ -27,14 +27,6 @@ Normal Dependencies Apache License v2.0 -- Apache Avalon Framework - - avalon-framework-*.jar - http://excalibur.apache.org/framework/ - (Avalon Framework, maintained by the Apache Excalibur project) - - Apache License v2.0 - - Apache XML Graphics Commons xmlgraphics-commons-*.jar diff --git a/fop/lib/avalon-framework-api-4.3.1.jar b/fop/lib/avalon-framework-api-4.3.1.jar Binary files differdeleted file mode 100644 index b60000b34..000000000 --- a/fop/lib/avalon-framework-api-4.3.1.jar +++ /dev/null diff --git a/fop/lib/avalon-framework-impl-4.3.1.jar b/fop/lib/avalon-framework-impl-4.3.1.jar Binary files differdeleted file mode 100644 index d56e98811..000000000 --- a/fop/lib/avalon-framework-impl-4.3.1.jar +++ /dev/null diff --git a/fop/lib/avalon-framework.LICENSE.txt b/fop/lib/avalon-framework.LICENSE.txt deleted file mode 100644 index 67db85882..000000000 --- a/fop/lib/avalon-framework.LICENSE.txt +++ /dev/null @@ -1,175 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. diff --git a/fop/lib/avalon-framework.NOTICE.TXT b/fop/lib/avalon-framework.NOTICE.TXT deleted file mode 100644 index 416f7ba9b..000000000 --- a/fop/lib/avalon-framework.NOTICE.TXT +++ /dev/null @@ -1,11 +0,0 @@ - =========================================================================
- == NOTICE file corresponding to the section 4 d of ==
- == the Apache License, Version 2.0, ==
- =========================================================================
-
- This product is developed by the Apache Avalon Project.
- http://avalon.apache.org
-
- The names "Avalon" and "Merlin" must not be used to endorse or promote
- products derived from this software without prior written permission.
- For written permission, please contact pmc@avalon.apache.org.
@@ -12,7 +12,6 @@ <properties> <antrun.plugin.version>1.8</antrun.plugin.version> - <avalon.version>4.3.1</avalon.version> <batik.version>1.11.0-SNAPSHOT</batik.version> <build.helper.plugin.version>1.9.1</build.helper.plugin.version> <checkstyle.plugin.version>2.14</checkstyle.plugin.version> |