public class PropertiesFactoryConfiguration extends FileFactoryConfiguration
This reads in configuration info formatted as a property
file using ExtProperties.
Example usage:
FactoryConfiguration cfg = new PropertiesFactoryConfiguration();
cfg.read("my.properties");
ToolboxFactory factory = cfg.createFactory();
This reads in a configuration such as:
tools.toolbox = request,application tools.property.locale = en_us tools.property.locale.class = java.util.Locale tools.property.locale.converter = org.apache.velocity.tools.config.LocaleConverter tools.request.property.xhtml = true tools.request.render = org.apache.velocity.tools.view.ViewRenderTool tools.request.render.parseDepth = 5 tools.request.search = com.foo.tools.MySearchTool tools.request.search.itemsPerPage = 10 tools.application.math = org.apache.velocity.tools.generic.MathTool tools.data.foo = bar tools.data.foo.class = java.lang.String tools.data.foo.converter = org.apache.commons.beanutils.converter.StringConverter tools.data.version = 1.0 tools.data.version.type = number tools.data.debug = false tools.data.debug.type = boolean
NOTE: "property", "data", and "toolbox" are reserved words do not use them as tool keys or toolbox scopes.
| Constructor and Description |
|---|
PropertiesFactoryConfiguration() |
PropertiesFactoryConfiguration(String id)
Creates an instance using the specified string
as an identifier to distinguish this instance when debugging.
|
| Modifier and Type | Method and Description |
|---|---|
void |
read(org.apache.velocity.util.ExtProperties factory) |
protected void |
readData(org.apache.velocity.util.ExtProperties dataset) |
protected void |
readImpl(URL url)
Reads an properties file from an
InputStream
and uses it to configure this FactoryConfiguration. |
protected void |
readProperties(org.apache.velocity.util.ExtProperties configProps,
Configuration config) |
protected void |
readToolboxes(org.apache.velocity.util.ExtProperties factory) |
protected void |
readTools(org.apache.velocity.util.ExtProperties tools,
ToolboxConfiguration toolbox) |
protected void |
setProperties(org.apache.velocity.util.ExtProperties props,
Data data) |
findURL, read, read, read, read, read, readaddConfiguration, addData, addSource, addToolbox, createFactory, equals, getData, getData, getData, getSource, getSources, getToolbox, getToolboxes, hasData, hashCode, removeData, removeToolbox, setData, setSource, setToolboxes, toString, toString, validateaddChild, addConfiguration, appendChildren, getChild, getChildren, hasChildren, removeChild, setChildrenaddConfiguration, addProperty, appendProperties, compareTo, getProperties, getProperty, getPropertyMap, hasProperties, removeProperty, removeProperty, setProperties, setProperty, setPropertyMappublic PropertiesFactoryConfiguration()
public PropertiesFactoryConfiguration(String id)
id - the name of the "source" of this instanceFactoryConfiguration.setSource(String)protected void readImpl(URL url) throws IOException
Reads an properties file from an InputStream
and uses it to configure this FactoryConfiguration.
readImpl in class FileFactoryConfigurationurl - the URL to read fromIOException - if a problem occurspublic void read(org.apache.velocity.util.ExtProperties factory)
protected void readProperties(org.apache.velocity.util.ExtProperties configProps,
Configuration config)
protected void readToolboxes(org.apache.velocity.util.ExtProperties factory)
protected void readTools(org.apache.velocity.util.ExtProperties tools,
ToolboxConfiguration toolbox)
protected void readData(org.apache.velocity.util.ExtProperties dataset)
protected void setProperties(org.apache.velocity.util.ExtProperties props,
Data data)
Copyright © 2002–2021 The Apache Software Foundation. All rights reserved.