public class JFOConfig
extends java.lang.Object
JFOConfig.instance()
returns the singleton. If the
instance()
methode is called the first time, the configuration is
loaded from an XML file (jfo-config.xml). The XML file is loaded
automatically if it's placed in a directory or a JAR of the classpath.
One may also set a location (URL or file-path) of the configuration file
using system property de.vc.JFOConfigURL
. Also
one can load the configuration manually by calling static method
JFOConfig.loadFrom(URL url)
.instance()
,
loadFrom(java.net.URL)
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
LOGGER_NAME |
static int |
MEMORY_SPEED_RATIO_BALANCED
Memory-Speed ratio where speed and memory usage are balanced.
|
static int |
MEMORY_SPEED_RATIO_MEMORY
Memory-Speed ration for saving memory.
|
static int |
MEMORY_SPEED_RATIO_SPEED
Memory-Speed ratio for full speed.
|
static java.lang.String |
SYSTEM_PROPERTY_URL
System property key that points to JFO's configuration file.
|
Modifier and Type | Method and Description |
---|---|
void |
addImageTranscoder(ImageTranscoder transcoder)
Adds an image transcoder.
|
de.vc.config.Configuration |
buildConfiguration()
Builds an Avalon-Configuration object from this configuration.
|
boolean |
checkUrlDataScheme()
Checks whether the url data scheme is supported by JRE.
|
java.io.File |
getConfigDirectory()
Returns the directory of jfo-config.xml if possible.
|
FontMapper |
getDefaultFontMapper()
Gets the default font mapper from the list of font-mappers.
|
RendererFactory |
getDefaultRendererFactory()
Returns the default factory for creating renderers.
|
FontMapper |
getFontMapperByID(java.lang.String mapperID)
Gets a font-mapper by it's ID.
|
FontMapper |
getFontMapperFor(RTF2FOCompatibilityMode cm) |
FontMapper |
getFontMapperFor(java.lang.String cm,
boolean bestMatching) |
ImageTranscoder |
getImageTranscoderForFile(java.lang.String imageFile)
Gets an image transcoder for a given image if there is any
transcoder that is able to convert the image.
|
java.net.URL |
getLicenseKeyFile()
Gets the URL of the license key.
|
org.apache.commons.logging.Log |
getLogger() |
org.apache.commons.logging.Log |
getLoggerForComponent(java.lang.Class<?> componentClazz) |
org.apache.commons.logging.Log |
getLoggerForComponent(java.lang.String componentName) |
java.lang.String |
getLoggerPriority() |
int |
getMemorySpeedRation()
Gets the memory-speed ratio.
|
RTF2FOConfig |
getRTF2FOConfig()
Gets the default configuration that is used for RTF import.
|
Templates |
getTemplates()
Gets the templates of JFO.
|
java.net.URL |
getUrl()
Gets the URL of this configuration if it was loaded.
|
java.lang.String |
getXmlEncoding() |
ImageTranscoder |
imageTranscoder(ImageMetaData id)
Gets an image transcoder for a given image format.
|
static JFOConfig |
instance()
Default instance of configuration.
|
boolean |
isFormatXMLOutput()
Returns true if any XML output (e.g. if a document is written) is
formatted.
|
FontMapper[] |
listFontMappers() |
java.util.List<ImageTranscoder> |
listImageTranscoders()
Returns an unmodifieable list of all registered image transcoders.
|
static boolean |
loadFrom(java.net.URL url)
Loads the configuration from a stream.
|
void |
registerFontMapper(FontMapper fm)
Registers a new font-mapper.
|
boolean |
removeImageTranscoder(ImageTranscoder transcoder)
Removes an image transcode.
|
void |
saveTo(java.io.File file)
Stores this configuration as XML into an file.
|
void |
setDefaultFontMapper(FontMapper fontMapper)
Sets the default font mapper.
|
void |
setFontMapper(FontMapper fm)
Removes all registered font-mappers and sets the give
font-mapper as default mapper.
|
void |
setFormatXMLOutput(boolean format)
Sets whether JFO shall format XML output.
|
void |
setLicenseKeyFile(java.net.URL licenseKeyFile)
Sets the license key file.
|
void |
setLogger(org.apache.commons.logging.Log logger)
Sets the Logger used by JFO.
|
void |
setLoggerPriority(java.lang.String loggerPriority)
Sets a new log priority, but only if SimpleLog of JCL is used.
|
void |
setMemorySpeedRation(int ratio)
Sets the memory-speed ratio.
|
void |
setXmlEncoding(java.lang.String xmlEncoding) |
void |
unregisterAllFontMappers() |
void |
unregisterFontMapper(FontMapper fm) |
public static final java.lang.String LOGGER_NAME
public static final int MEMORY_SPEED_RATIO_BALANCED
public static final int MEMORY_SPEED_RATIO_MEMORY
public static final int MEMORY_SPEED_RATIO_SPEED
public static final java.lang.String SYSTEM_PROPERTY_URL
de.vc.JFOConfigURL
.public void addImageTranscoder(ImageTranscoder transcoder)
transcoder
- ImageTranscoder.public de.vc.config.Configuration buildConfiguration()
public boolean checkUrlDataScheme()
de.vc.net.ExtendableURLStreamHandlerFactory
at
java.net.URL
true
if data scheme is supported or was successfully installed.URL.setURLStreamHandlerFactory(java.net.URLStreamHandlerFactory)
public ImageTranscoder imageTranscoder(ImageMetaData id)
id
- Meta data of picturepublic static JFOConfig instance()
public FontMapper[] listFontMappers()
public java.util.List<ImageTranscoder> listImageTranscoders()
de.vc.jfo.tools.ImageTranscode
.public static boolean loadFrom(java.net.URL url)
url
- URL of configuration.true
if configuration was successfully loaded.public void registerFontMapper(FontMapper fm)
fm
- Font mapper.public boolean removeImageTranscoder(ImageTranscoder transcoder)
transcoder
- ImageTranscoder.true
if transcoder
was registered.public void saveTo(java.io.File file) throws java.lang.Exception
file
- File.java.lang.Exception
public void unregisterAllFontMappers()
public void unregisterFontMapper(FontMapper fm)
public java.io.File getConfigDirectory()
public FontMapper getDefaultFontMapper()
getFontMapperFor(RTF2FOCompatibilityMode)
,
listFontMappers()
public RendererFactory getDefaultRendererFactory()
public FontMapper getFontMapperByID(java.lang.String mapperID)
mapperID
- ID of Mapper (attribute id in node font-mapping).public FontMapper getFontMapperFor(RTF2FOCompatibilityMode cm)
public FontMapper getFontMapperFor(java.lang.String cm, boolean bestMatching)
public ImageTranscoder getImageTranscoderForFile(java.lang.String imageFile)
imageFile
- Image file.public java.net.URL getLicenseKeyFile()
public org.apache.commons.logging.Log getLogger()
public org.apache.commons.logging.Log getLoggerForComponent(java.lang.Class<?> componentClazz)
public org.apache.commons.logging.Log getLoggerForComponent(java.lang.String componentName)
public java.lang.String getLoggerPriority()
public int getMemorySpeedRation()
public RTF2FOConfig getRTF2FOConfig()
public Templates getTemplates()
public java.net.URL getUrl()
de.vc.JFOConfigURL
.public java.lang.String getXmlEncoding()
public boolean isFormatXMLOutput()
public void setDefaultFontMapper(FontMapper fontMapper)
fontMapper
- Default font mapper.registerFontMapper(FontMapper)
,
unregisterFontMapper(FontMapper)
public void setFontMapper(FontMapper fm)
fm
- public void setFormatXMLOutput(boolean format)
format
- true to enable formatting.public void setLicenseKeyFile(java.net.URL licenseKeyFile)
licenseKeyFile
- License key file.public void setLogger(org.apache.commons.logging.Log logger)
logger
- Logger.public void setLoggerPriority(java.lang.String loggerPriority)
de.vc.jfo
. Example for JDK 1.4:
java.util.logging.Logger.getLogger("de.vc.jfo").setLevel(Level.WARNING);
loggerPriority
- Stringpublic void setMemorySpeedRation(int ratio)
MEMORY_SPEED_RATIO_SPEED
Fast API and RTF conversion, needs more memoryMEMORY_SPEED_RATIO_MEMORY
API needs less memory, but is a slowerMEMORY_SPEED_RATIO_BALANCED
Compromise between speed and memory usageratio
- New ratio.public void setXmlEncoding(java.lang.String xmlEncoding)
© 2003-2011 by Sascha Schmidt (vision-cloud.de). All Rights Reserved.