类 ConfigurationUtils
java.lang.Object
org.apache.velocity.tools.config.ConfigurationUtils
Utility methods for handling tool configurations.
- 版本:
- $Id: ConfigurationUtils.java 511959 2007-02-26 19:24:39Z nbubna $
- 作者:
- Nathan Bubna
-
字段概要
字段 -
方法概要
修饰符和类型方法说明static voidclean(Configuration config) Convenience method that automatically creates a newConfigurationCleanerand applies it to the specifiedConfiguration.static ToolboxFactoryReturns a new, standardToolboxFactoryconfigured with the results offindFromSystemProperty().static FactoryConfigurationSearches for a configuration file at the specified path and returns it in the form of aFactoryConfiguration.static FactoryConfigurationReturns aFactoryConfigurationloaded from the path specified in the "org.apache.velocity.tools" system property (if any).static FactoryConfigurationfindInClasspath(String path) static FactoryConfigurationfindInClasspath(String path, Object caller) Searches the classpath for a configuration file matching the specified path.static FactoryConfigurationfindInFileSystem(String path) Searches the file system for a configuration file matching the specified path.static FactoryConfigurationReturns the "default"FactoryConfiguration.static FactoryConfigurationgetFromClass(Class factory) static FactoryConfigurationgetFromClass(String classname) Get a specificFactoryConfigurationclassstatic FactoryConfigurationReturns aFactoryConfigurationincluding all default "GenericTools" available and no others.static org.slf4j.Loggerstatic FactoryConfigurationReturns aFactoryConfigurationincluding all default "velocity-tools-view" tools available as well as the default "GenericTools".static FactoryConfigurationReturns aFactoryConfigurationloaded from a configuration file at the specified path.static FactoryConfigurationReturns aFactoryConfigurationread from a known configuration file type at the specifiedURL.
-
字段详细资料
-
方法详细资料
-
getInstance
-
getDefaultTools
Returns the "default"FactoryConfiguration. This includes all the standard tools developed by this project and available in the jar being used. In other words, if the velocity-tools-generic-2.x.jar is being used, then only the generic tools will be included. If the velocity-tools-struts-2.x.jar is being used, then all VelocityTools will be available. This also means that subclasses in the larger jars will override their superclasses. So, if you are using the VelocityStruts jar, then your $link reference will be a StrutsLinkTool. If you are using the VelocityView jar, it will be a standard LinkTool.- 返回:
- the default
FactoryConfiguration
-
getGenericTools
Returns aFactoryConfigurationincluding all default "GenericTools" available and no others.- 返回:
- the generic tools default
FactoryConfiguration
-
getVelocityView
Returns a
FactoryConfigurationincluding all default "velocity-tools-view" tools available as well as the default "GenericTools".- 返回:
- all default tools
FactoryConfiguration - 抛出:
ConfigurationException- if a tools.xml is not found at theVIEW_DEFAULTS_PATH.
-
findFromSystemProperty
Returns aFactoryConfigurationloaded from the path specified in the "org.apache.velocity.tools" system property (if any). If no such property has been setnullwill be returned.- 返回:
- system property defined
FactoryConfiguration - 抛出:
org.apache.velocity.exception.ResourceNotFoundException- if the system property has a value but no configuration file was found at the specified location
-
createFactory
Returns a new, standardToolboxFactoryconfigured with the results offindFromSystemProperty().- 返回:
- new
ToolboxFactory
-
clean
Convenience method that automatically creates a newConfigurationCleanerand applies it to the specifiedConfiguration.- 参数:
config-Configuration
-
load
Returns aFactoryConfigurationloaded from a configuration file at the specified path. If no such file is found at that path, this will throw aResourceNotFoundException.- 参数:
path- configuration path- 返回:
- new
FactoryConfiguration - 另请参阅:
-
find
Searches for a configuration file at the specified path and returns it in the form of aFactoryConfiguration. This method will look for a matching file in both the classpath and the file system. If perchance a match is found in both, then both are loaded and the configuration loaded from the file system is given precedence (i.e. it is added onto the other). If no match is found in either, then this will returnnull.- 参数:
path- configuration classpath or filesystem path- 返回:
- new
FactoryConfigurationfor the given path
-
findInFileSystem
Searches the file system for a configuration file matching the specified path. If found, it will read and return it as aFactoryConfiguration. If not found, this will returnnull.- 参数:
path- filesystem path- 返回:
- new
FactoryConfigurationfor the given path - 抛出:
IllegalStateException- if the file exists, but its path could not be converted to a URL for reading.
-
findInClasspath
- 参数:
path- configuration classpath- 返回:
- new
FactoryConfigurationfor the given classpath - 另请参阅:
-
findInClasspath
Searches the classpath for a configuration file matching the specified path. If found, it will read and return it as aFactoryConfiguration. If not found, this will returnnull. If there are multiple matching resources in the classpath, then they will be added together in the order found (i.e. the last one will have precedence).- 参数:
path- configuration classpathcaller- classloader context- 返回:
- new
FactoryConfigurationfor the given classpath - 另请参阅:
-
read
Returns aFactoryConfigurationread from a known configuration file type at the specifiedURL. If the file is missing or unreadable, this will simply returnnull(i.e. if an IOException is thrown).- 参数:
url- configuration URL- 返回:
- new
FactoryConfigurationfor the given URL - 抛出:
UnsupportedOperationException- if the file type (identified via suffix) is neither ".xml" or ".properties"
-
getFromClass
Get a specificFactoryConfigurationclass- 参数:
classname- FacotyConfiguration class- 返回:
- new FactoryConfiguration instance
-
getFromClass
-
getLog
public static org.slf4j.Logger getLog(org.apache.velocity.app.VelocityEngine engine, String childNamespace)
-