public class PropertiesFactoryConfiguration extends FileFactoryConfiguration
This reads in configuration info formatted as a property
file using ExtendedProperties
from Commons-Collections.
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 = booleanNOTE: "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.commons.collections.ExtendedProperties factory) |
void |
read(InputStream input)
Reads an properties file from an
InputStream
and uses it to configure this FactoryConfiguration . |
protected void |
readData(org.apache.commons.collections.ExtendedProperties dataset) |
protected void |
readProperties(org.apache.commons.collections.ExtendedProperties configProps,
Configuration config) |
protected void |
readToolboxes(org.apache.commons.collections.ExtendedProperties factory) |
protected void |
readTools(org.apache.commons.collections.ExtendedProperties tools,
ToolboxConfiguration toolbox) |
protected void |
setProperties(org.apache.commons.collections.ExtendedProperties props,
Data data) |
findURL, read, read, read, read, read, read, read
addConfiguration, addData, addSource, addToolbox, createFactory, equals, getData, getData, getData, getSource, getSources, getToolbox, getToolboxes, hasData, hashCode, removeData, removeToolbox, setData, setSource, setToolboxes, toString, toString, validate
addChild, addConfiguration, appendChildren, getChild, getChildren, hasChildren, removeChild, setChildren
addConfiguration, addProperty, appendProperties, compareTo, getProperties, getProperty, getPropertyMap, hasProperties, removeProperty, removeProperty, setProperties, setProperty, setPropertyMap
public PropertiesFactoryConfiguration()
public PropertiesFactoryConfiguration(String id)
id
- the name of the "source" of this instanceFactoryConfiguration.setSource(String)
public void read(InputStream input) throws IOException
Reads an properties file from an InputStream
and uses it to configure this FactoryConfiguration
.
read
in class FileFactoryConfiguration
input
- the InputStream to read fromIOException
public void read(org.apache.commons.collections.ExtendedProperties factory)
protected void readProperties(org.apache.commons.collections.ExtendedProperties configProps, Configuration config)
protected void readToolboxes(org.apache.commons.collections.ExtendedProperties factory)
protected void readTools(org.apache.commons.collections.ExtendedProperties tools, ToolboxConfiguration toolbox)
protected void readData(org.apache.commons.collections.ExtendedProperties dataset)
protected void setProperties(org.apache.commons.collections.ExtendedProperties props, Data data)
Copyright © 2002–2014 Apache Software Foundation. All rights reserved.