You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@velocity.apache.org by nb...@apache.org on 2008/09/17 22:19:53 UTC
svn commit: r696431 - in
/velocity/tools/trunk/src/main/java/org/apache/velocity/tools/config:
FileFactoryConfiguration.java PropertiesFactoryConfiguration.java
XmlFactoryConfiguration.java
Author: nbubna
Date: Wed Sep 17 13:19:52 2008
New Revision: 696431
URL: http://svn.apache.org/viewvc?rev=696431&view=rev
Log:
make FileFactoryConfiguration c'tors that take a 'source' less confusing
Modified:
velocity/tools/trunk/src/main/java/org/apache/velocity/tools/config/FileFactoryConfiguration.java
velocity/tools/trunk/src/main/java/org/apache/velocity/tools/config/PropertiesFactoryConfiguration.java
velocity/tools/trunk/src/main/java/org/apache/velocity/tools/config/XmlFactoryConfiguration.java
Modified: velocity/tools/trunk/src/main/java/org/apache/velocity/tools/config/FileFactoryConfiguration.java
URL: http://svn.apache.org/viewvc/velocity/tools/trunk/src/main/java/org/apache/velocity/tools/config/FileFactoryConfiguration.java?rev=696431&r1=696430&r2=696431&view=diff
==============================================================================
--- velocity/tools/trunk/src/main/java/org/apache/velocity/tools/config/FileFactoryConfiguration.java (original)
+++ velocity/tools/trunk/src/main/java/org/apache/velocity/tools/config/FileFactoryConfiguration.java Wed Sep 17 13:19:52 2008
@@ -35,9 +35,9 @@
*/
public abstract class FileFactoryConfiguration extends FactoryConfiguration
{
- protected FileFactoryConfiguration(Class clazz, String source)
+ protected FileFactoryConfiguration(Class clazz, String id)
{
- super(clazz, source);
+ super(clazz, id);
}
/**
Modified: velocity/tools/trunk/src/main/java/org/apache/velocity/tools/config/PropertiesFactoryConfiguration.java
URL: http://svn.apache.org/viewvc/velocity/tools/trunk/src/main/java/org/apache/velocity/tools/config/PropertiesFactoryConfiguration.java?rev=696431&r1=696430&r2=696431&view=diff
==============================================================================
--- velocity/tools/trunk/src/main/java/org/apache/velocity/tools/config/PropertiesFactoryConfiguration.java (original)
+++ velocity/tools/trunk/src/main/java/org/apache/velocity/tools/config/PropertiesFactoryConfiguration.java Wed Sep 17 13:19:52 2008
@@ -28,8 +28,14 @@
/**
* <p> This reads in configuration info formatted as a property
* file using {@link ExtendedProperties} from Commons-Collections.</p>
+ * <p>Example usage:
+ * <pre>
+ * FactoryConfiguration cfg = new PropertiesFactoryConfiguration();
+ * cfg.read("my.properties");
+ * ToolboxFactory factory = cfg.createFactory();
+ * </pre></p>
* <p>This reads in a configuration such as:
- * <code>
+ * <pre>
* tools.toolbox = request,application
* tools.property.locale = en_us
* tools.property.locale.class = java.util.Locale
@@ -47,7 +53,7 @@
* tools.data.version.type = number
* tools.data.debug = false
* tools.data.debug.type = boolean
- * </code>
+ * </pre>
* <strong>NOTE</strong>: "property", "data", and "toolbox" are
* reserved words do not use them as tool keys or toolbox scopes.</p>
*
@@ -61,9 +67,16 @@
this("");
}
- public PropertiesFactoryConfiguration(String source)
+ /**
+ * Creates an instance using the specified string
+ * as an identifier to distinguish this instance when debugging.
+ *
+ * @param id the name of the "source" of this instance
+ * @see FactoryConfiguration#setSource(String)
+ */
+ public PropertiesFactoryConfiguration(String id)
{
- super(PropertiesFactoryConfiguration.class, source);
+ super(PropertiesFactoryConfiguration.class, id);
}
/**
Modified: velocity/tools/trunk/src/main/java/org/apache/velocity/tools/config/XmlFactoryConfiguration.java
URL: http://svn.apache.org/viewvc/velocity/tools/trunk/src/main/java/org/apache/velocity/tools/config/XmlFactoryConfiguration.java?rev=696431&r1=696430&r2=696431&view=diff
==============================================================================
--- velocity/tools/trunk/src/main/java/org/apache/velocity/tools/config/XmlFactoryConfiguration.java (original)
+++ velocity/tools/trunk/src/main/java/org/apache/velocity/tools/config/XmlFactoryConfiguration.java Wed Sep 17 13:19:52 2008
@@ -33,6 +33,12 @@
* passing a new {@link RuleSet} to the {@link #setRuleSet} method.
* See the configuration documentation on the main web site for
* instructions on the XML format supported by the default rules.</p>
+ * <p>Example usage:
+ * <pre>
+ * FactoryConfiguration cfg = new XmlFactoryConfiguration("Dev Tools");
+ * cfg.read("devtools.xml");
+ * ToolboxFactory factory = cfg.createFactory();
+ * </pre></p>
*
* @author Nathan Bubna
* @version $Id: XmlFactoryConfiguration.java 511959 2007-02-26 19:24:39Z nbubna $
@@ -52,14 +58,31 @@
this(supportOldConfig, String.valueOf(supportOldConfig));
}
- public XmlFactoryConfiguration(String source)
+ /**
+ * Creates an instance using the specified string
+ * as an identifier to distinguish this instance when debugging.
+ *
+ * @param id the name of the "source" of this instance
+ * @see FactoryConfiguration#setSource(String)
+ */
+ public XmlFactoryConfiguration(String id)
{
- this(false, source);
+ this(false, id);
}
- public XmlFactoryConfiguration(boolean supportOldConfig, String source)
+ /**
+ * Creates an instance using the specified string
+ * as an identifier to distinguish this instance when debugging
+ * and using the specified setting for supporting the old toolbox.xml
+ * format from VelocityTools 1.x.
+ *
+ * @param supportOldConfig whether the old toolbox.xml format should be supported
+ * @param name the name of the "source" of this instance
+ * @see FactoryConfiguration#setSource(String)
+ */
+ public XmlFactoryConfiguration(boolean supportOldConfig, String id)
{
- super(XmlFactoryConfiguration.class, source);
+ super(XmlFactoryConfiguration.class, id);
setRuleSet(new XmlFactoryConfigurationRuleSet());
this.supportOldXml = supportOldConfig;
}