Author: apetrelli
Date: Wed Jan 20 19:58:12 2010
New Revision: 901355
URL: http://svn.apache.org/viewvc?rev=901355&view=rev
Log:
TILES-490
Added Javadocs to directives.
Added velocity.properties as a resource for future use.
Added:
tiles/framework/trunk/tiles-velocity/src/main/resources/META-INF/
tiles/framework/trunk/tiles-velocity/src/main/resources/META-INF/velocity.properties
(with props)
Modified:
tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/AddAttributeDirective.java
tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/AddListAttributeDirective.java
tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/BlockDirective.java
tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/BodyBlockDirective.java
tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/DefinitionDirective.java
tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/GetAsStringDirective.java
tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/ImportAttributeDirective.java
tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/InsertAttributeDirective.java
tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/InsertDefinitionDirective.java
tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/InsertTemplateDirective.java
tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/PutAttributeDirective.java
tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/PutListAttributeDirective.java
Modified:
tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/AddAttributeDirective.java
URL:
http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/AddAttributeDirective.java?rev=901355&r1=901354&r2=901355&view=diff
==============================================================================
---
tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/AddAttributeDirective.java
(original)
+++
tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/AddAttributeDirective.java
Wed Jan 20 19:58:12 2010
@@ -1,6 +1,26 @@
+/*
+ * $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;
import java.io.Writer;
import java.util.Map;
@@ -8,36 +28,44 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import org.apache.tiles.ArrayStack;
import org.apache.tiles.servlet.context.ServletUtil;
import org.apache.tiles.template.AddAttributeModel;
-import org.apache.tiles.velocity.context.VelocityUtil;
import org.apache.velocity.context.InternalContextAdapter;
-import org.apache.velocity.exception.MethodInvocationException;
-import org.apache.velocity.exception.ParseErrorException;
-import org.apache.velocity.exception.ResourceNotFoundException;
-import org.apache.velocity.runtime.parser.node.Node;
-import org.apache.velocity.tools.view.ViewContext;
+/**
+ * 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.2
+ */
public class AddAttributeDirective extends BodyBlockDirective {
+ /**
+ * The template model.
+ */
private AddAttributeModel model = new AddAttributeModel();
+ /** {...@inheritdoc} */
@Override
public String getName() {
return "tiles_addAttribute";
}
+ /** {...@inheritdoc} */
@Override
public void end(InternalContextAdapter context, Writer writer,
Map<String, Object> params, String body,
HttpServletRequest request, HttpServletResponse response,
- ServletContext servletContext) throws IOException {
+ ServletContext servletContext) {
model.end(ServletUtil.getComposeStack(request), params.get("value"),
(String) params
.get("expression"), body, (String) params.get("role"),
(String) params.get("type"));
}
+ /** {...@inheritdoc} */
@Override
public void start(InternalContextAdapter context, Writer writer,
Map<String, Object> params, HttpServletRequest request,
Modified:
tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/AddListAttributeDirective.java
URL:
http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/AddListAttributeDirective.java?rev=901355&r1=901354&r2=901355&view=diff
==============================================================================
---
tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/AddListAttributeDirective.java
(original)
+++
tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/AddListAttributeDirective.java
Wed Jan 20 19:58:12 2010
@@ -1,6 +1,26 @@
+/*
+ * $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;
import java.io.Writer;
import java.util.Map;
@@ -8,34 +28,41 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import org.apache.tiles.ArrayStack;
import org.apache.tiles.servlet.context.ServletUtil;
import org.apache.tiles.template.AddListAttributeModel;
-import org.apache.tiles.velocity.context.VelocityUtil;
import org.apache.velocity.context.InternalContextAdapter;
-import org.apache.velocity.exception.MethodInvocationException;
-import org.apache.velocity.exception.ParseErrorException;
-import org.apache.velocity.exception.ResourceNotFoundException;
-import org.apache.velocity.runtime.parser.node.Node;
-import org.apache.velocity.tools.view.ViewContext;
+/**
+ * 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.2
+ */
public class AddListAttributeDirective extends BlockDirective {
+ /**
+ * The template model.
+ */
private AddListAttributeModel model = new AddListAttributeModel();
+ /** {...@inheritdoc} */
@Override
public String getName() {
return "tiles_addListAttribute";
}
+ /** {...@inheritdoc} */
@Override
public void end(InternalContextAdapter context, Writer writer,
Map<String, Object> params, HttpServletRequest request,
- HttpServletResponse response, ServletContext servletContext)
- throws IOException {
+ HttpServletResponse response, ServletContext servletContext) {
model.end(ServletUtil.getComposeStack(request));
}
+ /** {...@inheritdoc} */
@Override
public void start(InternalContextAdapter context, Writer writer,
Map<String, Object> params, HttpServletRequest request,
Modified:
tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/BlockDirective.java
URL:
http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/BlockDirective.java?rev=901355&r1=901354&r2=901355&view=diff
==============================================================================
---
tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/BlockDirective.java
(original)
+++
tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/BlockDirective.java
Wed Jan 20 19:58:12 2010
@@ -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;
@@ -10,13 +31,17 @@
import org.apache.tiles.velocity.context.VelocityUtil;
import org.apache.velocity.context.InternalContextAdapter;
-import org.apache.velocity.exception.MethodInvocationException;
-import org.apache.velocity.exception.ParseErrorException;
-import org.apache.velocity.exception.ResourceNotFoundException;
import org.apache.velocity.runtime.directive.Directive;
import org.apache.velocity.runtime.parser.node.Node;
import org.apache.velocity.tools.view.ViewContext;
+/**
+ * Base abstract directive for those models who need to evaluate, but not use,
a
+ * body.
+ *
+ * @version $Rev$ $Date$
+ * @since 2.2.2
+ */
public abstract class BlockDirective extends Directive {
/** {...@inheritdoc} */
@@ -29,9 +54,8 @@
/** {...@inheritdoc} */
@Override
- public boolean render(InternalContextAdapter context, Writer writer, Node
node)
- throws IOException, ResourceNotFoundException, ParseErrorException,
- MethodInvocationException {
+ public boolean render(InternalContextAdapter context, Writer writer,
+ Node node) throws IOException {
ViewContext viewContext = (ViewContext) context
.getInternalUserContext();
Map<String, Object> params = VelocityUtil.getParameters(context, node);
@@ -44,12 +68,35 @@
return true;
}
- public abstract void start(InternalContextAdapter context, Writer writer,
+ /**
+ * Starts the directive, before evaluating the body.
+ *
+ * @param context The Velocity context.
+ * @param writer The writer user to write the result.
+ * @param params The parameters got from the first node of the directive.
+ * @param request The HTTP request.
+ * @param response The HTTP response.
+ * @param servletContext The servlet context.
+ * @since 2.2.2
+ */
+ protected abstract void start(InternalContextAdapter context, Writer
writer,
Map<String, Object> params, HttpServletRequest request,
HttpServletResponse response, ServletContext servletContext);
- public abstract void end(InternalContextAdapter context, Writer writer,
+ /**
+ * Ends the directive, after evaluating the body.
+ *
+ * @param context The Velocity context.
+ * @param writer The writer user to write the result.
+ * @param params The parameters got from the first node of the directive.
+ * @param request The HTTP request.
+ * @param response The HTTP response.
+ * @param servletContext The servlet context.
+ * @throws IOException If something goes wrong when finishing this
directive.
+ * @since 2.2.2
+ */
+ protected abstract void end(InternalContextAdapter context, Writer writer,
Map<String, Object> params, HttpServletRequest request,
HttpServletResponse response, ServletContext servletContext)
throws IOException;
-}
\ No newline at end of file
+}
Modified:
tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/BodyBlockDirective.java
URL:
http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/BodyBlockDirective.java?rev=901355&r1=901354&r2=901355&view=diff
==============================================================================
---
tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/BodyBlockDirective.java
(original)
+++
tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/BodyBlockDirective.java
Wed Jan 20 19:58:12 2010
@@ -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;
@@ -10,17 +31,20 @@
import org.apache.tiles.velocity.context.VelocityUtil;
import org.apache.velocity.context.InternalContextAdapter;
-import org.apache.velocity.exception.MethodInvocationException;
-import org.apache.velocity.exception.ParseErrorException;
-import org.apache.velocity.exception.ResourceNotFoundException;
import org.apache.velocity.runtime.directive.Directive;
import org.apache.velocity.runtime.parser.node.Node;
import org.apache.velocity.tools.view.ViewContext;
+/**
+ * Base abstract directive for those models who need to evaluate and use a
+ * body.
+ *
+ * @version $Rev$ $Date$
+ * @since 2.2.2
+ */
public abstract class BodyBlockDirective extends Directive {
/** {...@inheritdoc} */
-
@Override
public int getType() {
return BLOCK;
@@ -30,8 +54,7 @@
@Override
public boolean render(InternalContextAdapter context, Writer writer, Node
node)
- throws IOException, ResourceNotFoundException, ParseErrorException,
- MethodInvocationException {
+ throws IOException {
ViewContext viewContext = (ViewContext) context
.getInternalUserContext();
Map<String, Object> params = VelocityUtil.getParameters(context, node);
@@ -44,12 +67,36 @@
return true;
}
+ /**
+ * Starts the directive, before evaluating the body.
+ *
+ * @param context The Velocity context.
+ * @param writer The writer user to write the result.
+ * @param params The parameters got from the first node of the directive.
+ * @param request The HTTP request.
+ * @param response The HTTP response.
+ * @param servletContext The servlet context.
+ * @since 2.2.2
+ */
public abstract void start(InternalContextAdapter context, Writer writer,
Map<String, Object> params, HttpServletRequest request,
HttpServletResponse response, ServletContext servletContext);
+ /**
+ * Ends the directive, after evaluating the body.
+ *
+ * @param context The Velocity context.
+ * @param writer The writer user to write the result.
+ * @param params The parameters got from the first node of the directive.
+ * @param body The body contained in this directive, as a string.
+ * @param request The HTTP request.
+ * @param response The HTTP response.
+ * @param servletContext The servlet context.
+ * @throws IOException If something goes wrong when finishing this
directive.
+ * @since 2.2.2
+ */
public abstract void end(InternalContextAdapter context, Writer writer,
Map<String, Object> params, String body,
HttpServletRequest request, HttpServletResponse response,
ServletContext servletContext)
throws IOException;
-}
\ No newline at end of file
+}
Modified:
tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/DefinitionDirective.java
URL:
http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/DefinitionDirective.java?rev=901355&r1=901354&r2=901355&view=diff
==============================================================================
---
tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/DefinitionDirective.java
(original)
+++
tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/DefinitionDirective.java
Wed Jan 20 19:58:12 2010
@@ -1,6 +1,26 @@
+/*
+ * $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;
import java.io.Writer;
import java.util.Map;
@@ -13,25 +33,41 @@
import org.apache.tiles.template.DefinitionModel;
import org.apache.velocity.context.InternalContextAdapter;
+/**
+ * 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 DefinitionModel#end(MutableTilesContainer, java.util.Stack,
Object...)} and
+ * {...@link DefinitionModel#execute(MutableTilesContainer, java.util.Stack,
String, String,
+ * String, String, String, Object...)}.
+ *
+ * @version $Rev$ $Date$
+ * @since 2.2.2
+ */
public class DefinitionDirective extends BlockDirective {
+ /**
+ * The template model.
+ */
private DefinitionModel model = new DefinitionModel();
+ /** {...@inheritdoc} */
@Override
public String getName() {
return "tiles_definition";
}
+ /** {...@inheritdoc} */
@Override
public void end(InternalContextAdapter context, Writer writer,
Map<String, Object> params, HttpServletRequest request,
- HttpServletResponse response, ServletContext servletContext)
- throws IOException {
+ HttpServletResponse response, ServletContext servletContext) {
model.end((MutableTilesContainer) ServletUtil.getCurrentContainer(
request, servletContext),
ServletUtil.getComposeStack(request), context, request,
response);
}
+ /** {...@inheritdoc} */
@Override
public void start(InternalContextAdapter context, Writer writer,
Map<String, Object> params, HttpServletRequest request,
Modified:
tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/GetAsStringDirective.java
URL:
http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/GetAsStringDirective.java?rev=901355&r1=901354&r2=901355&view=diff
==============================================================================
---
tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/GetAsStringDirective.java
(original)
+++
tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/GetAsStringDirective.java
Wed Jan 20 19:58:12 2010
@@ -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,31 +29,40 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import org.apache.tiles.ArrayStack;
import org.apache.tiles.Attribute;
-import org.apache.tiles.TilesContainer;
import org.apache.tiles.servlet.context.ServletUtil;
import org.apache.tiles.template.DefaultAttributeResolver;
import org.apache.tiles.template.GetAsStringModel;
import org.apache.tiles.velocity.context.VelocityUtil;
import org.apache.velocity.context.InternalContextAdapter;
-import org.apache.velocity.exception.MethodInvocationException;
-import org.apache.velocity.exception.ParseErrorException;
-import org.apache.velocity.exception.ResourceNotFoundException;
-import org.apache.velocity.runtime.directive.Directive;
-import org.apache.velocity.runtime.parser.node.Node;
-import org.apache.velocity.tools.view.ViewContext;
+/**
+ * Wraps {...@link GetAsStringModel} to be used in Velocity. For the list of
+ * parameters, see
+ * {...@link GetAsStringModel#start(java.util.Stack,
org.apache.tiles.TilesContainer, boolean,
+ * String, String, Object, String, String, String, Attribute, Object...)}
+ * , {...@link GetAsStringModel#end(java.util.Stack,
org.apache.tiles.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.2
+ */
public class GetAsStringDirective extends BlockDirective {
+ /**
+ * The template model.
+ */
private GetAsStringModel model = new GetAsStringModel(
new DefaultAttributeResolver());
+ /** {...@inheritdoc} */
@Override
public String getName() {
return "tiles_getAsString";
}
+ /** {...@inheritdoc} */
@Override
public void end(InternalContextAdapter context, Writer writer,
Map<String, Object> params, HttpServletRequest request,
@@ -44,6 +74,7 @@
false), context, request, response, writer);
}
+ /** {...@inheritdoc} */
@Override
public void start(InternalContextAdapter context, Writer writer,
Map<String, Object> params, HttpServletRequest request,
Modified:
tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/ImportAttributeDirective.java
URL:
http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/ImportAttributeDirective.java?rev=901355&r1=901354&r2=901355&view=diff
==============================================================================
---
tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/ImportAttributeDirective.java
(original)
+++
tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/ImportAttributeDirective.java
Wed Jan 20 19:58:12 2010
@@ -1,6 +1,26 @@
+/*
+ * $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;
import java.io.Writer;
import java.util.Map;
@@ -8,36 +28,45 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import org.apache.tiles.ArrayStack;
import org.apache.tiles.servlet.context.ServletUtil;
import org.apache.tiles.template.ImportAttributeModel;
import org.apache.tiles.velocity.context.VelocityUtil;
import org.apache.velocity.context.InternalContextAdapter;
-import org.apache.velocity.exception.MethodInvocationException;
-import org.apache.velocity.exception.ParseErrorException;
-import org.apache.velocity.exception.ResourceNotFoundException;
import org.apache.velocity.runtime.directive.Directive;
import org.apache.velocity.runtime.parser.node.Node;
import org.apache.velocity.tools.view.ViewContext;
+/**
+ * Wraps {...@link ImportAttributeModel} to be used in Velocity. For the list
of
+ * parameters, see
+ * {...@link
ImportAttributeModel#getImportedAttributes(org.apache.tiles.TilesContainer,
+ * String, String, boolean, Object...)}.
+ *
+ * @version $Rev$ $Date$
+ * @since 2.2.2
+ */
public class ImportAttributeDirective extends Directive {
+ /**
+ * The template model.
+ */
private ImportAttributeModel model = new ImportAttributeModel();
+ /** {...@inheritdoc} */
@Override
public String getName() {
return "tiles_importAttribute";
}
+ /** {...@inheritdoc} */
@Override
public int getType() {
return LINE;
}
+ /** {...@inheritdoc} */
@Override
- public boolean render(InternalContextAdapter context, Writer writer, Node
node)
- throws IOException, ResourceNotFoundException, ParseErrorException,
- MethodInvocationException {
+ public boolean render(InternalContextAdapter context, Writer writer, Node
node) {
ViewContext viewContext = (ViewContext) context
.getInternalUserContext();
Map<String, Object> params = VelocityUtil.getParameters(context, node);
Modified:
tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/InsertAttributeDirective.java
URL:
http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/InsertAttributeDirective.java?rev=901355&r1=901354&r2=901355&view=diff
==============================================================================
---
tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/InsertAttributeDirective.java
(original)
+++
tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/InsertAttributeDirective.java
Wed Jan 20 19:58:12 2010
@@ -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;
@@ -15,16 +36,34 @@
import org.apache.tiles.velocity.context.VelocityUtil;
import org.apache.velocity.context.InternalContextAdapter;
+/**
+ * Wraps {...@link InsertAttributeModel} to be used in Velocity. For the list
of
+ * parameters, see
+ * {...@link InsertAttributeModel#start(java.util.Stack,
org.apache.tiles.TilesContainer, boolean,
+ * String, String, Object, String, String, String, Attribute, Object...)}
+ * , {...@link InsertAttributeModel#end(java.util.Stack,
org.apache.tiles.TilesContainer, boolean, Object...)} and
+ * {...@link InsertAttributeModel#execute(org.apache.tiles.TilesContainer,
boolean, String, String,
+ * Object, String, String, String, Attribute, Object...)}.
+ *
+ * @version $Rev$ $Date$
+ * @since 2.2.2
+ */
public class InsertAttributeDirective extends BlockDirective {
+ /**
+ * The template model.
+ */
private InsertAttributeModel model = new InsertAttributeModel(
new DefaultAttributeResolver());
+ /** {...@inheritdoc} */
@Override
public String getName() {
return "tiles_insertAttribute";
}
+ /** {...@inheritdoc} */
+ @Override
public void end(InternalContextAdapter context, Writer writer,
Map<String, Object> params, HttpServletRequest request,
HttpServletResponse response, ServletContext servletContext)
@@ -35,6 +74,8 @@
writer);
}
+ /** {...@inheritdoc} */
+ @Override
public void start(InternalContextAdapter context,
Writer writer, Map<String, Object> params,
HttpServletRequest request, HttpServletResponse response,
ServletContext servletContext) {
Modified:
tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/InsertDefinitionDirective.java
URL:
http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/InsertDefinitionDirective.java?rev=901355&r1=901354&r2=901355&view=diff
==============================================================================
---
tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/InsertDefinitionDirective.java
(original)
+++
tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/InsertDefinitionDirective.java
Wed Jan 20 19:58:12 2010
@@ -1,6 +1,26 @@
+/*
+ * $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;
import java.io.Writer;
import java.util.Map;
@@ -12,20 +32,36 @@
import org.apache.tiles.template.InsertDefinitionModel;
import org.apache.velocity.context.InternalContextAdapter;
+/**
+ * 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, String, String, Object...)} and
+ * {...@link InsertDefinitionModel#execute(org.apache.tiles.TilesContainer,
+ * String, String, String, String, String, String, Object...)}.
+ *
+ * @version $Rev$ $Date$
+ * @since 2.2.2
+ */
public class InsertDefinitionDirective extends BlockDirective {
+ /**
+ * The template model.
+ */
private InsertDefinitionModel model = new InsertDefinitionModel();
+ /** {...@inheritdoc} */
@Override
public String getName() {
return "tiles_insertDefinition";
}
+ /** {...@inheritdoc} */
@Override
public void end(InternalContextAdapter context, Writer writer,
Map<String, Object> params, HttpServletRequest request,
- HttpServletResponse response, ServletContext servletContext)
- throws IOException {
+ HttpServletResponse response, ServletContext servletContext) {
model.end(ServletUtil.getCurrentContainer(request,
servletContext), (String) params.get("name"), (String) params
.get("template"), (String) params.get("templateType"),
@@ -34,6 +70,7 @@
request, response, writer);
}
+ /** {...@inheritdoc} */
@Override
public void start(InternalContextAdapter context, Writer writer,
Map<String, Object> params, HttpServletRequest request,
Modified:
tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/InsertTemplateDirective.java
URL:
http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/InsertTemplateDirective.java?rev=901355&r1=901354&r2=901355&view=diff
==============================================================================
---
tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/InsertTemplateDirective.java
(original)
+++
tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/InsertTemplateDirective.java
Wed Jan 20 19:58:12 2010
@@ -1,6 +1,26 @@
+/*
+ * $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;
import java.io.Writer;
import java.util.Map;
@@ -12,20 +32,36 @@
import org.apache.tiles.template.InsertTemplateModel;
import org.apache.velocity.context.InternalContextAdapter;
+/**
+ * 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, String, String, Object...)} and
+ * {...@link InsertTemplateModel#execute(org.apache.tiles.TilesContainer,
+ * String, String, String, String, String, Object...)}.
+ *
+ * @version $Rev$ $Date$
+ * @since 2.2.2
+ */
public class InsertTemplateDirective extends BlockDirective {
+ /**
+ * The template model.
+ */
private InsertTemplateModel model = new InsertTemplateModel();
+ /** {...@inheritdoc} */
@Override
public String getName() {
return "tiles_insertTemplate";
}
+ /** {...@inheritdoc} */
@Override
public void end(InternalContextAdapter context, Writer writer,
Map<String, Object> params, HttpServletRequest request,
- HttpServletResponse response, ServletContext servletContext)
- throws IOException {
+ HttpServletResponse response, ServletContext servletContext) {
model.end(ServletUtil.getCurrentContainer(request, servletContext),
(String) params.get("template"), (String) params
.get("templateType"), (String) params
@@ -34,6 +70,7 @@
context, request, response, writer);
}
+ /** {...@inheritdoc} */
@Override
public void start(InternalContextAdapter context, Writer writer,
Map<String, Object> params, HttpServletRequest request,
Modified:
tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/PutAttributeDirective.java
URL:
http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/PutAttributeDirective.java?rev=901355&r1=901354&r2=901355&view=diff
==============================================================================
---
tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/PutAttributeDirective.java
(original)
+++
tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/PutAttributeDirective.java
Wed Jan 20 19:58:12 2010
@@ -1,6 +1,26 @@
+/*
+ * $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;
import java.io.Writer;
import java.util.Map;
@@ -13,20 +33,37 @@
import org.apache.tiles.velocity.context.VelocityUtil;
import org.apache.velocity.context.InternalContextAdapter;
+/**
+ * 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.2
+ */
public class PutAttributeDirective extends BodyBlockDirective {
+ /**
+ * The template model.
+ */
private PutAttributeModel model = new PutAttributeModel();
+ /** {...@inheritdoc} */
@Override
public String getName() {
return "tiles_putAttribute";
}
+ /** {...@inheritdoc} */
@Override
public void end(InternalContextAdapter context, Writer writer,
Map<String, Object> params, String body,
HttpServletRequest request, HttpServletResponse response,
- ServletContext servletContext) throws IOException {
+ ServletContext servletContext) {
model.end(ServletUtil.getCurrentContainer(request, servletContext),
ServletUtil.getComposeStack(request), (String)
params.get("name"), params.get("value"),
(String) params.get("expression"), body, (String) params
@@ -35,6 +72,7 @@
context, request, response, writer);
}
+ /** {...@inheritdoc} */
@Override
public void start(InternalContextAdapter context, Writer writer,
Map<String, Object> params, HttpServletRequest request,
Modified:
tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/PutListAttributeDirective.java
URL:
http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/PutListAttributeDirective.java?rev=901355&r1=901354&r2=901355&view=diff
==============================================================================
---
tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/PutListAttributeDirective.java
(original)
+++
tiles/framework/trunk/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/PutListAttributeDirective.java
Wed Jan 20 19:58:12 2010
@@ -1,6 +1,26 @@
+/*
+ * $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;
import java.io.Writer;
import java.util.Map;
@@ -13,15 +33,27 @@
import org.apache.tiles.velocity.context.VelocityUtil;
import org.apache.velocity.context.InternalContextAdapter;
+/**
+ * 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.2
+ */
public class PutListAttributeDirective extends BlockDirective {
+ /**
+ * The template model.
+ */
private PutListAttributeModel model = new PutListAttributeModel();
+ /** {...@inheritdoc} */
@Override
public void end(InternalContextAdapter context, Writer writer,
Map<String, Object> params, HttpServletRequest request,
- HttpServletResponse response, ServletContext servletContext)
- throws IOException {
+ HttpServletResponse response, ServletContext servletContext) {
model.end(ServletUtil.getCurrentContainer(request, servletContext),
ServletUtil.getComposeStack(request), (String) params
.get("name"), VelocityUtil.toSimpleBoolean(
@@ -29,6 +61,7 @@
context, request, response);
}
+ /** {...@inheritdoc} */
@Override
public void start(InternalContextAdapter context, Writer writer,
Map<String, Object> params, HttpServletRequest request,
@@ -38,6 +71,7 @@
.get("inherit"), false));
}
+ /** {...@inheritdoc} */
@Override
public String getName() {
return "tiles_putListAttribute";
Added:
tiles/framework/trunk/tiles-velocity/src/main/resources/META-INF/velocity.properties
URL:
http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-velocity/src/main/resources/META-INF/velocity.properties?rev=901355&view=auto
==============================================================================
---
tiles/framework/trunk/tiles-velocity/src/main/resources/META-INF/velocity.properties
(added)
+++
tiles/framework/trunk/tiles-velocity/src/main/resources/META-INF/velocity.properties
Wed Jan 20 19:58:12 2010
@@ -0,0 +1,27 @@
+# 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.
+
+userdirective=org.apache.tiles.velocity.template.AddAttributeDirective,\
+ org.apache.tiles.velocity.template.AddListAttributeDirective,\
+ org.apache.tiles.velocity.template.DefinitionDirective,\
+ org.apache.tiles.velocity.template.GetAsStringDirective,\
+ org.apache.tiles.velocity.template.ImportAttributeDirective,\
+ org.apache.tiles.velocity.template.InsertAttributeDirective,\
+ org.apache.tiles.velocity.template.InsertDefinitionDirective,\
+ org.apache.tiles.velocity.template.InsertTemplateDirective,\
+ org.apache.tiles.velocity.template.PutAttributeDirective,\
+ org.apache.tiles.velocity.template.PutListAttributeDirective
Propchange:
tiles/framework/trunk/tiles-velocity/src/main/resources/META-INF/velocity.properties
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
tiles/framework/trunk/tiles-velocity/src/main/resources/META-INF/velocity.properties
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL