git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1851806 13f79535-47bb-0310-9956-ffa450edef68tags/fop-2_4
<artifactId>ant</artifactId> | <artifactId>ant</artifactId> | ||||
<version>1.8.2</version> | <version>1.8.2</version> | ||||
</dependency> | </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> | <dependency> | ||||
<groupId>org.apache.pdfbox</groupId> | <groupId>org.apache.pdfbox</groupId> | ||||
<artifactId>fontbox</artifactId> | <artifactId>fontbox</artifactId> |
/* | |||||
* 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); | |||||
} | |||||
} | |||||
} |
/* | |||||
* 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; | |||||
} |
import javax.xml.transform.Source; | import javax.xml.transform.Source; | ||||
import javax.xml.transform.stream.StreamSource; | 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.Log; | ||||
import org.apache.commons.logging.LogFactory; | import org.apache.commons.logging.LogFactory; | ||||
import org.apache.fop.accessibility.DummyStructureTreeEventHandler; | import org.apache.fop.accessibility.DummyStructureTreeEventHandler; | ||||
import org.apache.fop.accessibility.StructureTreeEventHandler; | import org.apache.fop.accessibility.StructureTreeEventHandler; | ||||
import org.apache.fop.apps.io.InternalResourceResolver; | 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.DefaultEventBroadcaster; | ||||
import org.apache.fop.events.Event; | import org.apache.fop.events.Event; | ||||
import org.apache.fop.events.EventBroadcaster; | import org.apache.fop.events.EventBroadcaster; |
import org.xml.sax.SAXException; | 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.Log; | ||||
import org.apache.commons.logging.LogFactory; | import org.apache.commons.logging.LogFactory; | ||||
import org.apache.fop.apps.io.InternalResourceResolver; | import org.apache.fop.apps.io.InternalResourceResolver; | ||||
import org.apache.fop.apps.io.ResourceResolverFactory; | 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.fonts.FontManagerConfigurator; | ||||
import org.apache.fop.hyphenation.HyphenationTreeCache; | import org.apache.fop.hyphenation.HyphenationTreeCache; | ||||
import org.apache.fop.hyphenation.Hyphenator; | import org.apache.fop.hyphenation.Hyphenator; |
import org.xml.sax.SAXException; | import org.xml.sax.SAXException; | ||||
import org.apache.avalon.framework.configuration.Configuration; | |||||
import org.apache.commons.logging.Log; | import org.apache.commons.logging.Log; | ||||
import org.apache.commons.logging.LogFactory; | import org.apache.commons.logging.LogFactory; | ||||
import org.apache.fop.apps.io.InternalResourceResolver; | import org.apache.fop.apps.io.InternalResourceResolver; | ||||
import org.apache.fop.apps.io.ResourceResolverFactory; | import org.apache.fop.apps.io.ResourceResolverFactory; | ||||
import org.apache.fop.configuration.Configuration; | |||||
import org.apache.fop.fo.ElementMapping; | import org.apache.fop.fo.ElementMapping; | ||||
import org.apache.fop.fo.ElementMappingRegistry; | import org.apache.fop.fo.ElementMappingRegistry; | ||||
import org.apache.fop.fonts.FontManager; | import org.apache.fop.fonts.FontManager; |
import java.util.Map; | import java.util.Map; | ||||
import java.util.Set; | import java.util.Set; | ||||
import org.apache.avalon.framework.configuration.Configuration; | |||||
import org.apache.xmlgraphics.image.loader.ImageContext; | import org.apache.xmlgraphics.image.loader.ImageContext; | ||||
import org.apache.xmlgraphics.image.loader.ImageManager; | import org.apache.xmlgraphics.image.loader.ImageManager; | ||||
import org.apache.xmlgraphics.image.loader.impl.AbstractImageSessionContext.FallbackResolver; | import org.apache.xmlgraphics.image.loader.impl.AbstractImageSessionContext.FallbackResolver; | ||||
import org.apache.fop.apps.io.InternalResourceResolver; | import org.apache.fop.apps.io.InternalResourceResolver; | ||||
import org.apache.fop.apps.io.ResourceResolverFactory; | import org.apache.fop.apps.io.ResourceResolverFactory; | ||||
import org.apache.fop.configuration.Configuration; | |||||
import org.apache.fop.fonts.FontManager; | import org.apache.fop.fonts.FontManager; | ||||
import org.apache.fop.layoutmgr.LayoutManagerMaker; | import org.apache.fop.layoutmgr.LayoutManagerMaker; | ||||
import java.util.Map; | import java.util.Map; | ||||
import java.util.Set; | import java.util.Set; | ||||
import org.apache.avalon.framework.configuration.Configuration; | |||||
import org.apache.xmlgraphics.image.loader.ImageManager; | import org.apache.xmlgraphics.image.loader.ImageManager; | ||||
import org.apache.xmlgraphics.image.loader.impl.AbstractImageSessionContext.FallbackResolver; | import org.apache.xmlgraphics.image.loader.impl.AbstractImageSessionContext.FallbackResolver; | ||||
import org.apache.xmlgraphics.io.ResourceResolver; | import org.apache.xmlgraphics.io.ResourceResolver; | ||||
import org.apache.fop.apps.io.InternalResourceResolver; | import org.apache.fop.apps.io.InternalResourceResolver; | ||||
import org.apache.fop.configuration.Configuration; | |||||
import org.apache.fop.fonts.FontManager; | import org.apache.fop.fonts.FontManager; | ||||
import org.apache.fop.layoutmgr.LayoutManagerMaker; | import org.apache.fop.layoutmgr.LayoutManagerMaker; | ||||
try { | try { | ||||
//System.out.println(Thread.currentThread().getContextClassLoader()); | //System.out.println(Thread.currentThread().getContextClassLoader()); | ||||
Class clazz = Class.forName("org.apache.commons.io.IOUtils"); | Class clazz = Class.forName("org.apache.commons.io.IOUtils"); | ||||
if (clazz != null) { | |||||
clazz = Class.forName("org.apache.avalon.framework.configuration.Configuration"); | |||||
} | |||||
return (clazz != null); | return (clazz != null); | ||||
} catch (Exception e) { | } catch (Exception e) { | ||||
return false; | return false; |
/* | |||||
* 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; | |||||
} |
/* | |||||
* 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(); | |||||
} |
/* | |||||
* 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); | |||||
} | |||||
} |
/* | |||||
* 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(); | |||||
} | |||||
} |
/* | |||||
* 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); | |||||
} | |||||
} | |||||
} |
/* | |||||
* 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>"; | |||||
} | |||||
} |
import java.util.Collections; | import java.util.Collections; | ||||
import java.util.List; | 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.Log; | ||||
import org.apache.commons.logging.LogFactory; | import org.apache.commons.logging.LogFactory; | ||||
import org.apache.fop.apps.FOPException; | 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.events.EventProducer; | ||||
import org.apache.fop.util.LogUtil; | import org.apache.fop.util.LogUtil; | ||||
package org.apache.fop.fonts; | package org.apache.fop.fonts; | ||||
import org.apache.avalon.framework.configuration.Configuration; | |||||
import org.apache.fop.apps.FOPException; | import org.apache.fop.apps.FOPException; | ||||
import org.apache.fop.configuration.Configuration; | |||||
import org.apache.fop.events.EventProducer; | import org.apache.fop.events.EventProducer; | ||||
/** | /** | ||||
* @throws FOPException if an error occurs creating the font configuration object | * @throws FOPException if an error occurs creating the font configuration object | ||||
*/ | */ | ||||
FontConfig parse(Configuration cfg, FontManager fontManager, boolean strict, | FontConfig parse(Configuration cfg, FontManager fontManager, boolean strict, | ||||
EventProducer eventProducer) throws FOPException; | |||||
EventProducer eventProducer) throws FOPException; | |||||
} | } | ||||
} | } |
import java.util.List; | import java.util.List; | ||||
import java.util.regex.Pattern; | 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.Log; | ||||
import org.apache.commons.logging.LogFactory; | import org.apache.commons.logging.LogFactory; | ||||
import org.apache.fop.apps.FOPException; | import org.apache.fop.apps.FOPException; | ||||
import org.apache.fop.apps.io.InternalResourceResolver; | import org.apache.fop.apps.io.InternalResourceResolver; | ||||
import org.apache.fop.apps.io.ResourceResolverFactory; | 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.FontSubstitutions; | ||||
import org.apache.fop.fonts.substitute.FontSubstitutionsConfigurator; | import org.apache.fop.fonts.substitute.FontSubstitutionsConfigurator; | ||||
import org.apache.fop.util.LogUtil; | import org.apache.fop.util.LogUtil; |
package org.apache.fop.fonts.substitute; | package org.apache.fop.fonts.substitute; | ||||
import org.apache.avalon.framework.configuration.Configuration; | |||||
import org.apache.fop.apps.FOPException; | import org.apache.fop.apps.FOPException; | ||||
import org.apache.fop.configuration.Configuration; | |||||
/** | /** | ||||
* Configures a font substitution catalog | * Configures a font substitution catalog |
package org.apache.fop.render; | package org.apache.fop.render; | ||||
import org.apache.avalon.framework.configuration.Configuration; | |||||
import org.apache.fop.apps.FOPException; | import org.apache.fop.apps.FOPException; | ||||
import org.apache.fop.apps.FOUserAgent; | import org.apache.fop.apps.FOUserAgent; | ||||
import org.apache.fop.configuration.Configuration; | |||||
import org.apache.fop.fonts.FontConfig; | import org.apache.fop.fonts.FontConfig; | ||||
/** | /** |
public interface RendererConfigOption { | public interface RendererConfigOption { | ||||
/** The name of the option. */ | /** The name of the option. */ | ||||
String getName(); | String getName(); | ||||
Object getDefaultValue(); | |||||
} | } |
package org.apache.fop.render; | 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.Log; | ||||
import org.apache.commons.logging.LogFactory; | import org.apache.commons.logging.LogFactory; | ||||
import org.apache.fop.apps.FOPException; | import org.apache.fop.apps.FOPException; | ||||
import org.apache.fop.apps.FOUserAgent; | import org.apache.fop.apps.FOUserAgent; | ||||
import org.apache.fop.configuration.Configuration; | |||||
import org.apache.fop.configuration.ConfigurationException; | |||||
/** | /** | ||||
* Configurator for XMLHandler objects. | * Configurator for XMLHandler objects. |
import java.util.Collections; | import java.util.Collections; | ||||
import java.util.List; | 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.Log; | ||||
import org.apache.commons.logging.LogFactory; | import org.apache.commons.logging.LogFactory; | ||||
import org.apache.fop.afp.util.AFPResourceAccessor; | import org.apache.fop.afp.util.AFPResourceAccessor; | ||||
import org.apache.fop.apps.FOPException; | import org.apache.fop.apps.FOPException; | ||||
import org.apache.fop.apps.io.InternalResourceResolver; | 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.events.EventProducer; | ||||
import org.apache.fop.fonts.EmbedFontInfo; | import org.apache.fop.fonts.EmbedFontInfo; | ||||
import org.apache.fop.fonts.FontConfig; | import org.apache.fop.fonts.FontConfig; | ||||
/** {@inheritDoc}} */ | /** {@inheritDoc}} */ | ||||
public AFPFontConfig parse(Configuration cfg, FontManager fontManager, boolean strict, | public AFPFontConfig parse(Configuration cfg, FontManager fontManager, boolean strict, | ||||
EventProducer eventProducer) throws FOPException { | |||||
EventProducer eventProducer) throws FOPException { | |||||
try { | try { | ||||
return new ParserHelper(cfg, fontManager, strict, | return new ParserHelper(cfg, fontManager, strict, | ||||
(AFPEventProducer) eventProducer).fontConfig; | (AFPEventProducer) eventProducer).fontConfig; |
package org.apache.fop.render.afp; | package org.apache.fop.render.afp; | ||||
import org.apache.avalon.framework.configuration.Configuration; | |||||
import org.apache.fop.afp.AFPGraphics2D; | import org.apache.fop.afp.AFPGraphics2D; | ||||
import org.apache.fop.afp.AFPPaintingState; | import org.apache.fop.afp.AFPPaintingState; | ||||
import org.apache.fop.afp.AFPResourceInfo; | import org.apache.fop.afp.AFPResourceInfo; | ||||
import org.apache.fop.afp.AFPResourceManager; | import org.apache.fop.afp.AFPResourceManager; | ||||
import org.apache.fop.configuration.Configuration; | |||||
import org.apache.fop.fonts.FontInfo; | import org.apache.fop.fonts.FontInfo; | ||||
/** | /** |
import java.net.URISyntaxException; | import java.net.URISyntaxException; | ||||
import java.util.EnumMap; | 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.Log; | ||||
import org.apache.commons.logging.LogFactory; | import org.apache.commons.logging.LogFactory; | ||||
import org.apache.fop.apps.FOUserAgent; | import org.apache.fop.apps.FOUserAgent; | ||||
import org.apache.fop.apps.MimeConstants; | import org.apache.fop.apps.MimeConstants; | ||||
import org.apache.fop.apps.io.InternalResourceResolver; | 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.fonts.FontManager; | ||||
import org.apache.fop.render.RendererConfig; | import org.apache.fop.render.RendererConfig; | ||||
import org.apache.fop.render.afp.AFPFontConfig.AFPFontInfoConfigParser; | import org.apache.fop.render.afp.AFPFontConfig.AFPFontInfoConfigParser; |
import java.util.Map; | import java.util.Map; | ||||
import org.apache.avalon.framework.configuration.Configuration; | |||||
import org.apache.fop.afp.AFPPaintingState; | import org.apache.fop.afp.AFPPaintingState; | ||||
import org.apache.fop.afp.AFPResourceInfo; | import org.apache.fop.afp.AFPResourceInfo; | ||||
import org.apache.fop.afp.AFPResourceManager; | import org.apache.fop.afp.AFPResourceManager; | ||||
import org.apache.fop.afp.modca.ResourceObject; | import org.apache.fop.afp.modca.ResourceObject; | ||||
import org.apache.fop.configuration.Configuration; | |||||
import org.apache.fop.render.AbstractRenderer; | import org.apache.fop.render.AbstractRenderer; | ||||
import org.apache.fop.render.ImageHandlerUtil; | import org.apache.fop.render.ImageHandlerUtil; | ||||
import org.apache.fop.render.RendererContext; | import org.apache.fop.render.RendererContext; | ||||
info.setHeight((Integer) getProperty(RendererContextConstants.HEIGHT)); | info.setHeight((Integer) getProperty(RendererContextConstants.HEIGHT)); | ||||
info.setX((Integer) getProperty(RendererContextConstants.XPOS)); | info.setX((Integer) getProperty(RendererContextConstants.XPOS)); | ||||
info.setY((Integer) getProperty(RendererContextConstants.YPOS)); | info.setY((Integer) getProperty(RendererContextConstants.YPOS)); | ||||
info.setHandlerConfiguration((Configuration)getProperty( | |||||
info.setHandlerConfiguration((Configuration) getProperty( | |||||
RendererContextConstants.HANDLER_CONFIGURATION)); | RendererContextConstants.HANDLER_CONFIGURATION)); | ||||
info.setFontInfo((org.apache.fop.fonts.FontInfo)getProperty( | info.setFontInfo((org.apache.fop.fonts.FontInfo)getProperty( | ||||
AFPRendererContextConstants.AFP_FONT_INFO)); | AFPRendererContextConstants.AFP_FONT_INFO)); |
public Class<?> getType() { | public Class<?> getType() { | ||||
return type; | return type; | ||||
} | } | ||||
@Override | |||||
public Object getDefaultValue() { | |||||
return null; | |||||
} | |||||
} | } |
* @return the enumeration object | * @return the enumeration object | ||||
*/ | */ | ||||
public static AFPShadingMode getValueOf(String name) { | public static AFPShadingMode getValueOf(String name) { | ||||
if (COLOR.getName().equalsIgnoreCase(name)) { | |||||
if (name == null || "".equals(name) || COLOR.getName().equalsIgnoreCase(name)) { | |||||
return COLOR; | return COLOR; | ||||
} else if (DITHERED.getName().equalsIgnoreCase(name)) { | } else if (DITHERED.getName().equalsIgnoreCase(name)) { | ||||
return DITHERED; | return DITHERED; |
import java.awt.image.BufferedImage; | import java.awt.image.BufferedImage; | ||||
import java.util.EnumMap; | import java.util.EnumMap; | ||||
import org.apache.avalon.framework.configuration.Configuration; | |||||
import org.apache.fop.apps.FOPException; | import org.apache.fop.apps.FOPException; | ||||
import org.apache.fop.apps.FOUserAgent; | import org.apache.fop.apps.FOUserAgent; | ||||
import org.apache.fop.configuration.Configuration; | |||||
import org.apache.fop.fonts.DefaultFontConfig; | import org.apache.fop.fonts.DefaultFontConfig; | ||||
import org.apache.fop.fonts.DefaultFontConfig.DefaultFontConfigParser; | import org.apache.fop.fonts.DefaultFontConfig.DefaultFontConfigParser; | ||||
import org.apache.fop.fonts.FontEventAdapter; | import org.apache.fop.fonts.FontEventAdapter; | ||||
} | } | ||||
private String getValue(Configuration cfg, BitmapRendererOption option) { | 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() { | public String getMimeType() { |
package org.apache.fop.render.bitmap; | package org.apache.fop.render.bitmap; | ||||
import org.apache.avalon.framework.configuration.Configuration; | |||||
import org.apache.xmlgraphics.util.MimeConstants; | import org.apache.xmlgraphics.util.MimeConstants; | ||||
import org.apache.fop.apps.FOPException; | import org.apache.fop.apps.FOPException; | ||||
import org.apache.fop.apps.FOUserAgent; | import org.apache.fop.apps.FOUserAgent; | ||||
import org.apache.fop.configuration.Configuration; | |||||
import org.apache.fop.fonts.DefaultFontConfig; | import org.apache.fop.fonts.DefaultFontConfig; | ||||
import org.apache.fop.fonts.DefaultFontConfig.DefaultFontConfigParser; | import org.apache.fop.fonts.DefaultFontConfig.DefaultFontConfigParser; | ||||
import org.apache.fop.fonts.FontEventAdapter; | import org.apache.fop.fonts.FontEventAdapter; |
import java.util.EnumMap; | import java.util.EnumMap; | ||||
import org.apache.avalon.framework.configuration.Configuration; | |||||
import org.apache.xmlgraphics.image.writer.Endianness; | import org.apache.xmlgraphics.image.writer.Endianness; | ||||
import org.apache.fop.apps.FOPException; | import org.apache.fop.apps.FOPException; | ||||
import org.apache.fop.apps.FOUserAgent; | import org.apache.fop.apps.FOUserAgent; | ||||
import org.apache.fop.apps.MimeConstants; | import org.apache.fop.apps.MimeConstants; | ||||
import org.apache.fop.configuration.Configuration; | |||||
import org.apache.fop.fonts.DefaultFontConfig; | import org.apache.fop.fonts.DefaultFontConfig; | ||||
import org.apache.fop.fonts.DefaultFontConfig.DefaultFontConfigParser; | import org.apache.fop.fonts.DefaultFontConfig.DefaultFontConfigParser; | ||||
import org.apache.fop.fonts.FontEventAdapter; | import org.apache.fop.fonts.FontEventAdapter; |
package org.apache.fop.render.intermediate; | package org.apache.fop.render.intermediate; | ||||
import org.apache.avalon.framework.configuration.Configuration; | |||||
import org.apache.fop.apps.FOPException; | import org.apache.fop.apps.FOPException; | ||||
import org.apache.fop.apps.FOUserAgent; | import org.apache.fop.apps.FOUserAgent; | ||||
import org.apache.fop.configuration.Configuration; | |||||
import org.apache.fop.fonts.DefaultFontConfig; | import org.apache.fop.fonts.DefaultFontConfig; | ||||
import org.apache.fop.fonts.DefaultFontConfig.DefaultFontConfigParser; | import org.apache.fop.fonts.DefaultFontConfig.DefaultFontConfigParser; | ||||
import org.apache.fop.fonts.FontConfig; | import org.apache.fop.fonts.FontConfig; |
import java.util.EnumMap; | import java.util.EnumMap; | ||||
import org.apache.avalon.framework.configuration.Configuration; | |||||
import org.apache.fop.apps.FOPException; | import org.apache.fop.apps.FOPException; | ||||
import org.apache.fop.apps.FOUserAgent; | import org.apache.fop.apps.FOUserAgent; | ||||
import org.apache.fop.configuration.Configuration; | |||||
import org.apache.fop.fonts.DefaultFontConfig; | import org.apache.fop.fonts.DefaultFontConfig; | ||||
import org.apache.fop.fonts.DefaultFontConfig.DefaultFontConfigParser; | import org.apache.fop.fonts.DefaultFontConfig.DefaultFontConfigParser; | ||||
import org.apache.fop.fonts.FontEventAdapter; | import org.apache.fop.fonts.FontEventAdapter; |
public String getName() { | public String getName() { | ||||
return name; | return name; | ||||
} | } | ||||
@Override | |||||
public Object getDefaultValue() { | |||||
return null; | |||||
} | |||||
} | } |
*/ | */ | ||||
public enum Java2DRendererOption implements 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 String name; | ||||
private final Class<?> type; | 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.name = name; | ||||
this.type = type; | 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} */ | /** {@inheritDoc} */ | ||||
Class<?> getType() { | Class<?> getType() { | ||||
return type; | return type; | ||||
} | } | ||||
@Override | |||||
public Object getDefaultValue() { | |||||
return defaultValue; | |||||
} | |||||
} | } |
import java.util.EnumMap; | import java.util.EnumMap; | ||||
import java.util.Map; | import java.util.Map; | ||||
import org.apache.avalon.framework.configuration.Configuration; | |||||
import org.apache.fop.apps.FOPException; | import org.apache.fop.apps.FOPException; | ||||
import org.apache.fop.apps.FOUserAgent; | import org.apache.fop.apps.FOUserAgent; | ||||
import org.apache.fop.apps.MimeConstants; | import org.apache.fop.apps.MimeConstants; | ||||
import org.apache.fop.configuration.Configuration; | |||||
import org.apache.fop.fonts.DefaultFontConfig; | import org.apache.fop.fonts.DefaultFontConfig; | ||||
import org.apache.fop.fonts.DefaultFontConfig.DefaultFontConfigParser; | import org.apache.fop.fonts.DefaultFontConfig.DefaultFontConfigParser; | ||||
import org.apache.fop.fonts.FontEventAdapter; | import org.apache.fop.fonts.FontEventAdapter; |
import java.util.List; | import java.util.List; | ||||
import java.util.Map; | 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.Log; | ||||
import org.apache.commons.logging.LogFactory; | import org.apache.commons.logging.LogFactory; | ||||
import org.apache.fop.apps.FOPException; | import org.apache.fop.apps.FOPException; | ||||
import org.apache.fop.apps.FOUserAgent; | import org.apache.fop.apps.FOUserAgent; | ||||
import org.apache.fop.apps.MimeConstants; | 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; | ||||
import org.apache.fop.fonts.DefaultFontConfig.DefaultFontConfigParser; | import org.apache.fop.fonts.DefaultFontConfig.DefaultFontConfigParser; | ||||
import org.apache.fop.fonts.FontEventAdapter; | import org.apache.fop.fonts.FontEventAdapter; | ||||
private String parseConfig(Configuration cfg, RendererConfigOption option) { | private String parseConfig(Configuration cfg, RendererConfigOption option) { | ||||
Configuration child = cfg.getChild(option.getName()); | 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) { | private boolean doesValueExist(Configuration cfg, RendererConfigOption option) { |
import java.io.OutputStream; | import java.io.OutputStream; | ||||
import java.util.Map; | import java.util.Map; | ||||
import org.apache.avalon.framework.configuration.Configuration; | |||||
import org.apache.commons.logging.Log; | import org.apache.commons.logging.Log; | ||||
import org.apache.commons.logging.LogFactory; | import org.apache.commons.logging.LogFactory; | ||||
import org.apache.fop.configuration.Configuration; | |||||
import org.apache.fop.fonts.FontInfo; | import org.apache.fop.fonts.FontInfo; | ||||
import org.apache.fop.pdf.PDFDocument; | import org.apache.fop.pdf.PDFDocument; | ||||
import org.apache.fop.pdf.PDFPage; | import org.apache.fop.pdf.PDFPage; |
import java.util.EnumMap; | import java.util.EnumMap; | ||||
import java.util.Locale; | 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.Log; | ||||
import org.apache.commons.logging.LogFactory; | import org.apache.commons.logging.LogFactory; | ||||
import org.apache.fop.apps.FOPException; | import org.apache.fop.apps.FOPException; | ||||
import org.apache.fop.apps.FOUserAgent; | import org.apache.fop.apps.FOUserAgent; | ||||
import org.apache.fop.apps.MimeConstants; | 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; | ||||
import org.apache.fop.fonts.DefaultFontConfig.DefaultFontConfigParser; | import org.apache.fop.fonts.DefaultFontConfig.DefaultFontConfigParser; | ||||
import org.apache.fop.fonts.FontEventAdapter; | import org.apache.fop.fonts.FontEventAdapter; |
import org.w3c.dom.Document; | import org.w3c.dom.Document; | ||||
import org.apache.avalon.framework.configuration.Configuration; | |||||
import org.apache.batik.bridge.BridgeContext; | import org.apache.batik.bridge.BridgeContext; | ||||
import org.apache.batik.bridge.GVTBuilder; | import org.apache.batik.bridge.GVTBuilder; | ||||
import org.apache.batik.gvt.GraphicsNode; | import org.apache.batik.gvt.GraphicsNode; | ||||
import org.apache.xmlgraphics.java2d.ps.PSGraphics2D; | import org.apache.xmlgraphics.java2d.ps.PSGraphics2D; | ||||
import org.apache.xmlgraphics.ps.PSGenerator; | import org.apache.xmlgraphics.ps.PSGenerator; | ||||
import org.apache.fop.configuration.Configuration; | |||||
import org.apache.fop.fonts.FontInfo; | import org.apache.fop.fonts.FontInfo; | ||||
import org.apache.fop.image.loader.batik.BatikUtil; | import org.apache.fop.image.loader.batik.BatikUtil; | ||||
import org.apache.fop.render.AbstractGenericSVGHandler; | import org.apache.fop.render.AbstractGenericSVGHandler; |
import java.util.EnumMap; | import java.util.EnumMap; | ||||
import org.apache.avalon.framework.configuration.Configuration; | |||||
import org.apache.fop.apps.FOPException; | import org.apache.fop.apps.FOPException; | ||||
import org.apache.fop.apps.FOUserAgent; | import org.apache.fop.apps.FOUserAgent; | ||||
import org.apache.fop.apps.MimeConstants; | import org.apache.fop.apps.MimeConstants; | ||||
import org.apache.fop.configuration.Configuration; | |||||
import org.apache.fop.fonts.DefaultFontConfig; | import org.apache.fop.fonts.DefaultFontConfig; | ||||
import org.apache.fop.fonts.DefaultFontConfig.DefaultFontConfigParser; | import org.apache.fop.fonts.DefaultFontConfig.DefaultFontConfigParser; | ||||
import org.apache.fop.fonts.FontEventAdapter; | import org.apache.fop.fonts.FontEventAdapter; |
import org.w3c.dom.DOMImplementation; | import org.w3c.dom.DOMImplementation; | ||||
import org.xml.sax.EntityResolver; | 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.Log; | ||||
import org.apache.commons.logging.impl.SimpleLog; | import org.apache.commons.logging.impl.SimpleLog; | ||||
import org.apache.xmlgraphics.image.loader.impl.AbstractImageSessionContext; | import org.apache.xmlgraphics.image.loader.impl.AbstractImageSessionContext; | ||||
import org.apache.xmlgraphics.util.UnitConv; | 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; | import org.apache.fop.svg.font.FOPFontFamilyResolver; | ||||
/** | /** |
import java.net.URI; | import java.net.URI; | ||||
import java.util.List; | 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.FOPException; | ||||
import org.apache.fop.apps.io.InternalResourceResolver; | import org.apache.fop.apps.io.InternalResourceResolver; | ||||
import org.apache.fop.apps.io.ResourceResolverFactory; | 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.DefaultFontConfig; | ||||
import org.apache.fop.fonts.DefaultFontConfigurator; | import org.apache.fop.fonts.DefaultFontConfigurator; | ||||
import org.apache.fop.fonts.EmbedFontInfo; | import org.apache.fop.fonts.EmbedFontInfo; |
import org.w3c.dom.Document; | import org.w3c.dom.Document; | ||||
import org.w3c.dom.svg.SVGLength; | import org.w3c.dom.svg.SVGLength; | ||||
import org.apache.avalon.framework.configuration.Configuration; | |||||
import org.apache.batik.bridge.BridgeContext; | import org.apache.batik.bridge.BridgeContext; | ||||
import org.apache.batik.bridge.UnitProcessor; | import org.apache.batik.bridge.UnitProcessor; | ||||
import org.apache.batik.ext.awt.RenderingHintsKeyExt; | import org.apache.batik.ext.awt.RenderingHintsKeyExt; | ||||
import org.apache.batik.transcoder.image.ImageTranscoder; | import org.apache.batik.transcoder.image.ImageTranscoder; | ||||
import org.apache.fop.Version; | import org.apache.fop.Version; | ||||
import org.apache.fop.configuration.Configuration; | |||||
import org.apache.fop.fonts.FontInfo; | import org.apache.fop.fonts.FontInfo; | ||||
import org.apache.fop.svg.font.FOPFontFamilyResolverImpl; | import org.apache.fop.svg.font.FOPFontFamilyResolverImpl; | ||||
import static org.mockito.Mockito.mock; | import static org.mockito.Mockito.mock; | ||||
import static org.mockito.Mockito.when; | 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.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.events.DefaultEventBroadcaster; | ||||
import org.apache.fop.fonts.FontManager; | import org.apache.fop.fonts.FontManager; | ||||
import org.apache.fop.render.RendererConfig; | import org.apache.fop.render.RendererConfig; |
import static org.mockito.Mockito.mock; | import static org.mockito.Mockito.mock; | ||||
import static org.mockito.Mockito.when; | import static org.mockito.Mockito.when; | ||||
import org.apache.avalon.framework.configuration.ConfigurationException; | |||||
import org.apache.fop.apps.FopConfBuilder.RendererConfBuilder; | import org.apache.fop.apps.FopConfBuilder.RendererConfBuilder; | ||||
import org.apache.fop.configuration.ConfigurationException; | |||||
import org.apache.fop.render.PrintRendererConfigurator; | import org.apache.fop.render.PrintRendererConfigurator; | ||||
import org.apache.fop.render.intermediate.IFDocumentHandler; | import org.apache.fop.render.intermediate.IFDocumentHandler; | ||||
import java.util.Map; | import java.util.Map; | ||||
import java.util.Set; | import java.util.Set; | ||||
import org.apache.avalon.framework.configuration.Configuration; | |||||
import org.apache.xmlgraphics.image.loader.ImageManager; | import org.apache.xmlgraphics.image.loader.ImageManager; | ||||
import org.apache.xmlgraphics.image.loader.impl.AbstractImageSessionContext.FallbackResolver; | import org.apache.xmlgraphics.image.loader.impl.AbstractImageSessionContext.FallbackResolver; | ||||
import org.apache.xmlgraphics.io.ResourceResolver; | import org.apache.xmlgraphics.io.ResourceResolver; | ||||
import org.apache.fop.apps.io.InternalResourceResolver; | import org.apache.fop.apps.io.InternalResourceResolver; | ||||
import org.apache.fop.configuration.Configuration; | |||||
import org.apache.fop.fonts.FontManager; | import org.apache.fop.fonts.FontManager; | ||||
import org.apache.fop.layoutmgr.LayoutManagerMaker; | import org.apache.fop.layoutmgr.LayoutManagerMaker; | ||||
import org.xml.sax.SAXException; | import org.xml.sax.SAXException; | ||||
import org.apache.avalon.framework.configuration.DefaultConfigurationBuilder; | |||||
import org.apache.commons.logging.Log; | import org.apache.commons.logging.Log; | ||||
import org.apache.commons.logging.LogFactory; | import org.apache.commons.logging.LogFactory; | ||||
import org.apache.fop.apps.FOUserAgent; | import org.apache.fop.apps.FOUserAgent; | ||||
import org.apache.fop.configuration.DefaultConfigurationBuilder; | |||||
import org.apache.fop.render.pdf.BasePDFTest; | import org.apache.fop.render.pdf.BasePDFTest; | ||||
import static org.apache.fop.FOPTestUtils.getBaseDir; | import static org.apache.fop.FOPTestUtils.getBaseDir; |
package org.apache.fop.threading; | 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.Event; | ||||
import org.apache.fop.events.EventFormatter; | import org.apache.fop.events.EventFormatter; | ||||
*/ | */ | ||||
class AvalonAdapter implements EventListener { | class AvalonAdapter implements EventListener { | ||||
private final Logger logger; | |||||
private final Log logger; | |||||
private String filename; | private String filename; | ||||
public AvalonAdapter(Logger logger, String filename) { | |||||
public AvalonAdapter(Log logger, String filename) { | |||||
this.logger = logger; | this.logger = logger; | ||||
this.filename = filename; | this.filename = filename; | ||||
} | } | ||||
} else if (severity == EventSeverity.ERROR) { | } else if (severity == EventSeverity.ERROR) { | ||||
logger.error(filename + ": " + msg); | logger.error(filename + ": " + msg); | ||||
} else if (severity == EventSeverity.FATAL) { | } else if (severity == EventSeverity.FATAL) { | ||||
logger.fatalError(filename + ": " + msg); | |||||
logger.fatal(filename + ": " + msg); | |||||
} else { | } else { | ||||
assert false; | assert false; | ||||
} | } |
import javax.xml.transform.TransformerFactory; | import javax.xml.transform.TransformerFactory; | ||||
import javax.xml.transform.stream.StreamSource; | 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.IOUtils; | ||||
import org.apache.commons.io.output.CountingOutputStream; | import org.apache.commons.io.output.CountingOutputStream; | ||||
import org.apache.commons.io.output.NullOutputStream; | 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 | * 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. | * times in a configurable number of threads to easily reproduce multi-threading issues. | ||||
*/ | */ | ||||
public class FOPTestbed extends AbstractLogEnabled | |||||
public class FOPTestbed | |||||
implements Configurable, Initializable { | implements Configurable, Initializable { | ||||
private static final Log LOG = LogFactory.getLog(FOPTestbed.class); | |||||
private int repeat; | private int repeat; | ||||
private List taskList = new java.util.ArrayList(); | private List taskList = new java.util.ArrayList(); | ||||
private int threads; | private int threads; | ||||
* Starts the stress test. | * Starts the stress test. | ||||
*/ | */ | ||||
public void doStressTest() { | public void doStressTest() { | ||||
getLogger().info("Starting stress test..."); | |||||
LOG.info("Starting stress test..."); | |||||
long start = System.currentTimeMillis(); | long start = System.currentTimeMillis(); | ||||
this.counter = 0; | this.counter = 0; | ||||
List threadList = new java.util.LinkedList(); | List threadList = new java.util.LinkedList(); | ||||
for (int ti = 0; ti < this.threads; ti++) { | for (int ti = 0; ti < this.threads; ti++) { | ||||
TaskRunner runner = new TaskRunner(); | TaskRunner runner = new TaskRunner(); | ||||
ContainerUtil.enableLogging(runner, getLogger()); | |||||
// ContainerUtil.enableLogging(runner, logger); | |||||
Thread thread = new Thread(workerGroup, runner, "Worker- " + ti); | Thread thread = new Thread(workerGroup, runner, "Worker- " + ti); | ||||
threadList.add(thread); | threadList.add(thread); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
private class TaskRunner extends AbstractLogEnabled implements Runnable { | |||||
private class TaskRunner implements Runnable { | |||||
public void run() { | public void run() { | ||||
try { | try { | ||||
for (Object aTaskList : taskList) { | for (Object aTaskList : taskList) { | ||||
TaskDef def = (TaskDef) aTaskList; | TaskDef def = (TaskDef) aTaskList; | ||||
final Task task = new Task(def, counter++, foprocessor); | final Task task = new Task(def, counter++, foprocessor); | ||||
ContainerUtil.enableLogging(task, getLogger()); | |||||
// ContainerUtil.enableLogging(task, logger); | |||||
task.execute(); | task.execute(); | ||||
} | } | ||||
} | } | ||||
} catch (Exception e) { | } catch (Exception e) { | ||||
getLogger().error("Thread ended with an exception", e); | |||||
LOG.error("Thread ended with an exception", e); | |||||
} | } | ||||
} | } | ||||
Class clazz = Class.forName(this.fopCfg.getAttribute("class", | Class clazz = Class.forName(this.fopCfg.getAttribute("class", | ||||
"org.apache.fop.threading.FOProcessorImpl")); | "org.apache.fop.threading.FOProcessorImpl")); | ||||
Processor fop = (Processor)clazz.getDeclaredConstructor().newInstance(); | Processor fop = (Processor)clazz.getDeclaredConstructor().newInstance(); | ||||
ContainerUtil.enableLogging(fop, getLogger()); | |||||
// ContainerUtil.enableLogging(fop, logger); | |||||
ContainerUtil.configure(fop, this.fopCfg); | ContainerUtil.configure(fop, this.fopCfg); | ||||
ContainerUtil.initialize(fop); | ContainerUtil.initialize(fop); | ||||
return fop; | return fop; | ||||
} catch (Exception e) { | } catch (Exception e) { | ||||
throw new CascadingRuntimeException("Error creating FO Processor", e); | |||||
throw new RuntimeException("Error creating FO Processor", e); | |||||
} | } | ||||
} | } | ||||
} | } | ||||
private class Task extends AbstractLogEnabled implements Executable { | |||||
private class Task { | |||||
private TaskDef def; | private TaskDef def; | ||||
private int num; | private int num; | ||||
public void execute() throws Exception { | public void execute() throws Exception { | ||||
getLogger().info("Processing: " + def); | |||||
LOG.info("Processing: " + def); | |||||
long start = System.currentTimeMillis(); | long start = System.currentTimeMillis(); | ||||
try { | try { | ||||
DecimalFormat df = new DecimalFormat("00000"); | DecimalFormat df = new DecimalFormat("00000"); |
import org.xml.sax.SAXException; | 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.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.FOPException; | ||||
import org.apache.fop.apps.FOUserAgent; | import org.apache.fop.apps.FOUserAgent; | ||||
import org.apache.fop.apps.Fop; | import org.apache.fop.apps.Fop; | ||||
import org.apache.fop.apps.FopFactory; | import org.apache.fop.apps.FopFactory; | ||||
import org.apache.fop.apps.MimeConstants; | 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. | * Default implementation of the {@link Processor} interface using FOP. | ||||
*/ | */ | ||||
public class FOProcessorImpl extends AbstractLogEnabled | |||||
public class FOProcessorImpl | |||||
implements Processor, Configurable, Initializable { | implements Processor, Configurable, Initializable { | ||||
private static final Log LOG = LogFactory.getLog(FOProcessorImpl.class); | |||||
private FopFactory fopFactory; | private FopFactory fopFactory; | ||||
private TransformerFactory factory = TransformerFactory.newInstance(); | private TransformerFactory factory = TransformerFactory.newInstance(); | ||||
private URI userconfig; | private URI userconfig; | ||||
public void initialize() throws Exception { | public void initialize() throws Exception { | ||||
if (this.userconfig != null) { | if (this.userconfig != null) { | ||||
getLogger().debug("Setting user config: " + userconfig); | |||||
LOG.debug("Setting user config: " + userconfig); | |||||
fopFactory = FopFactory.newInstance(new File(userconfig)); | fopFactory = FopFactory.newInstance(new File(userconfig)); | ||||
} else { | } else { | ||||
fopFactory = FopFactory.newInstance(new File(".").toURI()); | fopFactory = FopFactory.newInstance(new File(".").toURI()); | ||||
URL url = new URL(src.getSystemId()); | URL url = new URL(src.getSystemId()); | ||||
String filename = FilenameUtils.getName(url.getPath()); | String filename = FilenameUtils.getName(url.getPath()); | ||||
foUserAgent.getEventBroadcaster().addEventListener( | foUserAgent.getEventBroadcaster().addEventListener( | ||||
new AvalonAdapter(getLogger(), filename)); | |||||
new AvalonAdapter(LOG, filename)); | |||||
} catch (MalformedURLException mfue) { | } catch (MalformedURLException mfue) { | ||||
throw new RuntimeException(mfue); | throw new RuntimeException(mfue); | ||||
} | } |
import org.xml.sax.ContentHandler; | 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.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.FOPException; | ||||
import org.apache.fop.apps.FOUserAgent; | import org.apache.fop.apps.FOUserAgent; | ||||
import org.apache.fop.apps.FopFactory; | import org.apache.fop.apps.FopFactory; | ||||
import org.apache.fop.apps.MimeConstants; | 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.IFDocumentHandler; | ||||
import org.apache.fop.render.intermediate.IFException; | import org.apache.fop.render.intermediate.IFException; | ||||
import org.apache.fop.render.intermediate.IFParser; | import org.apache.fop.render.intermediate.IFParser; | ||||
/** | /** | ||||
* Implementation of the {@link Processor} interface that renders IF XML to a final output format. | * 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 { | implements Processor, Configurable, Initializable { | ||||
private static final Log LOGGER = LogFactory.getLog(IFProcessorImpl.class); | |||||
private FopFactory fopFactory; | private FopFactory fopFactory; | ||||
private TransformerFactory factory = TransformerFactory.newInstance(); | private TransformerFactory factory = TransformerFactory.newInstance(); | ||||
private String userconfig; | private String userconfig; | ||||
/** {@inheritDoc} */ | /** {@inheritDoc} */ | ||||
public void initialize() throws Exception { | public void initialize() throws Exception { | ||||
if (this.userconfig != null) { | if (this.userconfig != null) { | ||||
getLogger().debug("Setting user config: " + userconfig); | |||||
LOGGER.debug("Setting user config: " + userconfig); | |||||
fopFactory = FopFactory.newInstance(new File(this.userconfig)); | fopFactory = FopFactory.newInstance(new File(this.userconfig)); | ||||
} else { | } else { | ||||
fopFactory = FopFactory.newInstance(new File(".").toURI()); | fopFactory = FopFactory.newInstance(new File(".").toURI()); | ||||
URL url = new URL(src.getSystemId()); | URL url = new URL(src.getSystemId()); | ||||
String filename = FilenameUtils.getName(url.getPath()); | String filename = FilenameUtils.getName(url.getPath()); | ||||
foUserAgent.getEventBroadcaster().addEventListener( | foUserAgent.getEventBroadcaster().addEventListener( | ||||
new AvalonAdapter(getLogger(), filename)); | |||||
new AvalonAdapter(LOGGER, filename)); | |||||
} catch (MalformedURLException mfue) { | } catch (MalformedURLException mfue) { | ||||
throw new RuntimeException(mfue); | throw new RuntimeException(mfue); | ||||
} | } |
import java.io.File; | import java.io.File; | ||||
import java.io.IOException; | 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. | * Starter class for the multi-threading testbed. | ||||
//Setup testbed | //Setup testbed | ||||
FOPTestbed testbed = new FOPTestbed(); | 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.configure(testbed, cfg); | ||||
ContainerUtil.initialize(testbed); | ContainerUtil.initialize(testbed); | ||||
System.exit(0); | System.exit(0); | ||||
} catch (Exception e) { | } catch (Exception e) { | ||||
System.err.println(ExceptionUtil.printStackTrace(e)); | |||||
// System.err.println(ExceptionUtil.printStackTrace(e)); | |||||
e.printStackTrace(System.err); | |||||
System.exit(-1); | System.exit(-1); | ||||
} | } | ||||
} | } |
import javax.xml.transform.Source; | import javax.xml.transform.Source; | ||||
import javax.xml.transform.Templates; | import javax.xml.transform.Templates; | ||||
import org.apache.fop.activity.Initializable; | |||||
import org.apache.fop.configuration.Configurable; | |||||
/** | /** | ||||
* Represents a processor. | * Represents a processor. | ||||
*/ | */ | ||||
public interface Processor { | |||||
public interface Processor extends Configurable, Initializable { | |||||
/** | /** | ||||
* Process a file. | * Process a file. |
import javax.xml.transform.sax.SAXResult; | import javax.xml.transform.sax.SAXResult; | ||||
import javax.xml.transform.stream.StreamSource; | 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.commons.io.IOUtils; | ||||
import org.apache.fop.apps.FOUserAgent; | import org.apache.fop.apps.FOUserAgent; | ||||
import org.apache.fop.apps.Fop; | import org.apache.fop.apps.Fop; | ||||
import org.apache.fop.apps.FopFactory; | 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; | import org.apache.fop.util.DefaultErrorListener; | ||||
/** | /** |
import org.xml.sax.SAXException; | 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.FileUtils; | ||||
import org.apache.commons.io.filefilter.AndFileFilter; | import org.apache.commons.io.filefilter.AndFileFilter; | ||||
import org.apache.commons.io.filefilter.IOFileFilter; | import org.apache.commons.io.filefilter.IOFileFilter; | ||||
import org.apache.xmlgraphics.image.writer.ImageWriterUtil; | 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; | import org.apache.fop.layoutengine.LayoutEngineTestUtils; | ||||
/** | /** |
import java.awt.image.BufferedImage; | import java.awt.image.BufferedImage; | ||||
import java.io.File; | import java.io.File; | ||||
import org.apache.fop.configuration.Configurable; | |||||
/** | /** | ||||
* Interface for a converter. | * 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 | * Produces a BufferedImage from the source file by invoking the FO processor and |
import javax.xml.transform.sax.SAXResult; | import javax.xml.transform.sax.SAXResult; | ||||
import javax.xml.transform.stream.StreamSource; | 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.commons.io.IOUtils; | ||||
import org.apache.fop.apps.FOUserAgent; | import org.apache.fop.apps.FOUserAgent; | ||||
import org.apache.fop.apps.Fop; | import org.apache.fop.apps.Fop; | ||||
import org.apache.fop.apps.FopFactory; | import org.apache.fop.apps.FopFactory; | ||||
import org.apache.fop.apps.MimeConstants; | 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; | import org.apache.fop.util.DefaultErrorListener; | ||||
/** | /** |
import java.io.File; | import java.io.File; | ||||
import java.net.URI; | 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 | * BitmapProducer implementation that simply loads preproduced reference bitmaps from a | ||||
super(baseUri); | super(baseUri); | ||||
} | } | ||||
/** @see org.apache.avalon.framework.configuration.Configurable */ | |||||
public void configure(Configuration cfg) throws ConfigurationException { | public void configure(Configuration cfg) throws ConfigurationException { | ||||
this.bitmapDirectory = new File(cfg.getChild("directory").getValue(null)); | this.bitmapDirectory = new File(cfg.getChild("directory").getValue(null)); | ||||
if (!bitmapDirectory.exists()) { | if (!bitmapDirectory.exists()) { |
<artifactId>commons-logging</artifactId> | <artifactId>commons-logging</artifactId> | ||||
<version>${commons.logging.version}</version> | <version>${commons.logging.version}</version> | ||||
</dependency> | </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> | </dependencies> | ||||
<build> | <build> | ||||
<version>${war.plugin.version}</version> | <version>${war.plugin.version}</version> | ||||
<configuration> | <configuration> | ||||
<packagingIncludes> | <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/batik-all-*.jar, | ||||
WEB-INF/lib/commons-io-${commons.io.version}.jar, | WEB-INF/lib/commons-io-${commons.io.version}.jar, | ||||
WEB-INF/lib/commons-logging-${commons.logging.version}.jar, | WEB-INF/lib/commons-logging-${commons.logging.version}.jar, |
<artifactId>commons-logging</artifactId> | <artifactId>commons-logging</artifactId> | ||||
<version>${commons.logging.version}</version> | <version>${commons.logging.version}</version> | ||||
</dependency> | </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> | <dependency> | ||||
<groupId>junit</groupId> | <groupId>junit</groupId> | ||||
<artifactId>junit</artifactId> | <artifactId>junit</artifactId> |
<unpack>true</unpack> | <unpack>true</unpack> | ||||
<unpackOptions> | <unpackOptions> | ||||
<includes> | <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/*.class</include> | ||||
<include>org/apache/commons/io/filefilter/*.class</include> | <include>org/apache/commons/io/filefilter/*.class</include> | ||||
<include>org/apache/commons/io/output/*.class</include> | <include>org/apache/commons/io/output/*.class</include> |
<fileset dir="${basedir}/.." id="dist.bin.lib"> | <fileset dir="${basedir}/.." id="dist.bin.lib"> | ||||
<patternset id="dist.lib"> | <patternset id="dist.lib"> | ||||
<include name="fop/lib/README*"/> | <include name="fop/lib/README*"/> | ||||
<include name="fop/lib/avalon-framework*"/> | |||||
<include name="fop/lib/batik*"/> | <include name="fop/lib/batik*"/> | ||||
<include name="fop/lib/commons-io*"/> | <include name="fop/lib/commons-io*"/> | ||||
<include name="fop/lib/commons-logging*"/> | <include name="fop/lib/commons-logging*"/> | ||||
<echo message="Creating the WAR file"/> | <echo message="Creating the WAR file"/> | ||||
<war warfile="${build.dir}/fop.war" webxml="${servlet.src.dir}/main/webapp/WEB-INF/web.xml"> | <war warfile="${build.dir}/fop.war" webxml="${servlet.src.dir}/main/webapp/WEB-INF/web.xml"> | ||||
<lib dir="${lib.dir}"> | <lib dir="${lib.dir}"> | ||||
<include name="avalon-framework*.jar"/> | |||||
<include name="commons-logging*.jar"/> | <include name="commons-logging*.jar"/> | ||||
<include name="batik*.jar"/> | <include name="batik*.jar"/> | ||||
<include name="commons-io*.jar"/> | <include name="commons-io*.jar"/> | ||||
<include name="org/apache/fop/util/DecimalFormatCache*.class"/> | <include name="org/apache/fop/util/DecimalFormatCache*.class"/> | ||||
<include name="org/apache/fop/util/ImageObject.class"/> | <include name="org/apache/fop/util/ImageObject.class"/> | ||||
<include name="org/apache/fop/util/HexEncoder.class"/> | <include name="org/apache/fop/util/HexEncoder.class"/> | ||||
<include name="org/apache/fop/configuration/**"/> | |||||
</patternset> | </patternset> | ||||
<!-- PDF transcoder --> | <!-- PDF transcoder --> | ||||
<patternset> | <patternset> | ||||
</fileset> | </fileset> | ||||
<fileset dir="${lib.dir}" id="transcoder-lib-files"> | <fileset dir="${lib.dir}" id="transcoder-lib-files"> | ||||
<include name="commons-io*.jar"/> | <include name="commons-io*.jar"/> | ||||
<include name="avalon-framework*.jar"/> | |||||
<include name="commons-logging*.jar"/> | <include name="commons-logging*.jar"/> | ||||
<include name="xmlgraphics-commons*.jar"/> | <include name="xmlgraphics-commons*.jar"/> | ||||
</fileset> | </fileset> | ||||
<mkdir dir="${transcoder-deps}"/> | <mkdir dir="${transcoder-deps}"/> | ||||
<unjar dest="${transcoder-deps}"> | <unjar dest="${transcoder-deps}"> | ||||
<patternset> | <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/logging/**"/> | ||||
<include name="org/apache/commons/io/*.class"/> | <include name="org/apache/commons/io/*.class"/> | ||||
<include name="org/apache/commons/io/filefilter/*.class"/> | <include name="org/apache/commons/io/filefilter/*.class"/> | ||||
<mkdir dir="${transcoder-deps}/legal"/> | <mkdir dir="${transcoder-deps}/legal"/> | ||||
<copy todir="${transcoder-deps}/legal"> | <copy todir="${transcoder-deps}/legal"> | ||||
<fileset dir="${lib.dir}"> | <fileset dir="${lib.dir}"> | ||||
<include name="avalon.LICENSE.txt"/> | |||||
<include name="commons-io.LICENSE.txt"/> | <include name="commons-io.LICENSE.txt"/> | ||||
<include name="commons-logging.LICENSE.txt"/> | <include name="commons-logging.LICENSE.txt"/> | ||||
</fileset> | </fileset> |
<!-- stuff --> | <!-- stuff --> | ||||
<path id="project.class.path"> | <path id="project.class.path"> | ||||
<fileset dir="${fop.lib.dir}"> | <fileset dir="${fop.lib.dir}"> | ||||
<include name="avalon-framework*.jar"/> | |||||
<include name="batik*.jar"/> | <include name="batik*.jar"/> | ||||
<include name="xml-apis*.jar"/> | <include name="xml-apis*.jar"/> | ||||
<include name="xerces*.jar"/> | <include name="xerces*.jar"/> |
import javax.xml.transform.sax.SAXResult; | import javax.xml.transform.sax.SAXResult; | ||||
import javax.xml.transform.stream.StreamSource; | import javax.xml.transform.stream.StreamSource; | ||||
import org.apache.avalon.framework.ExceptionUtil; | |||||
import org.apache.fop.apps.FOPException; | import org.apache.fop.apps.FOPException; | ||||
import org.apache.fop.apps.Fop; | import org.apache.fop.apps.Fop; | ||||
import org.apache.fop.apps.FopFactory; | import org.apache.fop.apps.FopFactory; | ||||
System.out.println("Success!"); | System.out.println("Success!"); | ||||
} catch (Exception e) { | } catch (Exception e) { | ||||
System.err.println(ExceptionUtil.printStackTrace(e)); | |||||
// System.err.println(ExceptionUtil.printStackTrace(e)); | |||||
System.exit(-1); | System.exit(-1); | ||||
} | } | ||||
} | } |
package embedding; | package embedding; | ||||
import java.awt.Font; | import java.awt.Font; | ||||
import java.io.File; | |||||
import java.io.FileOutputStream; | import java.io.FileOutputStream; | ||||
import java.io.OutputStream; | 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.GraphicContext; | ||||
import org.apache.xmlgraphics.java2d.ps.EPSDocumentGraphics2D; | import org.apache.xmlgraphics.java2d.ps.EPSDocumentGraphics2D; | ||||
try { | try { | ||||
String configFile = "examples/fop-eps.xconf"; | String configFile = "examples/fop-eps.xconf"; | ||||
DefaultConfigurationBuilder cfgBuilder = new DefaultConfigurationBuilder(); | DefaultConfigurationBuilder cfgBuilder = new DefaultConfigurationBuilder(); | ||||
Configuration c = cfgBuilder.buildFromFile(configFile); | |||||
Configuration c = cfgBuilder.buildFromFile(new File(configFile)); | |||||
FontInfo fontInfo = PDFDocumentGraphics2DConfigurator.createFontInfo(c, false); | FontInfo fontInfo = PDFDocumentGraphics2DConfigurator.createFontInfo(c, false); | ||||
import javax.swing.JEditorPane; | 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.commons.io.IOUtils; | ||||
import org.apache.xmlgraphics.util.UnitConv; | 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.PDFDocumentGraphics2D; | ||||
import org.apache.fop.svg.PDFDocumentGraphics2DConfigurator; | import org.apache.fop.svg.PDFDocumentGraphics2DConfigurator; | ||||
Apache License v2.0 | 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 | - Apache XML Graphics Commons | ||||
xmlgraphics-commons-*.jar | xmlgraphics-commons-*.jar |
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. |
========================================================================= | |||||
== 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. |
<properties> | <properties> | ||||
<antrun.plugin.version>1.8</antrun.plugin.version> | <antrun.plugin.version>1.8</antrun.plugin.version> | ||||
<avalon.version>4.3.1</avalon.version> | |||||
<batik.version>1.11.0-SNAPSHOT</batik.version> | <batik.version>1.11.0-SNAPSHOT</batik.version> | ||||
<build.helper.plugin.version>1.9.1</build.helper.plugin.version> | <build.helper.plugin.version>1.9.1</build.helper.plugin.version> | ||||
<checkstyle.plugin.version>2.14</checkstyle.plugin.version> | <checkstyle.plugin.version>2.14</checkstyle.plugin.version> |