You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tiles.apache.org by ap...@apache.org on 2009/03/19 23:38:17 UTC

svn commit: r756241 - in /tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity: ./ context/ template/

Author: apetrelli
Date: Thu Mar 19 22:38:17 2009
New Revision: 756241

URL: http://svn.apache.org/viewvc?rev=756241&view=rev
Log:
TILES-381
Added Javadocs for tiles-velocity.

Modified:
    tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/TilesVelocityException.java
    tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/context/ExternalWriterHttpServletResponse.java
    tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/context/VelocityTilesRequestContext.java
    tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/context/VelocityTilesRequestContextFactory.java
    tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/context/VelocityUtil.java
    tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/AbstractDefaultToStringRenderable.java
    tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/AddAttributeVModel.java
    tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/AddListAttributeVModel.java
    tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/BodyExecutable.java
    tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/ContextHolder.java
    tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/DefinitionVModel.java
    tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/Executable.java
    tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/GetAsStringVModel.java
    tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/ImportAttributeVModel.java
    tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/InsertAttributeVModel.java
    tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/InsertDefinitionVModel.java
    tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/InsertTemplateVModel.java
    tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/PutAttributeVModel.java
    tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/PutListAttributeVModel.java
    tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/Tiles2Tool.java
    tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/TilesVelocityRepository.java

Modified: tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/TilesVelocityException.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/TilesVelocityException.java?rev=756241&r1=756240&r2=756241&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/TilesVelocityException.java (original)
+++ tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/TilesVelocityException.java Thu Mar 19 22:38:17 2009
@@ -1,26 +1,72 @@
+/*
+ * $Id$
+ *
+ * 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.
+ */
+
 package org.apache.tiles.velocity;
 
 import org.apache.tiles.TilesException;
 
+/**
+ * Exception connected to the usage of Velocity and Tiles.
+ * 
+ * @version $Rev$ $Date$
+ * @since 2.2.0
+ */
 public class TilesVelocityException extends TilesException {
 
+    /**
+     * Constructor.
+     * 
+     * @since 2.2.0
+     */
     public TilesVelocityException() {
-        // TODO Auto-generated constructor stub
     }
 
+    /**
+     * Constructor.
+     * 
+     * @param message The message of the exception.
+     * @since 2.2.0
+     */
     public TilesVelocityException(String message) {
         super(message);
-        // TODO Auto-generated constructor stub
     }
 
+    /**
+     * Constructor.
+     * 
+     * @param e The cause of the exception.
+     * @since 2.2.0
+     */
     public TilesVelocityException(Exception e) {
         super(e);
-        // TODO Auto-generated constructor stub
     }
 
+    /**
+     * Constructor.
+     * 
+     * @param message The message of the exception.
+     * @param e The cause of the exception.
+     * @since 2.2.0
+     */
     public TilesVelocityException(String message, Exception e) {
         super(message, e);
-        // TODO Auto-generated constructor stub
     }
-
 }

Modified: tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/context/ExternalWriterHttpServletResponse.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/context/ExternalWriterHttpServletResponse.java?rev=756241&r1=756240&r2=756241&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/context/ExternalWriterHttpServletResponse.java (original)
+++ tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/context/ExternalWriterHttpServletResponse.java Thu Mar 19 22:38:17 2009
@@ -1,3 +1,24 @@
+/*
+ * $Id$
+ *
+ * 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.
+ */
+
 package org.apache.tiles.velocity.context;
 
 import java.io.IOException;
@@ -6,16 +27,33 @@
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpServletResponseWrapper;
 
+/**
+ * Wraps an HTTP response and overrides its print writer.
+ * 
+ * @version $Rev$ $Date$
+ * @since 2.2.0
+ */
 public class ExternalWriterHttpServletResponse extends
         HttpServletResponseWrapper {
 
+    /**
+     * The print writer to use, instead of the response's one.
+     */
     private PrintWriter writer;
     
+    /**
+     * Constructor.
+     * 
+     * @param response The response to wrap.
+     * @param writer The print writer to use, instead of the response's one.
+     * @since 2.2.0
+     */
     public ExternalWriterHttpServletResponse(HttpServletResponse response, PrintWriter writer) {
         super(response);
         this.writer = writer;
     }
 
+    /** {@inheritDoc} */
     @Override
     public PrintWriter getWriter() throws IOException {
         return writer;

Modified: tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/context/VelocityTilesRequestContext.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/context/VelocityTilesRequestContext.java?rev=756241&r1=756240&r2=756241&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/context/VelocityTilesRequestContext.java (original)
+++ tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/context/VelocityTilesRequestContext.java Thu Mar 19 22:38:17 2009
@@ -18,6 +18,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+
 package org.apache.tiles.velocity.context;
 
 import java.io.IOException;
@@ -35,18 +36,36 @@
 import org.apache.velocity.context.Context;
 
 /**
+ * The implementation of the Tiles request context specific for Velocity.
  * 
- * @author SergeyZ
- * 
+ * @version $Rev$ $Date$
+ * @since 2.2.0
  */
 public class VelocityTilesRequestContext extends TilesRequestContextWrapper {
 
+    /**
+     * The Velocity current context.
+     */
     private final Context ctx;
     
+    /**
+     * The request objects.
+     */
     private Object[] requestObjects;
     
+    /**
+     * The writer to use to render the response. It may be null, if not necessary.
+     */
     private Writer writer;
 
+    /**
+     * Constructor.
+     * 
+     * @param enclosedRequest The request that exposes non-Velocity specific properties
+     * @param ctx The Velocity current context.
+     * @param writer The writer to use to render the response. It may be null, if not necessary.
+     * @since 2.2.0
+     */
     public VelocityTilesRequestContext(
             TilesRequestContext enclosedRequest, Context ctx, Writer writer) {
         super(enclosedRequest);
@@ -54,10 +73,12 @@
         this.writer = writer;
     }
 
+    /** {@inheritDoc} */
     public void dispatch(String path) throws IOException {
         include(path);
     }
 
+    /** {@inheritDoc} */
     @Override
     public void include(String path) throws IOException {
         Object[] requestObjects = super.getRequestObjects();
@@ -81,6 +102,7 @@
         }
     }
 
+    /** {@inheritDoc} */
     @Override
     public PrintWriter getPrintWriter() throws IOException {
         if (writer == null) {
@@ -94,6 +116,7 @@
         }
     }
 
+    /** {@inheritDoc} */
     @Override
     public Writer getWriter() throws IOException {
         if (writer == null) {
@@ -103,6 +126,7 @@
         return writer;
     }
 
+    /** {@inheritDoc} */
     @Override
     public Object[] getRequestObjects() {
         if (requestObjects == null) {

Modified: tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/context/VelocityTilesRequestContextFactory.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/context/VelocityTilesRequestContextFactory.java?rev=756241&r1=756240&r2=756241&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/context/VelocityTilesRequestContextFactory.java (original)
+++ tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/context/VelocityTilesRequestContextFactory.java Thu Mar 19 22:38:17 2009
@@ -34,10 +34,10 @@
 import org.apache.velocity.context.Context;
 
 /**
+ * The implementation of the Tiles request context factory specific for Velocity.
  * 
- * @author anydoby
- * 
- * @since Mar 15, 2008
+ * @version $Rev$ $Date$
+ * @since 2.2.0
  */
 public class VelocityTilesRequestContextFactory implements TilesRequestContextFactory, TilesRequestContextFactoryAware {
 
@@ -46,6 +46,7 @@
      */
     private TilesRequestContextFactory parent;
 
+    /** {@inheritDoc} */
     public TilesRequestContext createRequestContext(TilesApplicationContext context, Object... requestItems) {
         if ((requestItems.length == 3 || requestItems.length == 4)
                 && requestItems[0] instanceof Context
@@ -77,11 +78,12 @@
         return null;
     }
 
+    /** {@inheritDoc} */
     public void init(Map<String, String> configurationParameters) {
-        // TODO Auto-generated method stub
-
+        // Nothing to initialize.
     }
 
+    /** {@inheritDoc} */
     public void setRequestContextFactory(
             TilesRequestContextFactory contextFactory) {
         this.parent = contextFactory;

Modified: tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/context/VelocityUtil.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/context/VelocityUtil.java?rev=756241&r1=756240&r2=756241&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/context/VelocityUtil.java (original)
+++ tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/context/VelocityUtil.java Thu Mar 19 22:38:17 2009
@@ -1,3 +1,24 @@
+/*
+ * $Id$
+ *
+ * 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.
+ */
+
 package org.apache.tiles.velocity.context;
 
 import java.io.IOException;
@@ -15,8 +36,19 @@
 import org.apache.velocity.exception.ResourceNotFoundException;
 import org.apache.velocity.runtime.Renderable;
 
+/**
+ * Utilities for Velocity usage in Tiles.
+ * 
+ * @version $Rev$ $Date$
+ * @since 2.2.0
+ */
 public class VelocityUtil {
     
+    /**
+     * A renderable object that does not render anything.
+     * 
+     * @since 2.2.0
+     */
     public static final Renderable EMPTY_RENDERABLE;
     
     static {
@@ -36,15 +68,38 @@
         };
     }
     
+    /**
+     * The attribute key that will be used to store the parameter map, to use across Velocity tool calls.
+     * 
+     * @since 2.2.0
+     */
     private final static String PARAMETER_MAP_STACK_KEY = "org.apache.tiles.velocity.PARAMETER_MAP_STACK"; 
     
+    /**
+     * Private constructor to avoid instantiation.
+     */
     private VelocityUtil() {
     }
     
+    /**
+     * Null-safe conversion from Boolean to boolean.
+     * 
+     * @param obj The Boolean object.
+     * @param defaultValue This value will be returned if <code>obj</code> is null.
+     * @return The boolean value of <code>obj</code> or, if null, <code>defaultValue</code>.
+     * @since 2.2.0
+     */
     public static boolean toSimpleBoolean(Boolean obj, boolean defaultValue) {
         return obj != null ? obj : defaultValue;
     }
     
+    /**
+     * Returns or creates the parameter stack to use. It is useful to store parameters across tool calls.
+     * 
+     * @param context The Velocity context.
+     * @return The parameter stack.
+     * @since 2.2.0
+     */
     @SuppressWarnings("unchecked")
     public static Stack<Map<String, Object>> getParameterStack(Context context) {
         Stack<Map<String, Object>> stack = (Stack<Map<String, Object>>) context
@@ -56,6 +111,17 @@
         return stack;
     }
 
+    /**
+     * Sets an attribute in the desired scope.
+     * 
+     * @param velocityContext The Velocity context.
+     * @param request The HTTP request.
+     * @param servletContext The servlet context.
+     * @param name The name of the attribute.
+     * @param obj The value of the attribute.
+     * @param scope The scope. It can be <code>page</code>, <code>request</code>, <code>session</code>, <code>application</code>.
+     * @since 2.2.0
+     */
     public static void setAttribute(Context velocityContext,
             HttpServletRequest request, ServletContext servletContext,
             String name, Object obj, String scope) {

Modified: tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/AbstractDefaultToStringRenderable.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/AbstractDefaultToStringRenderable.java?rev=756241&r1=756240&r2=756241&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/AbstractDefaultToStringRenderable.java (original)
+++ tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/AbstractDefaultToStringRenderable.java Thu Mar 19 22:38:17 2009
@@ -1,6 +1,24 @@
-/**
- * 
+/*
+ * $Id: ServletUtil.java 751886 2009-03-09 22:39:50Z apetrelli $
+ *
+ * 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.
  */
+
 package org.apache.tiles.velocity.template;
 
 import java.io.IOException;
@@ -19,14 +37,58 @@
 import org.apache.velocity.exception.ResourceNotFoundException;
 import org.apache.velocity.runtime.Renderable;
 
+/**
+ * Renderable that provides a default implementation of {@link Renderable#toString()}
+ * and allows access to parameters and context objects.
+ * 
+ * @version $Rev: 751886 $ $Date: 2009-03-09 23:39:50 +0100 (lun, 09 mar 2009) $
+ * @since 2.2.0
+ */
 public abstract class AbstractDefaultToStringRenderable implements Renderable {
+    
+    
+    /**
+     * The Velocity context.
+     * 
+     * @since 2.2.0
+     */
     protected final Context velocityContext;
+    
+    /**
+     * The parameters used in the current tool call.
+     * 
+     * @since 2.2.0
+     */
     protected final Map<String, Object> params;
+    
+    /**
+     * The HTTP response.
+     * 
+     * @since 2.2.0
+     */
     protected final HttpServletResponse response;
+    
+    /**
+     * The HTTP request.
+     * 
+     * @since 2.2.0
+     */
     protected final HttpServletRequest request;
 
+    /**
+     * The logging object.
+     */
     private Log log = LogFactory.getLog(getClass());
 
+    /**
+     * Constructor.
+     * 
+     * @param velocityContext The Velocity context.
+     * @param params The parameters used in the current tool call.
+     * @param response The HTTP response.
+     * @param request The HTTP request.
+     * @since 2.2.0
+     */
     public AbstractDefaultToStringRenderable(Context velocityContext,
             Map<String, Object> params, HttpServletResponse response,
             HttpServletRequest request) {
@@ -36,9 +98,7 @@
         this.request = request;
     }
 
-    /* (non-Javadoc)
-     * @see java.lang.Object#toString()
-     */
+    /** {@inheritDoc} */
     @Override
     public String toString() {
         StringWriter writer = new StringWriter();

Modified: tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/AddAttributeVModel.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/AddAttributeVModel.java?rev=756241&r1=756240&r2=756241&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/AddAttributeVModel.java (original)
+++ tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/AddAttributeVModel.java Thu Mar 19 22:38:17 2009
@@ -1,3 +1,24 @@
+/*
+ * $Id$
+ *
+ * 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.
+ */
+
 package org.apache.tiles.velocity.template;
 
 import java.util.Map;
@@ -11,14 +32,33 @@
 import org.apache.velocity.context.Context;
 import org.apache.velocity.runtime.Renderable;
 
+/**
+ * Wraps {@link AddAttributeModel} to be used in Velocity. For the list of
+ * parameters, see {@link AddAttributeModel#start(java.util.Stack)},
+ * {@link AddAttributeModel#end(java.util.Stack, Object, String, String, String, String)}
+ * and {@link AddAttributeModel#execute(java.util.Stack, Object, String, String, String, String)}
+ * 
+ * @version $Rev$ $Date$
+ * @since 2.2.0
+ */
 public class AddAttributeVModel implements Executable, BodyExecutable {
 
+    /**
+     * The template model.
+     */
     private AddAttributeModel model;
 
+    /**
+     * Constructor.
+     * 
+     * @param model The template model.
+     * @since 2.2.0
+     */
     public AddAttributeVModel(AddAttributeModel model) {
         this.model = model;
     }
 
+    /** {@inheritDoc} */
     public Renderable execute(HttpServletRequest request,
             HttpServletResponse response, Context velocityContext,
             Map<String, Object> params) {
@@ -29,6 +69,7 @@
         return VelocityUtil.EMPTY_RENDERABLE;
     }
 
+    /** {@inheritDoc} */
     public Renderable end(HttpServletRequest request, HttpServletResponse response,
             Context velocityContext) {
         Map<String, Object> params = VelocityUtil.getParameterStack(
@@ -39,10 +80,10 @@
         return VelocityUtil.EMPTY_RENDERABLE;
     }
 
+    /** {@inheritDoc} */
     public void start(HttpServletRequest request, HttpServletResponse response,
             Context velocityContext, Map<String, Object> params) {
         VelocityUtil.getParameterStack(velocityContext).push(params);
         model.start(ServletUtil.getComposeStack(request));
     }
-
 }

Modified: tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/AddListAttributeVModel.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/AddListAttributeVModel.java?rev=756241&r1=756240&r2=756241&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/AddListAttributeVModel.java (original)
+++ tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/AddListAttributeVModel.java Thu Mar 19 22:38:17 2009
@@ -1,3 +1,24 @@
+/*
+ * $Id$
+ *
+ * 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.
+ */
+
 package org.apache.tiles.velocity.template;
 
 import java.util.Map;
@@ -11,23 +32,42 @@
 import org.apache.velocity.context.Context;
 import org.apache.velocity.runtime.Renderable;
 
+/**
+ * Wraps {@link AddListAttributeModel} to be used in Velocity. For the list of
+ * parameters, see
+ * {@link AddListAttributeModel#start(java.util.Stack, String)}
+ * and {@link AddListAttributeModel#end(java.util.Stack)}.
+ * 
+ * @version $Rev$ $Date$
+ * @since 2.2.0
+ */
 public class AddListAttributeVModel implements BodyExecutable {
 
+    /**
+     * The template model.
+     */
     private AddListAttributeModel model;
     
+    /**
+     * Constructor.
+     * 
+     * @param model The template model.
+     * @since 2.2.0
+     */
     public AddListAttributeVModel(AddListAttributeModel model) {
         this.model = model;
     }
     
+    /** {@inheritDoc} */
     public Renderable end(HttpServletRequest request, HttpServletResponse response,
             Context velocityContext) {
         model.end(ServletUtil.getComposeStack(request));
         return VelocityUtil.EMPTY_RENDERABLE;
     }
 
+    /** {@inheritDoc} */
     public void start(HttpServletRequest request, HttpServletResponse response,
             Context velocityContext, Map<String, Object> params) {
         model.start(ServletUtil.getComposeStack(request), (String) params.get("role"));
     }
-
 }

Modified: tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/BodyExecutable.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/BodyExecutable.java?rev=756241&r1=756240&r2=756241&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/BodyExecutable.java (original)
+++ tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/BodyExecutable.java Thu Mar 19 22:38:17 2009
@@ -1,3 +1,24 @@
+/*
+ * $Id$
+ *
+ * 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.
+ */
+
 package org.apache.tiles.velocity.template;
 
 import java.util.Map;
@@ -8,29 +29,34 @@
 import org.apache.velocity.context.Context;
 import org.apache.velocity.runtime.Renderable;
 
-
-
+/**
+ * It represents an object that can be executed, with a body with "start" and
+ * "end" operation, under a Velocity+Servlet context.
+ * 
+ * @version $Rev$ $Date$
+ * @since 2.2.0
+ */
 public interface BodyExecutable {
 
     /**
-     * Returns a string representation of attribute value. If the attribute is
-     * <code>null</code> or if the attribute value is <code>null</code>,
-     * <code>null</code> is returned
-     * @param request TODO
-     * @param response TODO
-     * @param velocityContext TODO
+     * Starts the execution of the commands.
+     * 
+     * @param request The HTTP request.
+     * @param response The HTTP response-
+     * @param velocityContext The Velocity context.
+     * @param params The map of the parameters.
+     * @since 2.2.0
      */
     void start(HttpServletRequest request, HttpServletResponse response, Context velocityContext, Map<String, Object> params);
 
     /**
-     * Returns a string representation of attribute value. If the attribute is
-     * <code>null</code> or if the attribute value is <code>null</code>,
-     * <code>null</code> is returned
-     * @param request TODO
-     * @param response TODO
-     * @param velocityContext TODO
-     * @return TODO
+     * Ends the execution of the commands.
+     * 
+     * @param request The HTTP request.
+     * @param response The HTTP response-
+     * @param velocityContext The Velocity context.
+     * @return A renderable object. It does not necessary render anything.
+     * @since 2.2.0
      */
     Renderable end(HttpServletRequest request, HttpServletResponse response, Context velocityContext);
-
 }
\ No newline at end of file

Modified: tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/ContextHolder.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/ContextHolder.java?rev=756241&r1=756240&r2=756241&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/ContextHolder.java (original)
+++ tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/ContextHolder.java Thu Mar 19 22:38:17 2009
@@ -1,3 +1,24 @@
+/*
+ * $Id$
+ *
+ * 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.
+ */
+
 package org.apache.tiles.velocity.template;
 
 import javax.servlet.ServletContext;
@@ -6,17 +27,41 @@
 
 import org.apache.velocity.context.Context;
 
+/**
+ * An object that holds the current state of Velocity in a Servlet environment.
+ * 
+ * @version $Rev$ $Date$
+ * @since 2.2.0
+ */
 public class ContextHolder {
 
+    /**
+     * The Velocity context.
+     */
     private Context velocityContext;
+    
+    /**
+     * The HTTP request.
+     */
     private HttpServletRequest request;
+    
+    /**
+     * The HTTP response.
+     */
     private HttpServletResponse response;
+    
+    /**
+     * The servlet context.
+     */
     private ServletContext application;
 
     /**
      * Sets the current {@link HttpServletRequest}. This is required for this
      * tool to operate and will throw a NullPointerException if this is not set
      * or is set to {@code null}.
+     * 
+     * @param request The HTTP request.
+     * @since 2.2.0
      */
     public void setRequest(HttpServletRequest request) {
         if (request == null) {
@@ -29,6 +74,9 @@
      * Sets the current {@link HttpServletResponse}. This is required for this
      * tool to operate and will throw a NullPointerException if this is not set
      * or is set to {@code null}.
+     * 
+     * @param response The HTTP response.
+     * @since 2.2.0
      */
     public void setResponse(HttpServletResponse response) {
         if (response == null) {
@@ -41,6 +89,9 @@
      * Sets the {@link ServletContext}. This is required for this tool to
      * operate and will throw a NullPointerException if this is not set or is
      * set to {@code null}.
+     * 
+     * @param application The Servlet context.
+     * @since 2.2.0
      */
     public void setServletContext(ServletContext application) {
         if (application == null) {
@@ -50,10 +101,12 @@
     }
 
     /**
-     * Initializes this tool.
+     * Sets the Velocity {@link Context}. This is required for this tool to
+     * operate and will throw a NullPointerException if this is not set or is
+     * set to {@code null}.
      * 
-     * @param context the current {@link Context}
-     * @throws IllegalArgumentException if the param is not a {@link Context}
+     * @param context The Velocity context.
+     * @since 2.2.0
      */
     public void setVelocityContext(Context context) {
         if (context == null) {
@@ -63,18 +116,42 @@
         this.velocityContext = context;
     }
 
+    /**
+     * Returns the HTTP request.
+     * 
+     * @return The HTTP request.
+     * @since 2.2.0
+     */
     protected HttpServletRequest getRequest() {
         return request;
     }
 
+    /**
+     * Returns the HTTP response.
+     * 
+     * @return The HTTP response.
+     * @since 2.2.0
+     */
     protected HttpServletResponse getResponse() {
         return response;
     }
 
+    /**
+     * Returns the Servlet context.
+     * 
+     * @return The Servlet context..
+     * @since 2.2.0
+     */
     protected ServletContext getServletContext() {
         return application;
     }
 
+    /**
+     * Returns the Velocity context..
+     * 
+     * @return The Velocity context.
+     * @since 2.2.0
+     */
     protected Context getVelocityContext() {
         return velocityContext;
     }

Modified: tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/DefinitionVModel.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/DefinitionVModel.java?rev=756241&r1=756240&r2=756241&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/DefinitionVModel.java (original)
+++ tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/DefinitionVModel.java Thu Mar 19 22:38:17 2009
@@ -1,3 +1,24 @@
+/*
+ * $Id$
+ *
+ * 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.
+ */
+
 package org.apache.tiles.velocity.template;
 
 import java.util.Map;
@@ -8,22 +29,47 @@
 
 import org.apache.tiles.mgmt.MutableTilesContainer;
 import org.apache.tiles.servlet.context.ServletUtil;
+import org.apache.tiles.template.AddListAttributeModel;
 import org.apache.tiles.template.DefinitionModel;
 import org.apache.tiles.velocity.context.VelocityUtil;
 import org.apache.velocity.context.Context;
 import org.apache.velocity.runtime.Renderable;
 
+/**
+ * Wraps {@link DefinitionModel} to be used in Velocity. For the list of
+ * parameters, see
+ * {@link DefinitionModel#start(java.util.Stack, String, String, String, String, String)}
+ * , {@link AddListAttributeModel#end(java.util.Stack)} and
+ * {@link DefinitionModel#execute(MutableTilesContainer, java.util.Stack, String, String, String, String, String, Object...)}.
+ * 
+ * @version $Rev$ $Date$
+ * @since 2.2.0
+ */
 public class DefinitionVModel implements Executable, BodyExecutable {
 
+    /**
+     * The template model.
+     */
     private DefinitionModel model;
 
+    /**
+     * The Servlet context.
+     */
     private ServletContext servletContext;
 
+    /**
+     * Constructor.
+     * 
+     * @param model The template model.
+     * @param servletContext The servlet context.
+     * @since 2.2.0
+     */
     public DefinitionVModel(DefinitionModel model, ServletContext servletContext) {
         this.model = model;
         this.servletContext = servletContext;
     }
 
+    /** {@inheritDoc} */
     public Renderable execute(HttpServletRequest request,
             HttpServletResponse response, Context velocityContext,
             Map<String, Object> params) {
@@ -37,17 +83,20 @@
         return VelocityUtil.EMPTY_RENDERABLE;
     }
 
-    public Renderable end(HttpServletRequest request, HttpServletResponse response,
-            Context velocityContext) {
+    /** {@inheritDoc} */
+    public Renderable end(HttpServletRequest request,
+            HttpServletResponse response, Context velocityContext) {
         Map<String, Object> params = VelocityUtil.getParameterStack(
                 velocityContext).pop();
-        model.end((MutableTilesContainer) ServletUtil.getCurrentContainer(
-                request, servletContext), ServletUtil
-                .getComposeStack(request), (String) params.get("name"),
-                velocityContext, request, response);
+        model
+                .end((MutableTilesContainer) ServletUtil.getCurrentContainer(
+                        request, servletContext), ServletUtil
+                        .getComposeStack(request), (String) params.get("name"),
+                        velocityContext, request, response);
         return VelocityUtil.EMPTY_RENDERABLE;
     }
 
+    /** {@inheritDoc} */
     public void start(HttpServletRequest request, HttpServletResponse response,
             Context velocityContext, Map<String, Object> params) {
         VelocityUtil.getParameterStack(velocityContext).push(params);

Modified: tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/Executable.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/Executable.java?rev=756241&r1=756240&r2=756241&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/Executable.java (original)
+++ tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/Executable.java Thu Mar 19 22:38:17 2009
@@ -1,3 +1,24 @@
+/*
+ * $Id$
+ *
+ * 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.
+ */
+
 package org.apache.tiles.velocity.template;
 
 import java.util.Map;
@@ -8,19 +29,23 @@
 import org.apache.velocity.context.Context;
 import org.apache.velocity.runtime.Renderable;
 
-
-
+/**
+ * It represents an object that can be executed under a Velocity+Servlet context.
+ * 
+ * @version $Rev$ $Date$
+ * @since 2.2.0
+ */
 public interface Executable {
 
     /**
-     * Returns a string representation of attribute value. If the attribute is
-     * <code>null</code> or if the attribute value is <code>null</code>,
-     * <code>null</code> is returned
-     * @param request TODO
-     * @param response TODO
-     * @param velocityContext TODO
-     * @return TODO
+     * Executes the command.
+     * 
+     * @param request The HTTP request.
+     * @param response The HTTP response-
+     * @param velocityContext The Velocity context.
+     * @param params The map of the parameters.
+     * @return A renderable object. It does not necessary render anything.
+     * @since 2.2.0
      */
     Renderable execute(HttpServletRequest request, HttpServletResponse response, Context velocityContext, Map<String, Object> params);
-
 }
\ No newline at end of file

Modified: tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/GetAsStringVModel.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/GetAsStringVModel.java?rev=756241&r1=756240&r2=756241&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/GetAsStringVModel.java (original)
+++ tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/GetAsStringVModel.java Thu Mar 19 22:38:17 2009
@@ -1,3 +1,24 @@
+/*
+ * $Id$
+ *
+ * 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.
+ */
+
 package org.apache.tiles.velocity.template;
 
 import java.io.IOException;
@@ -20,18 +41,42 @@
 import org.apache.velocity.exception.ResourceNotFoundException;
 import org.apache.velocity.runtime.Renderable;
 
+/**
+ * Wraps {@link GetAsStringModel} to be used in Velocity. For the list of
+ * parameters, see
+ * {@link GetAsStringModel#start(java.util.Stack, TilesContainer, boolean, String, String, Object, String, String, String, Attribute, Object...)}
+ * , {@link GetAsStringModel#end(java.util.Stack, TilesContainer, Writer, boolean, Object...)} and
+ * {@link GetAsStringModel#execute(TilesContainer, Writer, boolean, String, String, Object, String, String, String, Attribute, Object...)}.
+ * 
+ * @version $Rev$ $Date$
+ * @since 2.2.0
+ */
 public class GetAsStringVModel implements Executable, BodyExecutable {
 
+    /**
+     * The template model.
+     */
     private GetAsStringModel model;
 
+    /**
+     * The Servlet context.
+     */
     private ServletContext servletContext;
 
+    /**
+     * Constructor.
+     * 
+     * @param model The template model.
+     * @param servletContext The servlet context.
+     * @since 2.2.0
+     */
     public GetAsStringVModel(GetAsStringModel model,
             ServletContext servletContext) {
         this.model = model;
         this.servletContext = servletContext;
     }
 
+    /** {@inheritDoc} */
     public Renderable execute(HttpServletRequest request,
             HttpServletResponse response, Context velocityContext,
             Map<String, Object> params) {
@@ -57,6 +102,7 @@
         };
     }
 
+    /** {@inheritDoc} */
     public void start(HttpServletRequest request, HttpServletResponse response,
             Context velocityContext, Map<String, Object> params) {
         VelocityUtil.getParameterStack(velocityContext).push(params);
@@ -71,6 +117,7 @@
                 response);
     }
 
+    /** {@inheritDoc} */
     public Renderable end(HttpServletRequest request, HttpServletResponse response,
             Context velocityContext) {
         Map<String, Object> params = VelocityUtil.getParameterStack(

Modified: tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/ImportAttributeVModel.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/ImportAttributeVModel.java?rev=756241&r1=756240&r2=756241&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/ImportAttributeVModel.java (original)
+++ tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/ImportAttributeVModel.java Thu Mar 19 22:38:17 2009
@@ -1,3 +1,24 @@
+/*
+ * $Id$
+ *
+ * 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.
+ */
+
 package org.apache.tiles.velocity.template;
 
 import java.io.IOException;
@@ -8,6 +29,7 @@
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import org.apache.tiles.TilesContainer;
 import org.apache.tiles.servlet.context.ServletUtil;
 import org.apache.tiles.template.ImportAttributeModel;
 import org.apache.tiles.velocity.context.VelocityUtil;
@@ -18,18 +40,40 @@
 import org.apache.velocity.exception.ResourceNotFoundException;
 import org.apache.velocity.runtime.Renderable;
 
+/**
+ * Wraps {@link ImportAttributeModel} to be used in Velocity. For the list of
+ * parameters, see
+ * {@link ImportAttributeModel#getImportedAttributes(TilesContainer, String, String, boolean, Object...)}.
+ * 
+ * @version $Rev$ $Date$
+ * @since 2.2.0
+ */
 public class ImportAttributeVModel implements Executable {
 
+    /**
+     * The template model.
+     */
     private ImportAttributeModel model;
 
+    /**
+     * The Servlet context.
+     */
     private ServletContext servletContext;
 
+    /**
+     * Constructor.
+     * 
+     * @param model The template model.
+     * @param servletContext The servlet context.
+     * @since 2.2.0
+     */
     public ImportAttributeVModel(ImportAttributeModel model,
             ServletContext servletContext) {
         this.model = model;
         this.servletContext = servletContext;
     }
 
+    /** {@inheritDoc} */
     public Renderable execute(HttpServletRequest request,
             HttpServletResponse response, Context velocityContext,
             Map<String, Object> params) {
@@ -57,5 +101,4 @@
             }
         };
     }
-
 }

Modified: tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/InsertAttributeVModel.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/InsertAttributeVModel.java?rev=756241&r1=756240&r2=756241&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/InsertAttributeVModel.java (original)
+++ tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/InsertAttributeVModel.java Thu Mar 19 22:38:17 2009
@@ -1,3 +1,24 @@
+/*
+ * $Id$
+ *
+ * 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.
+ */
+
 package org.apache.tiles.velocity.template;
 
 import java.io.IOException;
@@ -9,6 +30,7 @@
 import javax.servlet.http.HttpServletResponse;
 
 import org.apache.tiles.Attribute;
+import org.apache.tiles.TilesContainer;
 import org.apache.tiles.servlet.context.ServletUtil;
 import org.apache.tiles.template.InsertAttributeModel;
 import org.apache.tiles.velocity.context.VelocityUtil;
@@ -19,18 +41,42 @@
 import org.apache.velocity.exception.ResourceNotFoundException;
 import org.apache.velocity.runtime.Renderable;
 
+/**
+ * Wraps {@link InsertAttributeModel} to be used in Velocity. For the list of
+ * parameters, see
+ * {@link InsertAttributeModel#start(java.util.Stack, TilesContainer, boolean, String, String, Object, String, String, String, Attribute, Object...)}
+ * , {@link InsertAttributeModel#end(java.util.Stack, TilesContainer, boolean, Object...)} and
+ * {@link InsertAttributeModel#execute(TilesContainer, boolean, String, String, Object, String, String, String, Attribute, Object...)}.
+ * 
+ * @version $Rev$ $Date$
+ * @since 2.2.0
+ */
 public class InsertAttributeVModel implements Executable, BodyExecutable {
 
+    /**
+     * The template model.
+     */
     private InsertAttributeModel model;
+
+    /**
+     * The Servlet context.
+     */
+    private ServletContext servletContext;
     
+    /**
+     * Constructor.
+     * 
+     * @param model The template model.
+     * @param servletContext The servlet context.
+     * @since 2.2.0
+     */
     public InsertAttributeVModel(InsertAttributeModel model,
             ServletContext servletContext) {
         this.model = model;
         this.servletContext = servletContext;
     }
-
-    private ServletContext servletContext;
     
+    /** {@inheritDoc} */
     public Renderable end(HttpServletRequest request, HttpServletResponse response,
             Context velocityContext) {
         Map<String, Object> params = VelocityUtil.getParameterStack(velocityContext).pop();
@@ -50,6 +96,7 @@
         };
     }
 
+    /** {@inheritDoc} */
     public void start(HttpServletRequest request, HttpServletResponse response,
             Context velocityContext, Map<String, Object> params) {
         VelocityUtil.getParameterStack(velocityContext).push(params);
@@ -62,6 +109,7 @@
         
     }
 
+    /** {@inheritDoc} */
     public Renderable execute(HttpServletRequest request,
             HttpServletResponse response, Context velocityContext,
             Map<String, Object> params) {
@@ -83,5 +131,4 @@
             }
         };
     }
-
 }

Modified: tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/InsertDefinitionVModel.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/InsertDefinitionVModel.java?rev=756241&r1=756240&r2=756241&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/InsertDefinitionVModel.java (original)
+++ tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/InsertDefinitionVModel.java Thu Mar 19 22:38:17 2009
@@ -1,3 +1,24 @@
+/*
+ * $Id$
+ *
+ * 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.
+ */
+
 package org.apache.tiles.velocity.template;
 
 import java.io.IOException;
@@ -18,18 +39,42 @@
 import org.apache.velocity.exception.ResourceNotFoundException;
 import org.apache.velocity.runtime.Renderable;
 
+/**
+ * Wraps {@link InsertDefinitionModel} to be used in Velocity. For the list of
+ * parameters, see
+ * {@link InsertDefinitionModel#start(org.apache.tiles.TilesContainer, Object...)}
+ * , {@link InsertDefinitionModel#end(org.apache.tiles.TilesContainer, String, String, String, String, Object...)} and
+ * {@link InsertDefinitionModel#execute(org.apache.tiles.TilesContainer, String, String, String, String, Object...)}.
+ * 
+ * @version $Rev$ $Date$
+ * @since 2.2.0
+ */
 public class InsertDefinitionVModel implements Executable, BodyExecutable {
     
+    /**
+     * The template model.
+     */
     private InsertDefinitionModel model;
 
+    /**
+     * The Servlet context.
+     */
     private ServletContext servletContext;
 
+    /**
+     * Constructor.
+     * 
+     * @param model The template model.
+     * @param servletContext The servlet context.
+     * @since 2.2.0
+     */
     public InsertDefinitionVModel(InsertDefinitionModel model,
             ServletContext servletContext) {
         this.model = model;
         this.servletContext = servletContext;
     }
 
+    /** {@inheritDoc} */
     public Renderable execute(HttpServletRequest request,
             HttpServletResponse response, Context velocityContext,
             Map<String, Object> params) {
@@ -47,6 +92,7 @@
         };
     }
 
+    /** {@inheritDoc} */
     public Renderable end(HttpServletRequest request, HttpServletResponse response,
             Context velocityContext) {
         Map<String, Object> params = VelocityUtil.getParameterStack(velocityContext).pop();
@@ -66,6 +112,7 @@
         };
     }
 
+    /** {@inheritDoc} */
     public void start(HttpServletRequest request, HttpServletResponse response,
             Context velocityContext, Map<String, Object> params) {
         VelocityUtil.getParameterStack(velocityContext).push(params);

Modified: tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/InsertTemplateVModel.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/InsertTemplateVModel.java?rev=756241&r1=756240&r2=756241&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/InsertTemplateVModel.java (original)
+++ tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/InsertTemplateVModel.java Thu Mar 19 22:38:17 2009
@@ -1,3 +1,24 @@
+/*
+ * $Id$
+ *
+ * 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.
+ */
+
 package org.apache.tiles.velocity.template;
 
 import java.io.IOException;
@@ -18,18 +39,42 @@
 import org.apache.velocity.exception.ResourceNotFoundException;
 import org.apache.velocity.runtime.Renderable;
 
+/**
+ * Wraps {@link InsertTemplateModel} to be used in Velocity. For the list of
+ * parameters, see
+ * {@link InsertTemplateModel#start(org.apache.tiles.TilesContainer, Object...)}
+ * , {@link InsertTemplateModel#end(org.apache.tiles.TilesContainer, String, String, String, Object...)} and
+ * {@link InsertTemplateModel#execute(org.apache.tiles.TilesContainer, String, String, String, Object...)}.
+ * 
+ * @version $Rev$ $Date$
+ * @since 2.2.0
+ */
 public class InsertTemplateVModel implements Executable, BodyExecutable {
 
+    /**
+     * The template model.
+     */
     private InsertTemplateModel model;
 
+    /**
+     * The Servlet context.
+     */
     private ServletContext servletContext;
 
+    /**
+     * Constructor.
+     * 
+     * @param model The template model.
+     * @param servletContext The servlet context.
+     * @since 2.2.0
+     */
     public InsertTemplateVModel(InsertTemplateModel model,
             ServletContext servletContext) {
         this.model = model;
         this.servletContext = servletContext;
     }
 
+    /** {@inheritDoc} */
     public Renderable execute(HttpServletRequest request,
             HttpServletResponse response, Context velocityContext,
             Map<String, Object> params) {
@@ -48,6 +93,7 @@
         };
     }
 
+    /** {@inheritDoc} */
     public Renderable end(HttpServletRequest request, HttpServletResponse response,
             Context velocityContext) {
         Map<String, Object> params = VelocityUtil.getParameterStack(
@@ -66,11 +112,11 @@
         };
     }
 
+    /** {@inheritDoc} */
     public void start(HttpServletRequest request, HttpServletResponse response,
             Context velocityContext, Map<String, Object> params) {
         VelocityUtil.getParameterStack(velocityContext).push(params);
         model.start(ServletUtil.getCurrentContainer(request, servletContext),
                 velocityContext, request, response);
     }
-
 }

Modified: tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/PutAttributeVModel.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/PutAttributeVModel.java?rev=756241&r1=756240&r2=756241&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/PutAttributeVModel.java (original)
+++ tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/PutAttributeVModel.java Thu Mar 19 22:38:17 2009
@@ -1,3 +1,24 @@
+/*
+ * $Id$
+ *
+ * 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.
+ */
+
 package org.apache.tiles.velocity.template;
 
 import java.util.Map;
@@ -12,18 +33,42 @@
 import org.apache.velocity.context.Context;
 import org.apache.velocity.runtime.Renderable;
 
+/**
+ * Wraps {@link PutAttributeModel} to be used in Velocity. For the list of
+ * parameters, see
+ * {@link PutAttributeModel#start(java.util.Stack)}
+ * , {@link PutAttributeModel#end(org.apache.tiles.TilesContainer, java.util.Stack, String, Object, String, String, String, String, boolean, Object...)} and
+ * {@link PutAttributeModel#execute(org.apache.tiles.TilesContainer, java.util.Stack, String, Object, String, String, String, String, boolean, Object...)}.
+ * 
+ * @version $Rev$ $Date$
+ * @since 2.2.0
+ */
 public class PutAttributeVModel implements Executable, BodyExecutable {
 
+    /**
+     * The template model.
+     */
     private PutAttributeModel model;
 
+    /**
+     * The Servlet context.
+     */
     private ServletContext servletContext;
     
+    /**
+     * Constructor.
+     * 
+     * @param model The template model.
+     * @param servletContext The servlet context.
+     * @since 2.2.0
+     */
     public PutAttributeVModel(PutAttributeModel model,
             ServletContext servletContext) {
         this.model = model;
         this.servletContext = servletContext;
     }
     
+    /** {@inheritDoc} */
     public Renderable execute(HttpServletRequest request,
             HttpServletResponse response, Context velocityContext,
             Map<String, Object> params) {
@@ -39,6 +84,7 @@
         return VelocityUtil.EMPTY_RENDERABLE;
     }
 
+    /** {@inheritDoc} */
     public Renderable end(HttpServletRequest request, HttpServletResponse response,
             Context velocityContext) {
         Map<String, Object> params = VelocityUtil.getParameterStack(
@@ -51,6 +97,7 @@
         return VelocityUtil.EMPTY_RENDERABLE;
     }
 
+    /** {@inheritDoc} */
     public void start(HttpServletRequest request, HttpServletResponse response,
             Context velocityContext, Map<String, Object> params) {
         VelocityUtil.getParameterStack(velocityContext).push(params);

Modified: tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/PutListAttributeVModel.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/PutListAttributeVModel.java?rev=756241&r1=756240&r2=756241&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/PutListAttributeVModel.java (original)
+++ tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/PutListAttributeVModel.java Thu Mar 19 22:38:17 2009
@@ -1,3 +1,24 @@
+/*
+ * $Id$
+ *
+ * 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.
+ */
+
 package org.apache.tiles.velocity.template;
 
 import java.util.Map;
@@ -12,18 +33,41 @@
 import org.apache.velocity.context.Context;
 import org.apache.velocity.runtime.Renderable;
 
+/**
+ * Wraps {@link PutListAttributeModel} to be used in Velocity. For the list of
+ * parameters, see
+ * {@link PutListAttributeModel#start(java.util.Stack, String, boolean)}
+ * AND {@link PutListAttributeModel#end(org.apache.tiles.TilesContainer, java.util.Stack, String, boolean, Object...)}.
+ * 
+ * @version $Rev$ $Date$
+ * @since 2.2.0
+ */
 public class PutListAttributeVModel implements BodyExecutable {
 
+    /**
+     * The template model.
+     */
     private PutListAttributeModel model;
 
+    /**
+     * The Servlet context.
+     */
     private ServletContext servletContext;
 
+    /**
+     * Constructor.
+     * 
+     * @param model The template model.
+     * @param servletContext The servlet context.
+     * @since 2.2.0
+     */
     public PutListAttributeVModel(PutListAttributeModel model,
             ServletContext servletContext) {
         this.model = model;
         this.servletContext = servletContext;
     }
 
+    /** {@inheritDoc} */
     public Renderable end(HttpServletRequest request, HttpServletResponse response,
             Context velocityContext) {
         Map<String, Object> params = VelocityUtil.getParameterStack(
@@ -36,6 +80,7 @@
         return VelocityUtil.EMPTY_RENDERABLE;
     }
 
+    /** {@inheritDoc} */
     public void start(HttpServletRequest request, HttpServletResponse response,
             Context velocityContext, Map<String, Object> params) {
         VelocityUtil.getParameterStack(velocityContext).push(params);

Modified: tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/Tiles2Tool.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/Tiles2Tool.java?rev=756241&r1=756240&r2=756241&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/Tiles2Tool.java (original)
+++ tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/Tiles2Tool.java Thu Mar 19 22:38:17 2009
@@ -18,9 +18,9 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+
 package org.apache.tiles.velocity.template;
 
-import java.io.IOException;
 import java.util.Map;
 
 import org.apache.tiles.Attribute;
@@ -30,123 +30,269 @@
 import org.apache.velocity.runtime.Renderable;
 
 /**
+ * The Tiles tool to be used in Velocity templates. Most of the methods can be used in two ways:
+ * <ul>
+ * <li>calling methods that accept a map of parameters: executes immediately the required model;</li>
+ * <li>calling methods without parameters: useful to include composition code inside a block.
+ * You need to call then {@link #start(Map)}, then your code in the block, and then {@link #end()}.</li>
+ * </ul>
  * 
- * @author SergeyZ
- * 
+ * @version $Rev$ $Date$
+ * @since 2.2.0
  */
 public class Tiles2Tool extends ContextHolder {
 
+    /**
+     * The key of the attribute that will be used to store the repository of "models".
+     */
     private static final String TILES_VELOCITY_REPOSITORY_KEY = "org.apache.tiles.velocity.TilesVelocityRepository";
     
+    /**
+     * The current executable object to use. Set in {@link #start(Map)} and used in {@link #end()}.
+     */
     private BodyExecutable currentExecutable;
     
+    /**
+     * The repository of Tiles+Velocity models.
+     */
     private TilesVelocityRepository repository;
     
-    public Tiles2Tool() {
-        System.out.println("Hello");
-    }
-    
+    /**
+     * Executes the {@link AddAttributeVModel}.
+     * 
+     * @param params The map of parameters.
+     * @return The tool itself.
+     * @since 2.2.0
+     * @see org.apache.tiles.template.AddAttributeModel
+     */
     public Tiles2Tool addAttribute(Map<String, Object> params) {
         execute(getRepository().getAddAttribute(), params);
         return this;
     }
-    
+
+    /**
+     * Prepares the {@link AddAttributeVModel} for the execution with a block
+     * inside {@link #start(Map)} and {@link #end()} calls.
+     * 
+     * @return The tool itself.
+     * @since 2.2.0
+     * @see org.apache.tiles.template.AddAttributeModel
+     */
     public Tiles2Tool addAttribute() {
         currentExecutable = getRepository().getAddAttribute();
         return this;
     }
     
+    /**
+     * Prepares the {@link AddListAttributeVModel} for the execution with a block
+     * inside {@link #start(Map)} and {@link #end()} calls.
+     * 
+     * @return The tool itself.
+     * @since 2.2.0
+     * @see org.apache.tiles.template.AddListAttributeModel
+     */
     public Tiles2Tool addListAttribute() {
         currentExecutable = getRepository().getAddListAttribute();
         return this;
     }
     
+    /**
+     * Executes the {@link DefinitionVModel}.
+     * 
+     * @param params The map of parameters.
+     * @return The tool itself.
+     * @since 2.2.0
+     * @see org.apache.tiles.template.DefinitionModel
+     */
     public Tiles2Tool definition(Map<String, Object> params) {
         execute(getRepository().getDefinition(), params);
         return this;
     }
     
+    /**
+     * Prepares the {@link DefinitionVModel} for the execution with a block
+     * inside {@link #start(Map)} and {@link #end()} calls.
+     * 
+     * @return The tool itself.
+     * @since 2.2.0
+     * @see org.apache.tiles.template.DefinitionModel
+     */
     public Tiles2Tool definition() {
         currentExecutable = getRepository().getDefinition();
         return this;
     }
 
     /**
-     * Returns a string representation of attribute value. If the attribute is
-     * <code>null</code> or if the attribute value is <code>null</code>,
-     * <code>null</code> is returned
+     * Executes the {@link GetAsStringVModel}.
      * 
-     * @throws IOException If something goes wrong.
+     * @param params The map of parameters.
+     * @return A renderable object that renders an attribute as a string.
+     * @since 2.2.0
+     * @see org.apache.tiles.template.GetAsStringModel
      */
-    public Renderable getAsString(Map<String, Object> params)
-            throws IOException {
+    public Renderable getAsString(Map<String, Object> params) {
         return execute(getRepository().getGetAsString(), params);
     }
 
     /**
-     * Returns a string representation of attribute value. If the attribute is
-     * <code>null</code> or if the attribute value is <code>null</code>,
-     * <code>null</code> is returned
+     * Prepares the {@link GetAsStringVModel} for the execution with a block
+     * inside {@link #start(Map)} and {@link #end()} calls.
      * 
-     * @throws IOException If something goes wrong.
+     * @return The tool itself.
+     * @since 2.2.0
+     * @see org.apache.tiles.template.GetAsStringModel
      */
     public Tiles2Tool getAsString() {
         currentExecutable = getRepository().getGetAsString();
         return this;
     }
     
+    /**
+     * Executes the {@link ImportAttributeVModel}.
+     * 
+     * @param params The map of parameters.
+     * @return A renderable object that does not write anything, but imports attribute values when invoked.
+     * @since 2.2.0
+     * @see org.apache.tiles.template.ImportAttributeModel
+     */
     public Renderable importAttribute(Map<String, Object> params) {
         return execute(getRepository().getImportAttribute(), params);
     }
     
+    /**
+     * Executes the {@link InsertAttributeVModel}.
+     * 
+     * @param params The map of parameters.
+     * @return A renderable object that renders an attribute.
+     * @since 2.2.0
+     * @see org.apache.tiles.template.InsertAttributeModel
+     */
     public Renderable insertAttribute(Map<String, Object> params) {
         return execute(getRepository().getInsertAttribute(), params);
     }
     
+    /**
+     * Prepares the {@link InsertAttributeVModel} for the execution with a block
+     * inside {@link #start(Map)} and {@link #end()} calls.
+     * 
+     * @return The tool itself.
+     * @since 2.2.0
+     * @see org.apache.tiles.template.InsertAttributeModel
+     */
     public Tiles2Tool insertAttribute() {
         currentExecutable = getRepository().getInsertAttribute();
         return this;
     }
     
+    /**
+     * Executes the {@link InsertDefinitionVModel}.
+     * 
+     * @param params The map of parameters.
+     * @return A renderable object that renders a definition.
+     * @since 2.2.0
+     * @see org.apache.tiles.template.InsertDefinitionModel
+     */
     public Renderable insertDefinition(Map<String, Object> params) {
         return execute(getRepository().getInsertDefinition(), params);
     }
     
+    /**
+     * Prepares the {@link InsertDefinitionVModel} for the execution with a block
+     * inside {@link #start(Map)} and {@link #end()} calls.
+     * 
+     * @return The tool itself.
+     * @since 2.2.0
+     * @see org.apache.tiles.template.InsertDefinitionModel
+     */
     public Tiles2Tool insertDefinition() {
         currentExecutable = getRepository().getInsertDefinition();
         return this;
     }
     
+    /**
+     * Executes the {@link InsertTemplateVModel}.
+     * 
+     * @param params The map of parameters.
+     * @return A renderable object that renders a template.
+     * @since 2.2.0
+     * @see org.apache.tiles.template.InsertTemplateModel
+     */
     public Renderable insertTemplate(Map<String, Object> params) {
         return execute(getRepository().getInsertTemplate(), params);
     }
     
+    /**
+     * Prepares the {@link InsertTemplateVModel} for the execution with a block
+     * inside {@link #start(Map)} and {@link #end()} calls.
+     * 
+     * @return The tool itself.
+     * @since 2.2.0
+     * @see org.apache.tiles.template.InsertTemplateModel
+     */
     public Tiles2Tool insertTemplate() {
         currentExecutable = getRepository().getInsertTemplate();
         return this;
     }
     
+    /**
+     * Executes the {@link PutAttributeVModel}.
+     * 
+     * @param params The map of parameters.
+     * @return The tool itself.
+     * @since 2.2.0
+     * @see org.apache.tiles.template.PutAttributeModel
+     */
     public Tiles2Tool putAttribute(Map<String, Object> params) {
         execute(getRepository().getPutAttribute(), params);
         return this;
     }
     
+    /**
+     * Prepares the {@link PutAttributeVModel} for the execution with a block
+     * inside {@link #start(Map)} and {@link #end()} calls.
+     * 
+     * @return The tool itself.
+     * @since 2.2.0
+     * @see org.apache.tiles.template.PutAttributeModel
+     */
     public Tiles2Tool putAttribute() {
         currentExecutable = getRepository().getPutAttribute();
         return this;
     }
     
+    /**
+     * Prepares the {@link PutListAttributeVModel} for the execution with a block
+     * inside {@link #start(Map)} and {@link #end()} calls.
+     * 
+     * @return The tool itself.
+     * @since 2.2.0
+     * @see org.apache.tiles.template.PutListAttributeModel
+     */
     public Tiles2Tool putListAttribute() {
         currentExecutable = getRepository().getPutListAttribute();
         return this;
     }
     
+    /**
+     * Sets the current container for the current request.
+     * 
+     * @param containerKey The key of the container to set as "current" for the current request.
+     * @return The tool itself.
+     * @since 2.2.0
+     */
     public Tiles2Tool setCurrentContainer(String containerKey) {
         ServletUtil.setCurrentContainer(getRequest(), getServletContext(),
                 containerKey);
         return this;
     }
     
+    /**
+     * Starts a "model" for the execution in a block.
+     * 
+     * @param params The map of parameters.
+     * @return The tool itself.
+     * @since 2.2.0
+     */
     public Tiles2Tool start(Map<String, Object> params) {
         if (currentExecutable == null) {
             throw new NullPointerException("The current model to start has not been set");
@@ -154,7 +300,14 @@
         currentExecutable.start(getRequest(), getResponse(), getVelocityContext(), params);
         return this;
     }
-    
+
+    /**
+     * Ends a "model" after the execution of a block.
+     * 
+     * @return A renderable object. It can render actually something, or execute
+     * code needed to the execution of parent models.
+     * @since 2.2.0
+     */
     public Renderable end() {
         if (currentExecutable == null) {
             throw new NullPointerException("The current model to start has not been set");
@@ -165,6 +318,13 @@
         return retValue;
     }
 
+    /**
+     * Returns an attribute.
+     * 
+     * @param key The name of the attribute to get.
+     * @return The Attribute.
+     * @since 2.2.0
+     */
     public Attribute getAttribute(String key) {
         TilesContainer container = ServletUtil.getCurrentContainer(
                 getRequest(), getServletContext());
@@ -174,11 +334,17 @@
         return attribute;
     }
 
+    /** {@inheritDoc} */
     @Override
     public String toString() {
         return "";
     }
 
+    /**
+     * Gets or creates the Tiles+Velocity model repository from the servlet context.
+     * 
+     * @return The model repository.
+     */
     private TilesVelocityRepository getRepository() {
         if (repository != null) {
             return repository;
@@ -194,6 +360,14 @@
         return repository;
     }
     
+    /**
+     * Executes an "executable" model.
+     * 
+     * @param executable The object to execute.
+     * @param params The parameters map.
+     * @return A renderable object. It can render actually something, or execute
+     * code needed to the execution of parent models.
+     */
     private Renderable execute(Executable executable, Map<String, Object> params) {
         return executable.execute(getRequest(), getResponse(), getVelocityContext(), params);
     }

Modified: tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/TilesVelocityRepository.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/TilesVelocityRepository.java?rev=756241&r1=756240&r2=756241&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/TilesVelocityRepository.java (original)
+++ tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/TilesVelocityRepository.java Thu Mar 19 22:38:17 2009
@@ -1,3 +1,24 @@
+/*
+ * $Id$
+ *
+ * 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.
+ */
+
 package org.apache.tiles.velocity.template;
 
 import javax.servlet.ServletContext;
@@ -15,28 +36,70 @@
 import org.apache.tiles.template.PutAttributeModel;
 import org.apache.tiles.template.PutListAttributeModel;
 
+/**
+ * Collects all Tiles+Velocity models.
+ * 
+ * @version $Rev$ $Date$
+ * @since 2.2.0
+ */
 public class TilesVelocityRepository {
 
+    /**
+     * The "addAttribute" model.
+     */
     private AddAttributeVModel addAttribute;
 
+    /**
+     * The "addListAttribute" model.
+     */
     private AddListAttributeVModel addListAttribute;
 
+    /**
+     * The "definition" model.
+     */
     private DefinitionVModel definition;
 
+    /**
+     * The "getAsString" model.
+     */
     private GetAsStringVModel getAsString;
 
+    /**
+     * The "importAttribute" model.
+     */
     private ImportAttributeVModel importAttribute;
 
+    /**
+     * The "insertAttribute" model.
+     */
     private InsertAttributeVModel insertAttribute;
 
+    /**
+     * The "insertDefinition" model.
+     */
     private InsertDefinitionVModel insertDefinition;
 
+    /**
+     * The "insertTemplate" model.
+     */
     private InsertTemplateVModel insertTemplate;
 
+    /**
+     * The "putAttribute" model.
+     */
     private PutAttributeVModel putAttribute;
 
+    /**
+     * The "putListAttribute" model.
+     */
     private PutListAttributeVModel putListAttribute;
 
+    /**
+     * Constructor.
+     * 
+     * @param servletContext The servlet context.
+     * @since 2.2.0
+     */
     public TilesVelocityRepository(ServletContext servletContext) {
         AttributeResolver attributeResolver = new DefaultAttributeResolver();
 
@@ -60,42 +123,102 @@
                 new PutListAttributeModel(), servletContext);
     }
 
+    /**
+     * Returns the "addAttribute" model.
+     * 
+     * @return The model.
+     * @since 2.2.0
+     */
     public AddAttributeVModel getAddAttribute() {
         return addAttribute;
     }
 
+    /**
+     * Returns the "addListAttribute" model.
+     * 
+     * @return The model.
+     * @since 2.2.0
+     */
     public AddListAttributeVModel getAddListAttribute() {
         return addListAttribute;
     }
 
+    /**
+     * Returns the "definition" model.
+     * 
+     * @return The model.
+     * @since 2.2.0
+     */
     public DefinitionVModel getDefinition() {
         return definition;
     }
 
+    /**
+     * Returns the "getAsString" model.
+     * 
+     * @return The model.
+     * @since 2.2.0
+     */
     public GetAsStringVModel getGetAsString() {
         return getAsString;
     }
 
+    /**
+     * Returns the "importAttribute" model.
+     * 
+     * @return The model.
+     * @since 2.2.0
+     */
     public ImportAttributeVModel getImportAttribute() {
         return importAttribute;
     }
 
+    /**
+     * Returns the "insertAttribute" model.
+     * 
+     * @return The model.
+     * @since 2.2.0
+     */
     public InsertAttributeVModel getInsertAttribute() {
         return insertAttribute;
     }
 
+    /**
+     * Returns the "insertDefinition" model.
+     * 
+     * @return The model.
+     * @since 2.2.0
+     */
     public InsertDefinitionVModel getInsertDefinition() {
         return insertDefinition;
     }
 
+    /**
+     * Returns the "insertTemplate" model.
+     * 
+     * @return The model.
+     * @since 2.2.0
+     */
     public InsertTemplateVModel getInsertTemplate() {
         return insertTemplate;
     }
 
+    /**
+     * Returns the "putAttribute" model.
+     * 
+     * @return The model.
+     * @since 2.2.0
+     */
     public PutAttributeVModel getPutAttribute() {
         return putAttribute;
     }
 
+    /**
+     * Returns the "putListAttribute" model.
+     * 
+     * @return The model.
+     * @since 2.2.0
+     */
     public PutListAttributeVModel getPutListAttribute() {
         return putListAttribute;
     }