From commitsmendozajillian@example.org Fri Apr 11 05:35:36 2008 Return-Path: <commitsmendozajillian@example.org> Delivered-To: mendozajillian@example.org Received: (qmail 94115 invoked from network); 11 Apr 2008 05:35:36 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155) by minotaur.apache.org with SMTP; 11 Apr 2008 05:35:36 -0000 Received: (qmail 95541 invoked by uid 500); 11 Apr 2008 05:35:36 -0000 Delivered-To: mendozajillian@example.org Received: (qmail 95524 invoked by uid 500); 11 Apr 2008 05:35:36 -0000 Mailing-List: contact mendozajillian@example.org; run by ezmlm Precedence: bulk List-Help: <mailto:mendozajillian@example.org> List-Unsubscribe: <mailto:mendozajillian@example.org> List-Post: <mailto:mendozajillian@example.org> List-Id: <commits.velocity.apache.org> Reply-To: mendozajillian@example.org Delivered-To: mailing list mendozajillian@example.org Received: (qmail 95515 invoked by uid 99); 11 Apr 2008 05:35:36 -0000 Received: from nike.apache.org (HELO nike.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 10 Apr 2008 22:35:36 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [83.161.120.155] (HELO eris.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 11 Apr 2008 05:34:53 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 53DC81A9832; Thu, 10 Apr 2008 22:35:13 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r647049 - /velocity/tools/trunk/src/main/java/org/apache/velocity/tools/ToolManager.java Date: Fri, 11 Apr 2008 05:35:12 -0000 To: mendozajillian@example.org From: mendozajillian@example.org X-Mailer: svnmailer-1.0.8 Message-Id: <mendozajillian@example.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: nbubna Date: Thu Apr 10 22:35:09 2008 New Revision: 647049 URL: http://svn.apache.org/viewvc?rev=647049&view=rev Log: remove some unused constants Modified: velocity/tools/trunk/src/main/java/org/apache/velocity/tools/ToolManager.java Modified: velocity/tools/trunk/src/main/java/org/apache/velocity/tools/ToolManager.java URL: http://svn.apache.org/viewvc/velocity/tools/trunk/src/main/java/org/apache/velocity/tools/ToolManager.java?rev=647049&r1=647048&r2=647049&view=diff ============================================================================== --- velocity/tools/trunk/src/main/java/org/apache/velocity/tools/ToolManager.java (original) +++ velocity/tools/trunk/src/main/java/org/apache/velocity/tools/ToolManager.java Thu Apr 10 22:35:09 2008 @@ -37,9 +37,6 @@ */ public class ToolManager { - public static final String DEFAULT_XML_CONFIG_PATH = "tools.xml"; - public static final String DEFAULT_PROPS_CONFIG_PATH = "tools.properties"; - private VelocityEngine engine; private ToolboxFactory factory; private Toolbox application; From commitsmendozajillian@example.org Fri Apr 11 05:38:39 2008 Return-Path: <commitsmendozajillian@example.org> Delivered-To: mendozajillian@example.org Received: (qmail 95638 invoked from network); 11 Apr 2008 05:38:39 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155) by minotaur.apache.org with SMTP; 11 Apr 2008 05:38:39 -0000 Received: (qmail 96606 invoked by uid 500); 11 Apr 2008 05:38:39 -0000 Delivered-To: mendozajillian@example.org Received: (qmail 96573 invoked by uid 500); 11 Apr 2008 05:38:39 -0000 Mailing-List: contact mendozajillian@example.org; run by ezmlm Precedence: bulk List-Help: <mailto:mendozajillian@example.org> List-Unsubscribe: <mailto:mendozajillian@example.org> List-Post: <mailto:mendozajillian@example.org> List-Id: <commits.velocity.apache.org> Reply-To: mendozajillian@example.org Delivered-To: mailing list mendozajillian@example.org Received: (qmail 96563 invoked by uid 99); 11 Apr 2008 05:38:39 -0000 Received: from nike.apache.org (HELO nike.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 10 Apr 2008 22:38:39 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [83.161.120.155] (HELO eris.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 11 Apr 2008 05:37:56 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 7B0901A9832; Thu, 10 Apr 2008 22:38:15 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r647050 - in /velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view: ServletUtils.java VelocityView.java Date: Fri, 11 Apr 2008 05:38:15 -0000 To: mendozajillian@example.org From: mendozajillian@example.org X-Mailer: svnmailer-1.0.8 Message-Id: <mendozajillian@example.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: nbubna Date: Thu Apr 10 22:38:11 2008 New Revision: 647050 URL: http://svn.apache.org/viewvc?rev=647050&view=rev Log: support use of VelocityView equally in servlets or filters and make it easier to use without access to either FilterConfig or ServletConfig Modified: velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/ServletUtils.java velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/VelocityView.java Modified: velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/ServletUtils.java URL: http://svn.apache.org/viewvc/velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/ServletUtils.java?rev=647050&r1=647049&r2=647050&view=diff ============================================================================== --- velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/ServletUtils.java (original) +++ velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/ServletUtils.java Thu Apr 10 22:38:11 2008 @@ -19,6 +19,7 @@ * under the License. */ +import javax.servlet.FilterConfig; import javax.servlet.ServletConfig; import javax.servlet.ServletContext; import javax.servlet.http.HttpServletRequest; @@ -73,16 +74,36 @@ /** * Returns the shared {@link VelocityView} for the specified - * {@link ServletConfig}. If one has not yet been created, it + * {@link ServletConfig}'s context. If one has not yet been created, it * will create, store it for future access, and then return it. */ public static VelocityView getVelocityView(ServletConfig config) { + return getVelocityView(new JeeConfig(config)); + } + + + /** + * Returns the shared {@link VelocityView} for the specified + * {@link FilterConfig}'s context. If one has not yet been created, it + * will create, store it for future access, and then return it. + */ + public static VelocityView getVelocityView(FilterConfig config) + { + return getVelocityView(new JeeConfig(config)); + } + + /** + * Returns the shared {@link VelocityView} for the specified + * {@link JeeConfig}'s context. If one has not yet been created, it + * will create, store it for future access, and then return it. + */ + public static VelocityView getVelocityView(JeeConfig config) + { ServletContext application = config.getServletContext(); // check for an already initialized VelocityView to use - VelocityView view = - (VelocityView)application.getAttribute(VELOCITY_VIEW_KEY); + VelocityView view = getVelocityView(application); if (view == null) { // only create a new one if we don't already have one @@ -93,6 +114,15 @@ application.setAttribute(VELOCITY_VIEW_KEY, view); } return view; + } + + /** + * Returns the shared {@link VelocityView} for the specified + * {@link ServletContext}, if any. + */ + public static VelocityView getVelocityView(ServletContext application) + { + return (VelocityView)application.getAttribute(VELOCITY_VIEW_KEY); } Modified: velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/VelocityView.java URL: http://svn.apache.org/viewvc/velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/VelocityView.java?rev=647050&r1=647049&r2=647050&view=diff ============================================================================== --- velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/VelocityView.java (original) +++ velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/VelocityView.java Thu Apr 10 22:38:11 2008 @@ -25,6 +25,7 @@ import java.io.InputStream; import java.io.IOException; import java.io.Writer; +import javax.servlet.FilterConfig; import javax.servlet.ServletConfig; import javax.servlet.ServletContext; import javax.servlet.http.HttpServletRequest; @@ -196,10 +197,20 @@ public VelocityView(ServletConfig config) { + this(new JeeConfig(config)); + } + + public VelocityView(FilterConfig config) + { + this(new JeeConfig(config)); + } + + public VelocityView(JeeConfig config) + { this(config, DEFAULT_TOOLBOX_KEY); } - public VelocityView(ServletConfig config, String toolboxKey) + public VelocityView(JeeConfig config, String toolboxKey) { setToolboxKey(toolboxKey); @@ -209,18 +220,7 @@ public VelocityView(ServletContext context) { - this(context, DEFAULT_TOOLBOX_KEY); - } - - public VelocityView(ServletContext context, String toolboxKey) - { - setToolboxKey(toolboxKey); - - if (context == null) - { - throw new NullPointerException("ServletContext cannot be null"); - } - this.servletContext = context; + this(new JeeConfig(context), DEFAULT_TOOLBOX_KEY); } /** @@ -300,7 +300,7 @@ * * @param config servlet configuation */ - protected void init(ServletConfig config) + protected void init(JeeConfig config) { String depMode = findInitParameter(DEPRECATION_SUPPORT_MODE_KEY, config); if (depMode != null && depMode.equalsIgnoreCase("false")) @@ -320,7 +320,7 @@ /** * Initializes the Velocity runtime, first calling - * loadConfiguration(ServletConfig) to get a + * loadConfiguration(JeeConfig) to get a * org.apache.commons.collections.ExtendedProperties * of configuration information * and then calling velocityEngine.init(). Override this @@ -330,7 +330,7 @@ * * @param config servlet configuration parameters */ - protected void init(ServletConfig config, final VelocityEngine velocity) + protected void init(JeeConfig config, final VelocityEngine velocity) { if (velocity == null) { @@ -370,7 +370,7 @@ * @param config servlet configuation * @param factory the ToolboxFactory to be initialized for this VelocityView */ - protected void init(final ServletConfig config, final ToolboxFactory factory) + protected void init(final JeeConfig config, final ToolboxFactory factory) { if (factory == null) { @@ -397,7 +397,7 @@ } } - protected String findInitParameter(String key, ServletConfig config) + protected String findInitParameter(String key, JeeConfig config) { String param = config.getInitParameter(key); if (param == null) @@ -408,7 +408,7 @@ } - protected void configure(final ServletConfig config, final VelocityEngine velocity) + protected void configure(final JeeConfig config, final VelocityEngine velocity) { // first get the default properties, and bail if we don't find them velocity.setExtendedProperties(getProperties(DEFAULT_PROPERTIES_PATH, true)); @@ -475,7 +475,7 @@ * {@code org.apache.velocity.tools.cleanConfiguration} init-param to true in * either your servlet or servletContext init-params. */ - protected void configure(final ServletConfig config, final ToolboxFactory factory) + protected void configure(final JeeConfig config, final ToolboxFactory factory) { FactoryConfiguration factoryConfig = new FactoryConfiguration(); @@ -552,7 +552,7 @@ * (the deprecated default location) and tries to load it if found. */ @Deprecated - protected FactoryConfiguration getDeprecatedConfig(ServletConfig config) + protected FactoryConfiguration getDeprecatedConfig(JeeConfig config) { FactoryConfiguration toolbox = null; @@ -777,7 +777,7 @@ } - protected void setEncoding(ServletConfig config) + protected void setEncoding(JeeConfig config) { // we can get these now that velocity is initialized this.defaultContentType = @@ -869,7 +869,7 @@ } //TODO: move this string constant somewhere static - if (toolboxFactory.hasTools("session")) + if (toolboxFactory.hasTools(Scope.SESSION)) { //FIXME? does this honor createSession props set on the session Toolbox? HttpSession session = request.getSession(this.createSession); @@ -881,7 +881,7 @@ if (session.getAttribute(this.toolboxKey) == null) { Toolbox sessTools = - toolboxFactory.createToolbox("session"); + toolboxFactory.createToolbox(Scope.SESSION); session.setAttribute(this.toolboxKey, sessTools); } } From commitsmendozajillian@example.org Fri Apr 11 14:29:28 2008 Return-Path: <commitsmendozajillian@example.org> Delivered-To: mendozajillian@example.org Received: (qmail 44684 invoked from network); 11 Apr 2008 14:29:28 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155) by minotaur.apache.org with SMTP; 11 Apr 2008 14:29:28 -0000 Received: (qmail 98349 invoked by uid 500); 11 Apr 2008 14:29:28 -0000 Delivered-To: mendozajillian@example.org Received: (qmail 98318 invoked by uid 500); 11 Apr 2008 14:29:28 -0000 Mailing-List: contact mendozajillian@example.org; run by ezmlm Precedence: bulk List-Help: <mailto:mendozajillian@example.org> List-Unsubscribe: <mailto:mendozajillian@example.org> List-Post: <mailto:mendozajillian@example.org> List-Id: <commits.velocity.apache.org> Reply-To: mendozajillian@example.org Delivered-To: mailing list mendozajillian@example.org Received: (qmail 98309 invoked by uid 99); 11 Apr 2008 14:29:28 -0000 Received: from athena.apache.org (HELO athena.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 11 Apr 2008 07:29:28 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [83.161.120.155] (HELO eris.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 11 Apr 2008 14:28:54 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 9F0C71A9832; Fri, 11 Apr 2008 07:29:06 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r647179 - /velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/JeeConfig.java Date: Fri, 11 Apr 2008 14:29:05 -0000 To: mendozajillian@example.org From: mendozajillian@example.org X-Mailer: svnmailer-1.0.8 Message-Id: <mendozajillian@example.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: nbubna Date: Fri Apr 11 07:28:59 2008 New Revision: 647179 URL: http://svn.apache.org/viewvc?rev=647179&view=rev Log: oops was missing new file in revision 647050 Added: velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/JeeConfig.java (with props) Added: velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/JeeConfig.java URL: http://svn.apache.org/viewvc/velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/JeeConfig.java?rev=647179&view=auto ============================================================================== --- velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/JeeConfig.java (added) +++ velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/JeeConfig.java Fri Apr 11 07:28:59 2008 @@ -0,0 +1,131 @@ +package org.apache.velocity.tools.view; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.Enumeration; +import javax.servlet.FilterConfig; +import javax.servlet.ServletConfig; +import javax.servlet.ServletContext; + +/** + * <p>Because sometimes you don't care about the difference between a + * servlet and a filter. Why isn't there a common interface for + * {@link FilterConfig} and {@link ServletConfig} already? Sheesh.</p> + * <p>Anyway, this also adds the ability to fake everything if you + * don't have either a FilterConfig or a ServletConfig handy. Just + * subclass it and override the methods that return things you care + * about. Oh, and if you don't have any init-params at all, just use + * the constructor that just takes a {@link ServletContext} as that's + * the only really essential thing for creating a {@link VelocityView}. + * + * @version $Id: ServletUtils.java 471244 2006-11-04 18:34:38Z henning $ + */ +public class JeeConfig +{ + protected FilterConfig filter; + protected ServletConfig servlet; + protected ServletContext context; + + /** + * If your subclass uses this, you better make sure + * that {@link #getServletContext()} doesn't return null! + */ + protected JeeConfig(){} + + public JeeConfig(FilterConfig filter) + { + if (filter == null) + { + throw new NullPointerException("FilterConfig should not be null; there must be a way to get a ServletContext"); + } + this.filter = filter; + } + + public JeeConfig(ServletConfig servlet) + { + if (servlet == null) + { + throw new NullPointerException("ServletConfig should not be null; there must be a way to get a ServletContext"); + } + this.servlet = servlet; + } + + public JeeConfig(ServletContext context) + { + if (filter == null) + { + throw new NullPointerException("ServletContext must not be null"); + } + this.context = context; + } + + public String getInitParameter(String name) + { + if (filter != null) + { + return filter.getInitParameter(name); + } + if (servlet != null) + { + return servlet.getInitParameter(name); + } + return null; + } + + public Enumeration getInitParameterNames() + { + if (filter != null) + { + return filter.getInitParameterNames(); + } + if (servlet != null) + { + return servlet.getInitParameterNames(); + } + return null; + } + + public String getName() + { + if (filter != null) + { + return filter.getFilterName(); + } + if (servlet != null) + { + return servlet.getServletName(); + } + return null; + } + + public ServletContext getServletContext() + { + if (filter != null) + { + return filter.getServletContext(); + } + if (servlet != null) + { + return servlet.getServletContext(); + } + return context; + } + +} Propchange: velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/JeeConfig.java ------------------------------------------------------------------------------ svn:executable = * From commitsmendozajillian@example.org Fri Apr 11 16:07:24 2008 Return-Path: <commitsmendozajillian@example.org> Delivered-To: mendozajillian@example.org Received: (qmail 35146 invoked from network); 11 Apr 2008 16:07:24 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155) by minotaur.apache.org with SMTP; 11 Apr 2008 16:07:24 -0000 Received: (qmail 89729 invoked by uid 500); 11 Apr 2008 16:07:24 -0000 Delivered-To: mendozajillian@example.org Received: (qmail 89697 invoked by uid 500); 11 Apr 2008 16:07:24 -0000 Mailing-List: contact mendozajillian@example.org; run by ezmlm Precedence: bulk List-Help: <mailto:mendozajillian@example.org> List-Unsubscribe: <mailto:mendozajillian@example.org> List-Post: <mailto:mendozajillian@example.org> List-Id: <commits.velocity.apache.org> Reply-To: mendozajillian@example.org Delivered-To: mailing list mendozajillian@example.org Received: (qmail 89688 invoked by uid 99); 11 Apr 2008 16:07:24 -0000 Received: from athena.apache.org (HELO athena.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 11 Apr 2008 09:07:24 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [83.161.120.155] (HELO eris.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 11 Apr 2008 16:06:50 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 656181A9832; Fri, 11 Apr 2008 09:07:03 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r647205 - in /velocity/tools/trunk/src/main/java/org/apache/velocity/tools: ToolContext.java Toolbox.java Date: Fri, 11 Apr 2008 16:07:02 -0000 To: mendozajillian@example.org From: mendozajillian@example.org X-Mailer: svnmailer-1.0.8 Message-Id: <mendozajillian@example.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: nbubna Date: Fri Apr 11 09:07:00 2008 New Revision: 647205 URL: http://svn.apache.org/viewvc?rev=647205&view=rev Log: make it easier to find out what tools are available without instantiating all of them Modified: velocity/tools/trunk/src/main/java/org/apache/velocity/tools/ToolContext.java velocity/tools/trunk/src/main/java/org/apache/velocity/tools/Toolbox.java Modified: velocity/tools/trunk/src/main/java/org/apache/velocity/tools/ToolContext.java URL: http://svn.apache.org/viewvc/velocity/tools/trunk/src/main/java/org/apache/velocity/tools/ToolContext.java?rev=647205&r1=647204&r2=647205&view=diff ============================================================================== --- velocity/tools/trunk/src/main/java/org/apache/velocity/tools/ToolContext.java (original) +++ velocity/tools/trunk/src/main/java/org/apache/velocity/tools/ToolContext.java Fri Apr 11 09:07:00 2008 @@ -123,6 +123,20 @@ return aggregate; } + /** + * Gets a map of keys to classes for all available tools. + * This does not include any data nor any local context values. + */ + public Map<String,Class> getToolClassMap() + { + Map<String,Class> toolClasses = new HashMap<String,Class>(); + for (Toolbox toolbox : toolboxes) + { + toolClasses.putAll(toolbox.getToolClassMap()); + } + return toolClasses; + } + protected List<Toolbox> getToolboxes() { return this.toolboxes; @@ -171,6 +185,7 @@ } return null; } + public Set<String> keySet() { Modified: velocity/tools/trunk/src/main/java/org/apache/velocity/tools/Toolbox.java URL: http://svn.apache.org/viewvc/velocity/tools/trunk/src/main/java/org/apache/velocity/tools/Toolbox.java?rev=647205&r1=647204&r2=647205&view=diff ============================================================================== --- velocity/tools/trunk/src/main/java/org/apache/velocity/tools/Toolbox.java (original) +++ velocity/tools/trunk/src/main/java/org/apache/velocity/tools/Toolbox.java Fri Apr 11 09:07:00 2008 @@ -160,8 +160,28 @@ // add keys for all available tools Set<String> keys = new HashSet<String>(infoMap.keySet()); // be sure to add cache, which holds data keys - keys.addAll(cache.keySet()); + if (cache != null) + { + keys.addAll(cache.keySet()); + } return keys; + } + + /** + * Return a new {@link Map} link tools' keys to their {@link Class}es. + * This will not instantiate any tools, it is merely informational. + * This will not include the keys for any cached data. Note that inclusion + * in this map does NOT mean that all these tools will be available for + * all requests, as this map ignores all path restrictions on the tools. + */ + public Map<String,Class> getToolClassMap() + { + Map<String,Class> classMap = new HashMap<String,Class>(infoMap.size()); + for (Map.Entry<String,ToolInfo> entry : infoMap.entrySet()) + { + classMap.put(entry.getKey(), entry.getValue().getToolClass()); + } + return classMap; } public Map<String,Object> getAll(Map<String,Object> context) From commitsmendozajillian@example.org Thu Apr 24 15:00:02 2008 Return-Path: <commitsmendozajillian@example.org> Delivered-To: mendozajillian@example.org Received: (qmail 39055 invoked from network); 24 Apr 2008 15:00:02 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155) by minotaur.apache.org with SMTP; 24 Apr 2008 15:00:02 -0000 Received: (qmail 77792 invoked by uid 500); 24 Apr 2008 15:00:03 -0000 Delivered-To: mendozajillian@example.org Received: (qmail 77758 invoked by uid 500); 24 Apr 2008 15:00:03 -0000 Mailing-List: contact mendozajillian@example.org; run by ezmlm Precedence: bulk List-Help: <mailto:mendozajillian@example.org> List-Unsubscribe: <mailto:mendozajillian@example.org> List-Post: <mailto:mendozajillian@example.org> List-Id: <commits.velocity.apache.org> Reply-To: mendozajillian@example.org Delivered-To: mailing list mendozajillian@example.org Received: (qmail 77747 invoked by uid 99); 24 Apr 2008 15:00:03 -0000 Received: from nike.apache.org (HELO nike.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 24 Apr 2008 08:00:03 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [83.161.120.155] (HELO eris.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 24 Apr 2008 14:59:18 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 578E91A9832; Thu, 24 Apr 2008 07:59:32 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r651285 - /velocity/tools/trunk/src/main/java/org/apache/velocity/tools/generic/ResourceTool.java Date: Thu, 24 Apr 2008 14:59:31 -0000 To: mendozajillian@example.org From: mendozajillian@example.org X-Mailer: svnmailer-1.0.8 Message-Id: <mendozajillian@example.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: nbubna Date: Thu Apr 24 07:59:17 2008 New Revision: 651285 URL: http://svn.apache.org/viewvc?rev=651285&view=rev Log: VELTOOLS-104 process resources with MessageFormat even if no args were given Modified: velocity/tools/trunk/src/main/java/org/apache/velocity/tools/generic/ResourceTool.java Modified: velocity/tools/trunk/src/main/java/org/apache/velocity/tools/generic/ResourceTool.java URL: http://svn.apache.org/viewvc/velocity/tools/trunk/src/main/java/org/apache/velocity/tools/generic/ResourceTool.java?rev=651285&r1=651284&r2=651285&view=diff ============================================================================== --- velocity/tools/trunk/src/main/java/org/apache/velocity/tools/generic/ResourceTool.java (original) +++ velocity/tools/trunk/src/main/java/org/apache/velocity/tools/generic/ResourceTool.java Thu Apr 24 07:59:17 2008 @@ -208,12 +208,7 @@ */ public String render(Object resource, Object[] args) { - String value = String.valueOf(resource); - if (args == null) - { - return value; - } - return MessageFormat.format(value, args); + return MessageFormat.format(String.valueOf(resource), args); } From commitsmendozajillian@example.org Thu Apr 24 23:54:22 2008 Return-Path: <commitsmendozajillian@example.org> Delivered-To: mendozajillian@example.org Received: (qmail 1589 invoked from network); 24 Apr 2008 23:54:22 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155) by minotaur.apache.org with SMTP; 24 Apr 2008 23:54:22 -0000 Received: (qmail 54470 invoked by uid 500); 24 Apr 2008 23:54:23 -0000 Delivered-To: mendozajillian@example.org Received: (qmail 54435 invoked by uid 500); 24 Apr 2008 23:54:23 -0000 Mailing-List: contact mendozajillian@example.org; run by ezmlm Precedence: bulk List-Help: <mailto:mendozajillian@example.org> List-Unsubscribe: <mailto:mendozajillian@example.org> List-Post: <mailto:mendozajillian@example.org> List-Id: <commits.velocity.apache.org> Reply-To: mendozajillian@example.org Delivered-To: mailing list mendozajillian@example.org Received: (qmail 54424 invoked by uid 99); 24 Apr 2008 23:54:23 -0000 Received: from nike.apache.org (HELO nike.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 24 Apr 2008 16:54:23 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [83.161.120.155] (HELO eris.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 24 Apr 2008 23:53:38 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id BEDE11A9832; Thu, 24 Apr 2008 16:53:58 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r651462 - /velocity/tools/trunk/src/main/java/org/apache/velocity/tools/generic/ResourceTool.java Date: Thu, 24 Apr 2008 23:53:58 -0000 To: mendozajillian@example.org From: mendozajillian@example.org X-Mailer: svnmailer-1.0.8 Message-Id: <mendozajillian@example.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: nbubna Date: Thu Apr 24 16:53:55 2008 New Revision: 651462 URL: http://svn.apache.org/viewvc?rev=651462&view=rev Log: VELTOOLS-104 update javadoc to match fixed behavior, thanks to Rod Vagg Modified: velocity/tools/trunk/src/main/java/org/apache/velocity/tools/generic/ResourceTool.java Modified: velocity/tools/trunk/src/main/java/org/apache/velocity/tools/generic/ResourceTool.java URL: http://svn.apache.org/viewvc/velocity/tools/trunk/src/main/java/org/apache/velocity/tools/generic/ResourceTool.java?rev=651462&r1=651461&r2=651462&view=diff ============================================================================== --- velocity/tools/trunk/src/main/java/org/apache/velocity/tools/generic/ResourceTool.java (original) +++ velocity/tools/trunk/src/main/java/org/apache/velocity/tools/generic/ResourceTool.java Thu Apr 24 16:53:55 2008 @@ -200,11 +200,9 @@ } /** - * Renders the specified resource value and arguments as a String. - * If there are no arguments, then the String value of the resource - * is returned directly. If there are arguments, then the resource - * is treated as a {@link MessageFormat} pattern and used to format - * the specified argument values. + * Renders the specified resource value and arguments as a String. + * The resource is treated as a {@link MessageFormat} pattern which + * is used for formatting along with any specified argument values. */ public String render(Object resource, Object[] args) { From commitsmendozajillian@example.org Fri Apr 25 00:46:51 2008 Return-Path: <commitsmendozajillian@example.org> Delivered-To: mendozajillian@example.org Received: (qmail 31812 invoked from network); 25 Apr 2008 00:46:51 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155) by minotaur.apache.org with SMTP; 25 Apr 2008 00:46:51 -0000 Received: (qmail 93458 invoked by uid 500); 25 Apr 2008 00:46:53 -0000 Delivered-To: mendozajillian@example.org Received: (qmail 93423 invoked by uid 500); 25 Apr 2008 00:46:53 -0000 Mailing-List: contact mendozajillian@example.org; run by ezmlm Precedence: bulk List-Help: <mailto:mendozajillian@example.org> List-Unsubscribe: <mailto:mendozajillian@example.org> List-Post: <mailto:mendozajillian@example.org> List-Id: <commits.velocity.apache.org> Reply-To: mendozajillian@example.org Delivered-To: mailing list mendozajillian@example.org Received: (qmail 93412 invoked by uid 99); 25 Apr 2008 00:46:53 -0000 Received: from nike.apache.org (HELO nike.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 24 Apr 2008 17:46:53 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [83.161.120.155] (HELO eris.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 25 Apr 2008 00:46:07 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 9860B1A9832; Thu, 24 Apr 2008 17:46:21 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r651469 - in /velocity/tools/trunk/src/main/java/org/apache/velocity/tools: ./ view/ view/context/ view/servlet/ view/tools/ Date: Fri, 25 Apr 2008 00:46:18 -0000 To: mendozajillian@example.org From: mendozajillian@example.org X-Mailer: svnmailer-1.0.8 Message-Id: <mendozajillian@example.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: nbubna Date: Thu Apr 24 17:46:13 2008 New Revision: 651469 URL: http://svn.apache.org/viewvc?rev=651469&view=rev Log: add/update javadocs Modified: velocity/tools/trunk/src/main/java/org/apache/velocity/tools/OldToolInfo.java velocity/tools/trunk/src/main/java/org/apache/velocity/tools/Toolbox.java velocity/tools/trunk/src/main/java/org/apache/velocity/tools/ToolboxFactory.java velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/DataInfo.java velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/ViewContext.java velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/ViewToolContext.java velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/context/package.html velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/package.html velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/servlet/package.html velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/tools/package.html Modified: velocity/tools/trunk/src/main/java/org/apache/velocity/tools/OldToolInfo.java URL: http://svn.apache.org/viewvc/velocity/tools/trunk/src/main/java/org/apache/velocity/tools/OldToolInfo.java?rev=651469&r1=651468&r2=651469&view=diff ============================================================================== --- velocity/tools/trunk/src/main/java/org/apache/velocity/tools/OldToolInfo.java (original) +++ velocity/tools/trunk/src/main/java/org/apache/velocity/tools/OldToolInfo.java Thu Apr 24 17:46:13 2008 @@ -24,8 +24,7 @@ import org.apache.velocity.tools.ToolContext; /** - * Manages old tools which still use deprecated init() and configure() - * methods. + * Manages old tools which still use the deprecated init() method. * * @author Nathan Bubna * @version $Id: OldToolInfo.java 511959 2007-02-26 19:24:39Z nbubna $ Modified: velocity/tools/trunk/src/main/java/org/apache/velocity/tools/Toolbox.java URL: http://svn.apache.org/viewvc/velocity/tools/trunk/src/main/java/org/apache/velocity/tools/Toolbox.java?rev=651469&r1=651468&r2=651469&view=diff ============================================================================== --- velocity/tools/trunk/src/main/java/org/apache/velocity/tools/Toolbox.java (original) +++ velocity/tools/trunk/src/main/java/org/apache/velocity/tools/Toolbox.java Thu Apr 24 17:46:13 2008 @@ -26,7 +26,16 @@ import java.util.Set; /** - * + * <p>Instances of this class are typically created by a {@link ToolboxFactory} + * on a one-per-scope basis. So, for each application, there would be one + * application-scoped Toolbox from which you would retrieve tool instances, + * and for each request, there would be one request-scoped Toolbox. + * Of course, none of the above is enforced. There's no reason that you can't + * manually create a Toolbox or have multiple Toolboxes for each scope. + * </p><p> + * When a Toolbox creates a tool instance asked of it (see {@link #get}), + * it will cache that instance for future requests. + * </p> * * @author Nathan Bubna * @version $Id: Toolbox.java 511959 2007-02-26 19:24:39Z nbubna $ Modified: velocity/tools/trunk/src/main/java/org/apache/velocity/tools/ToolboxFactory.java URL: http://svn.apache.org/viewvc/velocity/tools/trunk/src/main/java/org/apache/velocity/tools/ToolboxFactory.java?rev=651469&r1=651468&r2=651469&view=diff ============================================================================== --- velocity/tools/trunk/src/main/java/org/apache/velocity/tools/ToolboxFactory.java (original) +++ velocity/tools/trunk/src/main/java/org/apache/velocity/tools/ToolboxFactory.java Thu Apr 24 17:46:13 2008 @@ -28,7 +28,32 @@ import org.apache.velocity.tools.config.ToolConfiguration; /** - * + * <p>This class is the central point of action for VelocityTools. + * It manages the configured and scoped {@link ToolInfo} and {@link Data} + * and is meant to stick around for the life of the application. + * </p><p> + * It works like this: + * <ol> + * <li>Build up your {@link FactoryConfiguration}(s)</li> + * <li>Create a {@link ToolboxFactory} instance</li> + * <li>Pass the configuration to {@link #configure}</li> + * <li>When appropriate for each scope, use {@link #createToolbox} + * to create the {@link Toolbox} for that scope and put that toolbox + * somewhere appropriate to that scope.</li> + * <li>When you want a tool, get that {@link Toolbox} and + * ask it for the tool you want (e.g. <code>toolbox.get("math")</code>).</li> + * </ol> + * </p><p> + * Of course, most users will not have to do any of this + * as much of it is handled for them by some combination of + * {@link ToolManager} or {@link org.apache.velocity.tools.view.VelocityView} + * and a {@link ToolContext} or {@link org.apache.velocity.tools.view.ViewToolContext}. + * </p><p> + * <strong>NOTE:</strong> While you are free to pass in new configuration info + * at any time, that data will only affect {@link Toolbox}es created subsequently. + * Any previously created toolboxes will have to be re-created and replaced to + * reflect the changes to the configuration. + * </p> * * @author Nathan Bubna * @version $Id: ToolboxFactory.java 511959 2007-02-26 19:24:39Z nbubna $ Modified: velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/DataInfo.java URL: http://svn.apache.org/viewvc/velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/DataInfo.java?rev=651469&r1=651468&r2=651469&view=diff ============================================================================== --- velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/DataInfo.java (original) +++ velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/DataInfo.java Thu Apr 24 17:46:13 2008 @@ -45,7 +45,7 @@ * </pre></p> * * @author Nathan Bubna - * @deprecated Use {@link org.apache.velocity.tools.ToolInfo} + * @deprecated Use {@link org.apache.velocity.tools.config.Data} * @version $Id$ */ @Deprecated Modified: velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/ViewContext.java URL: http://svn.apache.org/viewvc/velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/ViewContext.java?rev=651469&r1=651468&r2=651469&view=diff ============================================================================== --- velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/ViewContext.java (original) +++ velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/ViewContext.java Thu Apr 24 17:46:13 2008 @@ -29,6 +29,7 @@ * <p>This interface provides view tools in a servlet environment * access to relevant context information, like servlet request, servlet * context and the velocity context.</p> + * <p>The standard implementation is {@link ViewToolContext}.</p> * * @author <a href="mailto:mendozajillian@example.org">Gabe Sidler</a> * @author <a href="mailto:mendozajillian@example.org">Geir Magnusson Jr.</a> Modified: velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/ViewToolContext.java URL: http://svn.apache.org/viewvc/velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/ViewToolContext.java?rev=651469&r1=651468&r2=651469&view=diff ============================================================================== --- velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/ViewToolContext.java (original) +++ velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/ViewToolContext.java Thu Apr 24 17:46:13 2008 @@ -32,7 +32,7 @@ import org.apache.velocity.tools.Toolbox; /** - * <p>Velocity context implementation specific to the Servlet environment.</p> + * <p>{@link ToolContext} implementation specific to the servlet environment.</p> * * <p>It provides the following special features:</p> * <ul> @@ -44,14 +44,15 @@ * servlet context attribues for objects</li> * </ul> * - * <p>The {@link #internalGet(String key)} method implements the following search order + * <p>The {@link #get(String key)} method implements the following search order * for objects:</p> * <ol> - * <li>toolbox</li> - * <li>servlet request, servlet response, servlet session, servlet context</li> - * <li>local hashtable of objects (traditional use)</li> - * <li>servlet request attribues, servlet session attribute, servlet context - * attributes</li> + * <li>tool in a request scoped toolbox</li> + * <li>tool in a session scoped toolbox</li> + * <li>tool in a application scoped toolbox</li> + * <li>request, response, session, or servlet context</li> + * <li>object in the local map of objects (traditional use)</li> + * <li>request attributes, session attributes, servlet context attributes</li> * </ol> * * <p>The purpose of this class is to make it easy for web designer to work @@ -59,7 +60,8 @@ * with the concepts of request, session or application attributes and the * lifetime of objects in these scopes.</p> * - * <p>Note that the put() method always puts objects into the local hashtable. + * <p>Note that the put() method always puts objects into the local map + * and does not allow tools or servlet classes to be overridden. * </p> * * @author <a href="mailto:mendozajillian@example.org">Geir Magnusson Jr.</a> Modified: velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/context/package.html URL: http://svn.apache.org/viewvc/velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/context/package.html?rev=651469&r1=651468&r2=651469&view=diff ============================================================================== --- velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/context/package.html (original) +++ velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/context/package.html Thu Apr 24 17:46:13 2008 @@ -27,36 +27,7 @@ </head> <body bgcolor="white"> -<p>Provides special purpose implementations of the VelocityContext class -related to the automatic toolbox management in a servlet environment.</p> - -<!-- -##### THIS IS THE TEMPLATE FOR THE PACKAGE DOC COMMENTS. ##### -##### TYPE YOUR PACKAGE COMMENTS HERE. BEGIN WITH A ##### -##### ONE-SENTENCE SUMMARY STARTING WITH A VERB LIKE: ##### -Provides for.... ---> - -<h2>Package Specification</h2> - -<!-- -##### FILL IN ANY SPECS NEEDED BY JAVA COMPATIBILITY KIT ##### -<ul> - <li><a href="">##### REFER TO ANY FRAMEMAKER SPECIFICATION HERE #####</a> -</ul> ---> - -<h2>Related Documentation</h2> - -<!-- -For overviews, tutorials, examples, guides, and tool documentation, please see: -<ul> - <li><a href="">##### REFER TO NON-SPEC DOCUMENTATION HERE #####</a> -</ul> ---> - - -<!-- Put @see and @since tags down here. --> +<p>All classes in this package have been deprecated.</p> </body> </html> Modified: velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/package.html URL: http://svn.apache.org/viewvc/velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/package.html?rev=651469&r1=651468&r2=651469&view=diff ============================================================================== --- velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/package.html (original) +++ velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/package.html Thu Apr 24 17:46:13 2008 @@ -27,13 +27,10 @@ </head> <body bgcolor="white"> -Contains base interfaces and classes for toolbox management. -<br><br> -This is the root package of the VelocityView code. Classes -in this package and it's subpackages are meant to provide -support for using Velocity for the view layer of MVC applications -(with an emphasis on toolbox support and support for servlet based -applications). +Contains tools and supporting infrastructure for using +those tools in a servlet environment as well as general +use classes to support use of Velocity as (or in) the +view layer of web applications. <!-- ##### THIS IS THE TEMPLATE FOR THE PACKAGE DOC COMMENTS. ##### Modified: velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/servlet/package.html URL: http://svn.apache.org/viewvc/velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/servlet/package.html?rev=651469&r1=651468&r2=651469&view=diff ============================================================================== --- velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/servlet/package.html (original) +++ velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/servlet/package.html Thu Apr 24 17:46:13 2008 @@ -27,36 +27,7 @@ </head> <body bgcolor="white"> -Provides classes to support using Velocity in a servlet environment. -(includes servlets, resource loader, logger, and a toolbox manager) - -<!-- -##### THIS IS THE TEMPLATE FOR THE PACKAGE DOC COMMENTS. ##### -##### TYPE YOUR PACKAGE COMMENTS HERE. BEGIN WITH A ##### -##### ONE-SENTENCE SUMMARY STARTING WITH A VERB LIKE: ##### -Provides for.... ---> - -<h2>Package Specification</h2> - -<!-- -##### FILL IN ANY SPECS NEEDED BY JAVA COMPATIBILITY KIT ##### -<ul> - <li><a href="">##### REFER TO ANY FRAMEMAKER SPECIFICATION HERE #####</a> -</ul> ---> - -<h2>Related Documentation</h2> - -<!-- -For overviews, tutorials, examples, guides, and tool documentation, please see: -<ul> - <li><a href="">##### REFER TO NON-SPEC DOCUMENTATION HERE #####</a> -</ul> ---> - - -<!-- Put @see and @since tags down here. --> +All classes in this package have been deprecated. </body> </html> Modified: velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/tools/package.html URL: http://svn.apache.org/viewvc/velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/tools/package.html?rev=651469&r1=651468&r2=651469&view=diff ============================================================================== --- velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/tools/package.html (original) +++ velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/tools/package.html Thu Apr 24 17:46:13 2008 @@ -28,37 +28,8 @@ </head> <body bgcolor="white"> -<p>Provides the ViewTool and Configurable interfaces, as well as a number -of useful implementing classes. These are tools specifically meant for use -in a web application.</p> - - -<!-- -##### THIS IS THE TEMPLATE FOR THE PACKAGE DOC COMMENTS. ##### -##### TYPE YOUR PACKAGE COMMENTS HERE. BEGIN WITH A ##### -##### ONE-SENTENCE SUMMARY STARTING WITH A VERB LIKE: ##### -Provides for.... ---> - -<h2>Package Specification</h2> - -<!-- -##### FILL IN ANY SPECS NEEDED BY JAVA COMPATIBILITY KIT ##### -<ul> - <li><a href="">##### REFER TO ANY FRAMEMAKER SPECIFICATION HERE #####</a> -</ul> ---> - -<h2>Related Documentation</h2> - -<!-- -For overviews, tutorials, examples, guides, and tool documentation, please see: -<ul> - <li><a href="">##### REFER TO NON-SPEC DOCUMENTATION HERE #####</a> -</ul> ---> - -<!-- Put @see and @since tags down here. --> +All classes in this package have been deprecated and moved to +<code>org.apache.velocity.tools.view</code>. </body> </html> From commitsmendozajillian@example.org Fri Apr 25 00:48:18 2008 Return-Path: <commitsmendozajillian@example.org> Delivered-To: mendozajillian@example.org Received: (qmail 32375 invoked from network); 25 Apr 2008 00:48:18 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155) by minotaur.apache.org with SMTP; 25 Apr 2008 00:48:18 -0000 Received: (qmail 93666 invoked by uid 500); 25 Apr 2008 00:48:19 -0000 Delivered-To: mendozajillian@example.org Received: (qmail 93634 invoked by uid 500); 25 Apr 2008 00:48:19 -0000 Mailing-List: contact mendozajillian@example.org; run by ezmlm Precedence: bulk List-Help: <mailto:mendozajillian@example.org> List-Unsubscribe: <mailto:mendozajillian@example.org> List-Post: <mailto:mendozajillian@example.org> List-Id: <commits.velocity.apache.org> Reply-To: mendozajillian@example.org Delivered-To: mailing list mendozajillian@example.org Received: (qmail 93623 invoked by uid 99); 25 Apr 2008 00:48:19 -0000 Received: from athena.apache.org (HELO athena.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 24 Apr 2008 17:48:19 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [83.161.120.155] (HELO eris.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 25 Apr 2008 00:47:43 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 919FB1A9832; Thu, 24 Apr 2008 17:47:57 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r651470 - in /velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view: ./ servlet/ Date: Fri, 25 Apr 2008 00:47:55 -0000 To: mendozajillian@example.org From: mendozajillian@example.org X-Mailer: svnmailer-1.0.8 Message-Id: <mendozajillian@example.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: nbubna Date: Thu Apr 24 17:47:52 2008 New Revision: 651470 URL: http://svn.apache.org/viewvc?rev=651470&view=rev Log: log some helpful (hopefully) deprecation/migration notices Modified: velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/ToolboxManager.java velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/XMLToolboxManager.java velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/servlet/ServletLogger.java velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/servlet/ServletToolboxManager.java velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/servlet/VelocityLayoutServlet.java velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/servlet/VelocityViewServlet.java velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/servlet/WebappLoader.java Modified: velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/ToolboxManager.java URL: http://svn.apache.org/viewvc/velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/ToolboxManager.java?rev=651470&r1=651469&r2=651470&view=diff ============================================================================== --- velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/ToolboxManager.java (original) +++ velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/ToolboxManager.java Thu Apr 24 17:47:52 2008 @@ -30,6 +30,7 @@ * @author <a href="mailto:mendozajillian@example.org">Henning P. Schmiedehausen</a> * @version $Id$ */ +@Deprecated public interface ToolboxManager { Modified: velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/XMLToolboxManager.java URL: http://svn.apache.org/viewvc/velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/XMLToolboxManager.java?rev=651470&r1=651469&r2=651470&view=diff ============================================================================== --- velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/XMLToolboxManager.java (original) +++ velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/XMLToolboxManager.java Thu Apr 24 17:47:52 2008 @@ -96,6 +96,9 @@ { toolinfo = new ArrayList(); data = new HashMap(); + + LOG.warn("XMLToolboxManager has been deprecated. Please use "+ + "org.apache.velocity.tools.ToolboxFactory instead."); } Modified: velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/servlet/ServletLogger.java URL: http://svn.apache.org/viewvc/velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/servlet/ServletLogger.java?rev=651470&r1=651469&r2=651470&view=diff ============================================================================== --- velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/servlet/ServletLogger.java (original) +++ velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/servlet/ServletLogger.java Thu Apr 24 17:47:52 2008 @@ -19,6 +19,7 @@ * under the License. */ +import org.apache.velocity.runtime.RuntimeServices; import org.apache.velocity.runtime.log.LogSystem; import org.apache.velocity.tools.view.ServletLogChute; @@ -36,6 +37,14 @@ @Deprecated public class ServletLogger extends ServletLogChute implements LogSystem { + @Override + public void init(RuntimeServices rs) throws Exception + { + super.init(rs); + log(LogSystem.WARN_ID, "ServletLogger has been deprecated. Use " + + super.getClass().getName() + " instead."); + } + /** * Send a log message from Velocity. */ Modified: velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/servlet/ServletToolboxManager.java URL: http://svn.apache.org/viewvc/velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/servlet/ServletToolboxManager.java?rev=651470&r1=651469&r2=651470&view=diff ============================================================================== --- velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/servlet/ServletToolboxManager.java (original) +++ velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/servlet/ServletToolboxManager.java Thu Apr 24 17:47:52 2008 @@ -127,6 +127,9 @@ sessionToolInfo = new ArrayList(); requestToolInfo = new ArrayList(); createSession = true; + + LOG.warn("ServletToolboxManager has been deprecated. Please use "+ + "org.apache.velocity.tools.ToolboxFactory instead."); } Modified: velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/servlet/VelocityLayoutServlet.java URL: http://svn.apache.org/viewvc/velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/servlet/VelocityLayoutServlet.java?rev=651470&r1=651469&r2=651470&view=diff ============================================================================== --- velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/servlet/VelocityLayoutServlet.java (original) +++ velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/servlet/VelocityLayoutServlet.java Thu Apr 24 17:47:52 2008 @@ -19,6 +19,9 @@ * under the License. */ +import javax.servlet.ServletConfig; +import javax.servlet.ServletException; + /** * @author Nathan Bubna * @deprecated This has moved to {@link org.apache.velocity.tools.view.VelocityLayoutServlet} @@ -28,4 +31,13 @@ public class VelocityLayoutServlet extends org.apache.velocity.tools.view.VelocityLayoutServlet { + @Override + public void init(ServletConfig config) throws ServletException + { + super.init(config); + + getLog().debug(this.getClass().getName() + + " has been deprecated. Use " + + super.getClass().getName() + " instead."); + } } Modified: velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/servlet/VelocityViewServlet.java URL: http://svn.apache.org/viewvc/velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/servlet/VelocityViewServlet.java?rev=651470&r1=651469&r2=651470&view=diff ============================================================================== --- velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/servlet/VelocityViewServlet.java (original) +++ velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/servlet/VelocityViewServlet.java Thu Apr 24 17:47:52 2008 @@ -20,6 +20,8 @@ */ import org.apache.velocity.tools.view.VelocityView; +import javax.servlet.ServletConfig; +import javax.servlet.ServletException; /** * @deprecated This class has moved to {@link org.apache.velocity.tools.view.VelocityViewServlet} @@ -40,4 +42,14 @@ */ protected static final String DEFAULT_TOOLBOX_PATH = VelocityView.DEPRECATED_USER_TOOLS_PATH; + + @Override + public void init(ServletConfig config) throws ServletException + { + super.init(config); + + getLog().debug(this.getClass().getName() + + " has been deprecated. Use " + + super.getClass().getName() + " instead."); + } } Modified: velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/servlet/WebappLoader.java URL: http://svn.apache.org/viewvc/velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/servlet/WebappLoader.java?rev=651470&r1=651469&r2=651470&view=diff ============================================================================== --- velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/servlet/WebappLoader.java (original) +++ velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/servlet/WebappLoader.java Thu Apr 24 17:47:52 2008 @@ -20,6 +20,7 @@ */ import org.apache.velocity.tools.view.WebappResourceLoader; +import org.apache.commons.collections.ExtendedProperties; /** * <p>This is basically an empty subclass of {@link WebappResourceLoader} that exists @@ -33,4 +34,10 @@ @Deprecated public class WebappLoader extends WebappResourceLoader { + public void init(ExtendedProperties configuration) + { + log.warn("WebappLoader is deprecated. Use "+ + WebappResourceLoader.class.getName()+" instead."); + super.init(configuration); + } } From commitsmendozajillian@example.org Fri Apr 25 00:49:06 2008 Return-Path: <commitsmendozajillian@example.org> Delivered-To: mendozajillian@example.org Received: (qmail 32848 invoked from network); 25 Apr 2008 00:49:06 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155) by minotaur.apache.org with SMTP; 25 Apr 2008 00:49:06 -0000 Received: (qmail 95929 invoked by uid 500); 25 Apr 2008 00:49:08 -0000 Delivered-To: mendozajillian@example.org Received: (qmail 95897 invoked by uid 500); 25 Apr 2008 00:49:08 -0000 Mailing-List: contact mendozajillian@example.org; run by ezmlm Precedence: bulk List-Help: <mailto:mendozajillian@example.org> List-Unsubscribe: <mailto:mendozajillian@example.org> List-Post: <mailto:mendozajillian@example.org> List-Id: <commits.velocity.apache.org> Reply-To: mendozajillian@example.org Delivered-To: mailing list mendozajillian@example.org Received: (qmail 95886 invoked by uid 99); 25 Apr 2008 00:49:08 -0000 Received: from nike.apache.org (HELO nike.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 24 Apr 2008 17:49:08 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [83.161.120.155] (HELO eris.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 25 Apr 2008 00:48:23 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id B29091A9838; Thu, 24 Apr 2008 17:48:38 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r651471 - /velocity/tools/trunk/src/main/java/org/apache/velocity/tools/generic/FieldTool.java Date: Fri, 25 Apr 2008 00:48:38 -0000 To: mendozajillian@example.org From: mendozajillian@example.org X-Mailer: svnmailer-1.0.8 Message-Id: <mendozajillian@example.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: nbubna Date: Thu Apr 24 17:48:36 2008 New Revision: 651471 URL: http://svn.apache.org/viewvc?rev=651471&view=rev Log: log field name collisions to ease debugging Modified: velocity/tools/trunk/src/main/java/org/apache/velocity/tools/generic/FieldTool.java Modified: velocity/tools/trunk/src/main/java/org/apache/velocity/tools/generic/FieldTool.java URL: http://svn.apache.org/viewvc/velocity/tools/trunk/src/main/java/org/apache/velocity/tools/generic/FieldTool.java?rev=651471&r1=651470&r2=651471&view=diff ============================================================================== --- velocity/tools/trunk/src/main/java/org/apache/velocity/tools/generic/FieldTool.java (original) +++ velocity/tools/trunk/src/main/java/org/apache/velocity/tools/generic/FieldTool.java Thu Apr 24 17:48:36 2008 @@ -229,6 +229,12 @@ int mod = field.getModifiers(); if (Modifier.isStatic(mod) && Modifier.isPublic(mod)) { + // make it easy to debug key collisions + if (log.isDebugEnabled() && results.containsKey(field.getName())) + { + log.debug("FieldTool: "+field.getName()+ + " is being overridden by "+clazz.getName()); + } // if the field is final if (Modifier.isFinal(mod)) { From commitsmendozajillian@example.org Fri Apr 25 00:50:00 2008 Return-Path: <commitsmendozajillian@example.org> Delivered-To: mendozajillian@example.org Received: (qmail 33297 invoked from network); 25 Apr 2008 00:50:00 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155) by minotaur.apache.org with SMTP; 25 Apr 2008 00:50:00 -0000 Received: (qmail 96697 invoked by uid 500); 25 Apr 2008 00:50:01 -0000 Delivered-To: mendozajillian@example.org Received: (qmail 96667 invoked by uid 500); 25 Apr 2008 00:50:01 -0000 Mailing-List: contact mendozajillian@example.org; run by ezmlm Precedence: bulk List-Help: <mailto:mendozajillian@example.org> List-Unsubscribe: <mailto:mendozajillian@example.org> List-Post: <mailto:mendozajillian@example.org> List-Id: <commits.velocity.apache.org> Reply-To: mendozajillian@example.org Delivered-To: mailing list mendozajillian@example.org Received: (qmail 96656 invoked by uid 99); 25 Apr 2008 00:50:01 -0000 Received: from athena.apache.org (HELO athena.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 24 Apr 2008 17:50:01 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [83.161.120.155] (HELO eris.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 25 Apr 2008 00:49:25 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 649F51A9832; Thu, 24 Apr 2008 17:49:39 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r651472 - /velocity/tools/trunk/src/main/java/org/apache/velocity/tools/generic/LoopTool.java Date: Fri, 25 Apr 2008 00:49:38 -0000 To: mendozajillian@example.org From: mendozajillian@example.org X-Mailer: svnmailer-1.0.8 Message-Id: <mendozajillian@example.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: nbubna Date: Thu Apr 24 17:49:37 2008 New Revision: 651472 URL: http://svn.apache.org/viewvc?rev=651472&view=rev Log: add sync(main,synced) convenience method Modified: velocity/tools/trunk/src/main/java/org/apache/velocity/tools/generic/LoopTool.java Modified: velocity/tools/trunk/src/main/java/org/apache/velocity/tools/generic/LoopTool.java URL: http://svn.apache.org/viewvc/velocity/tools/trunk/src/main/java/org/apache/velocity/tools/generic/LoopTool.java?rev=651472&r1=651471&r2=651472&view=diff ============================================================================== --- velocity/tools/trunk/src/main/java/org/apache/velocity/tools/generic/LoopTool.java (original) +++ velocity/tools/trunk/src/main/java/org/apache/velocity/tools/generic/LoopTool.java Thu Apr 24 17:49:37 2008 @@ -148,6 +148,11 @@ return managed; } + public ManagedIterator sync(Object main, Object synced) + { + return watch(main).sync(synced); + } + protected ManagedIterator manage(Iterator iterator, String name) { return new ManagedIterator(name, iterator, this); From commitsmendozajillian@example.org Fri Apr 25 22:04:24 2008 Return-Path: <commitsmendozajillian@example.org> Delivered-To: mendozajillian@example.org Received: (qmail 4460 invoked from network); 25 Apr 2008 22:04:24 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155) by minotaur.apache.org with SMTP; 25 Apr 2008 22:04:24 -0000 Received: (qmail 15550 invoked by uid 500); 25 Apr 2008 22:04:25 -0000 Delivered-To: mendozajillian@example.org Received: (qmail 15512 invoked by uid 500); 25 Apr 2008 22:04:25 -0000 Mailing-List: contact mendozajillian@example.org; run by ezmlm Precedence: bulk List-Help: <mailto:mendozajillian@example.org> List-Unsubscribe: <mailto:mendozajillian@example.org> List-Post: <mailto:mendozajillian@example.org> List-Id: <commits.velocity.apache.org> Reply-To: mendozajillian@example.org Delivered-To: mailing list mendozajillian@example.org Received: (qmail 15501 invoked by uid 99); 25 Apr 2008 22:04:25 -0000 Received: from athena.apache.org (HELO athena.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 25 Apr 2008 15:04:25 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [83.161.120.155] (HELO eris.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 25 Apr 2008 22:03:49 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 3D59E1A9832; Fri, 25 Apr 2008 15:04:03 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r651710 - /velocity/tools/trunk/src/main/java/org/apache/velocity/tools/generic/FieldTool.java Date: Fri, 25 Apr 2008 22:04:02 -0000 To: mendozajillian@example.org From: mendozajillian@example.org X-Mailer: svnmailer-1.0.8 Message-Id: <mendozajillian@example.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: nbubna Date: Fri Apr 25 15:04:01 2008 New Revision: 651710 URL: http://svn.apache.org/viewvc?rev=651710&view=rev Log: beware of null log Modified: velocity/tools/trunk/src/main/java/org/apache/velocity/tools/generic/FieldTool.java Modified: velocity/tools/trunk/src/main/java/org/apache/velocity/tools/generic/FieldTool.java URL: http://svn.apache.org/viewvc/velocity/tools/trunk/src/main/java/org/apache/velocity/tools/generic/FieldTool.java?rev=651710&r1=651709&r2=651710&view=diff ============================================================================== --- velocity/tools/trunk/src/main/java/org/apache/velocity/tools/generic/FieldTool.java (original) +++ velocity/tools/trunk/src/main/java/org/apache/velocity/tools/generic/FieldTool.java Fri Apr 25 15:04:01 2008 @@ -230,7 +230,8 @@ if (Modifier.isStatic(mod) && Modifier.isPublic(mod)) { // make it easy to debug key collisions - if (log.isDebugEnabled() && results.containsKey(field.getName())) + if (log != null && log.isDebugEnabled() && + results.containsKey(field.getName())) { log.debug("FieldTool: "+field.getName()+ " is being overridden by "+clazz.getName()); From commitsmendozajillian@example.org Fri Apr 25 22:06:44 2008 Return-Path: <commitsmendozajillian@example.org> Delivered-To: mendozajillian@example.org Received: (qmail 5340 invoked from network); 25 Apr 2008 22:06:44 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155) by minotaur.apache.org with SMTP; 25 Apr 2008 22:06:44 -0000 Received: (qmail 17331 invoked by uid 500); 25 Apr 2008 22:06:46 -0000 Delivered-To: mendozajillian@example.org Received: (qmail 17315 invoked by uid 500); 25 Apr 2008 22:06:46 -0000 Mailing-List: contact mendozajillian@example.org; run by ezmlm Precedence: bulk List-Help: <mailto:mendozajillian@example.org> List-Unsubscribe: <mailto:mendozajillian@example.org> List-Post: <mailto:mendozajillian@example.org> List-Id: <commits.velocity.apache.org> Reply-To: mendozajillian@example.org Delivered-To: mailing list mendozajillian@example.org Received: (qmail 17304 invoked by uid 99); 25 Apr 2008 22:06:46 -0000 Received: from nike.apache.org (HELO nike.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 25 Apr 2008 15:06:46 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [83.161.120.155] (HELO eris.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 25 Apr 2008 22:06:01 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 8D6DE1A9832; Fri, 25 Apr 2008 15:06:21 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r651711 - in /velocity/tools/trunk/src/main/java/org/apache/velocity/tools: generic/ResourceTool.java view/tools/ViewResourceTool.java Date: Fri, 25 Apr 2008 22:06:21 -0000 To: mendozajillian@example.org From: mendozajillian@example.org X-Mailer: svnmailer-1.0.8 Message-Id: <mendozajillian@example.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: nbubna Date: Fri Apr 25 15:06:19 2008 New Revision: 651711 URL: http://svn.apache.org/viewvc?rev=651711&view=rev Log: VELTOOLS-104 keep backwards compatibility for rendering resources w/no args in deprecationSupportMode Modified: velocity/tools/trunk/src/main/java/org/apache/velocity/tools/generic/ResourceTool.java velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/tools/ViewResourceTool.java Modified: velocity/tools/trunk/src/main/java/org/apache/velocity/tools/generic/ResourceTool.java URL: http://svn.apache.org/viewvc/velocity/tools/trunk/src/main/java/org/apache/velocity/tools/generic/ResourceTool.java?rev=651711&r1=651710&r2=651711&view=diff ============================================================================== --- velocity/tools/trunk/src/main/java/org/apache/velocity/tools/generic/ResourceTool.java (original) +++ velocity/tools/trunk/src/main/java/org/apache/velocity/tools/generic/ResourceTool.java Fri Apr 25 15:06:19 2008 @@ -68,6 +68,7 @@ public static final String BUNDLES_KEY = "bundles"; private String[] bundles = new String[] { "resources" }; + private boolean deprecationSupportMode = false; protected final void setDefaultBundle(String bundle) @@ -100,6 +101,13 @@ return super.getLocale(); } + @Deprecated + public void setDeprecationSupportMode(boolean depMode) + { + System.out.println("ResourceTool.depMode = "+depMode); + this.deprecationSupportMode = depMode; + } + protected void configure(ValueParser parser) { @@ -203,10 +211,18 @@ * Renders the specified resource value and arguments as a String. * The resource is treated as a {@link MessageFormat} pattern which * is used for formatting along with any specified argument values. + * If <code>deprecationSupportMode</code> is set to true, then this + * will return the resource directly when there are no args (as it + * did in 1.x versions). */ public String render(Object resource, Object[] args) { - return MessageFormat.format(String.valueOf(resource), args); + String value = String.valueOf(resource); + if (deprecationSupportMode && args == null) + { + return value; + } + return MessageFormat.format(value, args); } Modified: velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/tools/ViewResourceTool.java URL: http://svn.apache.org/viewvc/velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/tools/ViewResourceTool.java?rev=651711&r1=651710&r2=651711&view=diff ============================================================================== --- velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/tools/ViewResourceTool.java (original) +++ velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/tools/ViewResourceTool.java Fri Apr 25 15:06:19 2008 @@ -28,6 +28,11 @@ public class ViewResourceTool extends org.apache.velocity.tools.view.ViewResourceTool { + public ViewResourceTool() { + // force depMode for this deprecated version + setDeprecationSupportMode(true); + } + @Deprecated public void init(Object obj) { From commitsmendozajillian@example.org Fri Apr 25 22:08:01 2008 Return-Path: <commitsmendozajillian@example.org> Delivered-To: mendozajillian@example.org Received: (qmail 5752 invoked from network); 25 Apr 2008 22:08:01 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155) by minotaur.apache.org with SMTP; 25 Apr 2008 22:08:01 -0000 Received: (qmail 18524 invoked by uid 500); 25 Apr 2008 22:08:03 -0000 Delivered-To: mendozajillian@example.org Received: (qmail 18492 invoked by uid 500); 25 Apr 2008 22:08:03 -0000 Mailing-List: contact mendozajillian@example.org; run by ezmlm Precedence: bulk List-Help: <mailto:mendozajillian@example.org> List-Unsubscribe: <mailto:mendozajillian@example.org> List-Post: <mailto:mendozajillian@example.org> List-Id: <commits.velocity.apache.org> Reply-To: mendozajillian@example.org Delivered-To: mailing list mendozajillian@example.org Received: (qmail 18481 invoked by uid 99); 25 Apr 2008 22:08:03 -0000 Received: from athena.apache.org (HELO athena.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 25 Apr 2008 15:08:03 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [83.161.120.155] (HELO eris.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 25 Apr 2008 22:07:27 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id BEC041A9832; Fri, 25 Apr 2008 15:07:40 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r651712 - in /velocity/tools/trunk/src: main/java/org/apache/velocity/tools/config/ main/java/org/apache/velocity/tools/view/ test/java/org/apache/velocity/tools/test/whitebox/ Date: Fri, 25 Apr 2008 22:07:39 -0000 To: mendozajillian@example.org From: mendozajillian@example.org X-Mailer: svnmailer-1.0.8 Message-Id: <mendozajillian@example.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: nbubna Date: Fri Apr 25 15:07:38 2008 New Revision: 651712 URL: http://svn.apache.org/viewvc?rev=651712&view=rev Log: make combined configurations easier to debug by tracking source info on them Modified: velocity/tools/trunk/src/main/java/org/apache/velocity/tools/config/ConfigurationUtils.java velocity/tools/trunk/src/main/java/org/apache/velocity/tools/config/EasyFactoryConfiguration.java velocity/tools/trunk/src/main/java/org/apache/velocity/tools/config/FactoryConfiguration.java 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 velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/VelocityView.java velocity/tools/trunk/src/test/java/org/apache/velocity/tools/test/whitebox/ConfigTests.java Modified: velocity/tools/trunk/src/main/java/org/apache/velocity/tools/config/ConfigurationUtils.java URL: http://svn.apache.org/viewvc/velocity/tools/trunk/src/main/java/org/apache/velocity/tools/config/ConfigurationUtils.java?rev=651712&r1=651711&r2=651712&view=diff ============================================================================== --- velocity/tools/trunk/src/main/java/org/apache/velocity/tools/config/ConfigurationUtils.java (original) +++ velocity/tools/trunk/src/main/java/org/apache/velocity/tools/config/ConfigurationUtils.java Fri Apr 25 15:07:38 2008 @@ -74,7 +74,8 @@ */ public static FactoryConfiguration getDefaultTools() { - FileFactoryConfiguration config = new XmlFactoryConfiguration(); + FileFactoryConfiguration config = + new XmlFactoryConfiguration("ConfigurationUtils.getDefaultTools()"); config.read(GENERIC_DEFAULTS_PATH); // view tools and struts tools may not be available @@ -92,7 +93,8 @@ */ public static FactoryConfiguration getGenericTools() { - FileFactoryConfiguration config = new XmlFactoryConfiguration(); + FileFactoryConfiguration config = + new XmlFactoryConfiguration("ConfigurationUtils.getGenericTools()"); config.read(GENERIC_DEFAULTS_PATH); // defaults should *always* be clean! @@ -108,7 +110,8 @@ */ public static FactoryConfiguration getVelocityView() { - FileFactoryConfiguration config = new XmlFactoryConfiguration(); + FileFactoryConfiguration config = + new XmlFactoryConfiguration("ConfigurationUtils.getVelocityView()"); config.read(GENERIC_DEFAULTS_PATH); config.read(VIEW_DEFAULTS_PATH); @@ -126,7 +129,8 @@ */ public static FactoryConfiguration getVelocityStruts() { - FileFactoryConfiguration config = new XmlFactoryConfiguration(); + FileFactoryConfiguration config = + new XmlFactoryConfiguration("ConfigurationUtils.getVelocityStruts()"); config.read(GENERIC_DEFAULTS_PATH); config.read(VIEW_DEFAULTS_PATH); config.read(STRUTS_DEFAULTS_PATH); @@ -174,7 +178,7 @@ else { // start out blank - auto = new FactoryConfiguration(); + auto = new FactoryConfiguration("ConfigurationUtils.getAutoLoaded(false)"); } //TODO: look for any Tools classes in the root of the classpath @@ -365,7 +369,8 @@ else { // create a base config to combine the others into - FactoryConfiguration config = new FactoryConfiguration(); + FactoryConfiguration config = + new FactoryConfiguration("ConfigurationUtils.findInClassPath("+path+","+caller+")"); boolean readAConfig = false; for (URL resource : found) { @@ -400,13 +405,14 @@ { FileFactoryConfiguration config = null; String path = url.toString(); + String source = "ConfigurationUtils.read("+url.toString()+")"; if (path.endsWith(".xml")) { - config = new XmlFactoryConfiguration(); + config = new XmlFactoryConfiguration(source); } else if (path.endsWith(".properties")) { - config = new PropertiesFactoryConfiguration(); + config = new PropertiesFactoryConfiguration(source); } else if (path.endsWith(".class")) { Modified: velocity/tools/trunk/src/main/java/org/apache/velocity/tools/config/EasyFactoryConfiguration.java URL: http://svn.apache.org/viewvc/velocity/tools/trunk/src/main/java/org/apache/velocity/tools/config/EasyFactoryConfiguration.java?rev=651712&r1=651711&r2=651712&view=diff ============================================================================== --- velocity/tools/trunk/src/main/java/org/apache/velocity/tools/config/EasyFactoryConfiguration.java (original) +++ velocity/tools/trunk/src/main/java/org/apache/velocity/tools/config/EasyFactoryConfiguration.java Fri Apr 25 15:07:38 2008 @@ -19,6 +19,7 @@ * under the License. */ +import java.util.List; import org.apache.velocity.tools.ToolboxFactory; /** @@ -98,9 +99,28 @@ */ public EasyFactoryConfiguration(boolean includeDefaults) { + // just give the param name as source + this(includeDefaults, String.valueOf(includeDefaults)); + } + + /** + * @param includeDefaults Sets whether this instance should start with the + * {@link ConfigurationUtils#getDefaultTools()} configuration or not. + * @param source a string identify where this instance was created, or + * something else useful to identify this instance during debugging + */ + public EasyFactoryConfiguration(boolean includeDefaults, String source) + { + super(EasyFactoryConfiguration.class, source); + if (includeDefaults) { addDefaultTools(); + // now put the root source last, since the defaults were really first + // and nothing could have been added prior to them + List<String> sources = getSources(); + String first = sources.remove(0); + sources.add(first); } } Modified: velocity/tools/trunk/src/main/java/org/apache/velocity/tools/config/FactoryConfiguration.java URL: http://svn.apache.org/viewvc/velocity/tools/trunk/src/main/java/org/apache/velocity/tools/config/FactoryConfiguration.java?rev=651712&r1=651711&r2=651712&view=diff ============================================================================== --- velocity/tools/trunk/src/main/java/org/apache/velocity/tools/config/FactoryConfiguration.java (original) +++ velocity/tools/trunk/src/main/java/org/apache/velocity/tools/config/FactoryConfiguration.java Fri Apr 25 15:07:38 2008 @@ -19,7 +19,9 @@ * under the License. */ +import java.util.ArrayList; import java.util.Collection; +import java.util.List; import java.util.SortedSet; import java.util.TreeSet; import org.apache.velocity.tools.ToolboxFactory; @@ -35,6 +37,44 @@ extends CompoundConfiguration<ToolboxConfiguration> { private final SortedSet<Data> data = new TreeSet<Data>(); + private final List<String> sources = new ArrayList<String>(); + + public FactoryConfiguration() + { + this(""); + } + + /** + * Creates a new instance with the specified source name + * combined with this class's name as the initial source. + */ + public FactoryConfiguration(String source) + { + this(FactoryConfiguration.class, source); + } + + /** + * Allows subclasses to construct an instance that uses their classname. + */ + protected FactoryConfiguration(Class clazz, String source) + { + addSource(clazz.getName()+"("+source+")"); + } + + /** + * Returns the list of sources for this configuration info in + * order starting from the source name given to this instance + * (if any) and going to the most recently added source. + */ + public List<String> getSources() + { + return this.sources; + } + + public void addSource(String source) + { + this.sources.add(source); + } public void addData(Data newDatum) { @@ -130,6 +170,12 @@ // add config's Data to our own setData(config.getData()); + // add config's sources to our own + for (String source : config.getSources()) + { + addSource(source); + } + // pass to CompoundConfiguration's to add properties super.addConfiguration(config); } @@ -148,8 +194,18 @@ @Override public String toString() { + return toString(true); + } + + public String toString(boolean includeSources) + { StringBuilder out = new StringBuilder(); - out.append("\nFactoryConfiguration "); + out.append("\nFactoryConfiguration from "); + if (includeSources) + { + out.append(getSources().size()); + out.append(" sources "); + } appendProperties(out); if (hasData()) { @@ -172,6 +228,18 @@ out.append(datum); out.append("\n "); } + } + if (includeSources) + { + int count = 0; + for (String source : getSources()) + { + out.append("\n Source "); + out.append(count++); + out.append(": "); + out.append(source); + } + out.append("\n"); } return out.toString(); } 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=651712&r1=651711&r2=651712&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 Fri Apr 25 15:07:38 2008 @@ -37,6 +37,11 @@ */ public abstract class FileFactoryConfiguration extends FactoryConfiguration { + protected FileFactoryConfiguration(Class clazz, String source) + { + super(clazz, source); + } + /** * <p>Reads an configuration from an {@link InputStream}.</p> * @@ -143,6 +148,8 @@ try { read(url, url.openStream(), required, log); + // only add the sources which can be read + addSource(" .read("+url.toString()+")"); } catch (IOException ioe) { 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=651712&r1=651711&r2=651712&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 Fri Apr 25 15:07:38 2008 @@ -54,6 +54,16 @@ */ public class PropertiesFactoryConfiguration extends FileFactoryConfiguration { + public PropertiesFactoryConfiguration() + { + this(""); + } + + public PropertiesFactoryConfiguration(String source) + { + super(PropertiesFactoryConfiguration.class, source); + } + /** * <p>Reads an properties file from an {@link InputStream} * and uses it to configure this {@link FactoryConfiguration}.</p> 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=651712&r1=651711&r2=651712&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 Fri Apr 25 15:07:38 2008 @@ -38,11 +38,22 @@ public XmlFactoryConfiguration() { - this(false); + this(false, ""); } public XmlFactoryConfiguration(boolean supportOldConfig) { + this(supportOldConfig, String.valueOf(supportOldConfig)); + } + + public XmlFactoryConfiguration(String source) + { + this(false, source); + } + + public XmlFactoryConfiguration(boolean supportOldConfig, String source) + { + super(XmlFactoryConfiguration.class, source); setRuleSet(new XmlFactoryConfigurationRuleSet()); this.supportOldXml = supportOldConfig; } Modified: velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/VelocityView.java URL: http://svn.apache.org/viewvc/velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/VelocityView.java?rev=651712&r1=651711&r2=651712&view=diff ============================================================================== --- velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/VelocityView.java (original) +++ velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/VelocityView.java Fri Apr 25 15:07:38 2008 @@ -477,7 +477,7 @@ */ protected void configure(final JeeConfig config, final ToolboxFactory factory) { - FactoryConfiguration factoryConfig = new FactoryConfiguration(); + FactoryConfiguration factoryConfig = new FactoryConfiguration("VelocityView.configure(config,factory)"); boolean hasOldToolbox = false; if (this.deprecationSupportMode) @@ -722,13 +722,14 @@ // then make sure it's a file type we recognize FileFactoryConfiguration config = null; + String source = "VelocityView.getConfiguration("+path+","+required+")"; if (path.endsWith(".xml")) { - config = new XmlFactoryConfiguration(this.deprecationSupportMode); + config = new XmlFactoryConfiguration(this.deprecationSupportMode, source); } else if (path.endsWith(".properties")) { - config = new PropertiesFactoryConfiguration(); + config = new PropertiesFactoryConfiguration(source); } else { Modified: velocity/tools/trunk/src/test/java/org/apache/velocity/tools/test/whitebox/ConfigTests.java URL: http://svn.apache.org/viewvc/velocity/tools/trunk/src/test/java/org/apache/velocity/tools/test/whitebox/ConfigTests.java?rev=651712&r1=651711&r2=651712&view=diff ============================================================================== --- velocity/tools/trunk/src/test/java/org/apache/velocity/tools/test/whitebox/ConfigTests.java (original) +++ velocity/tools/trunk/src/test/java/org/apache/velocity/tools/test/whitebox/ConfigTests.java Fri Apr 25 15:07:38 2008 @@ -406,6 +406,15 @@ assertEquals(one.toString(), two.toString()); } + protected void assertConfigEquals(FactoryConfiguration one, FactoryConfiguration two) + { + assertNotNull(one); + assertNotNull(two); + + // for now, just compare the toString() output without source info + assertEquals(one.toString(false), two.toString(false)); + } + protected void assertValid(Data valid) { assertNotNull(valid); From commitsmendozajillian@example.org Fri Apr 25 23:08:10 2008 Return-Path: <commitsmendozajillian@example.org> Delivered-To: mendozajillian@example.org Received: (qmail 18821 invoked from network); 25 Apr 2008 23:08:10 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155) by minotaur.apache.org with SMTP; 25 Apr 2008 23:08:10 -0000 Received: (qmail 62493 invoked by uid 500); 25 Apr 2008 23:08:12 -0000 Delivered-To: mendozajillian@example.org Received: (qmail 62472 invoked by uid 500); 25 Apr 2008 23:08:11 -0000 Mailing-List: contact mendozajillian@example.org;
{'source': 'Apache Software Foundation Public Mail Archives'}