You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@velocity.apache.org by he...@apache.org on 2006/12/27 21:24:59 UTC

svn commit: r490562 [1/2] - in /velocity/site/doxia-velocity-renderer: ./ config/ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/doxia/ src/main/java/org/apache/doxia/velocity/ src/main/java/org/apac...

Author: henning
Date: Wed Dec 27 12:24:58 2006
New Revision: 490562

URL: http://svn.apache.org/viewvc?view=rev&rev=490562
Log:
First import of the Doxia Velocity Renderer. Needed for the Velocity Site.

Added:
    velocity/site/doxia-velocity-renderer/LICENSE
    velocity/site/doxia-velocity-renderer/NOTICE
    velocity/site/doxia-velocity-renderer/config/
    velocity/site/doxia-velocity-renderer/config/apache-header.txt   (with props)
    velocity/site/doxia-velocity-renderer/config/checkstyle.xml   (with props)
    velocity/site/doxia-velocity-renderer/doap_doxia-velocity-renderer.rdf
    velocity/site/doxia-velocity-renderer/pom.xml   (with props)
    velocity/site/doxia-velocity-renderer/src/
    velocity/site/doxia-velocity-renderer/src/main/
    velocity/site/doxia-velocity-renderer/src/main/java/
    velocity/site/doxia-velocity-renderer/src/main/java/org/
    velocity/site/doxia-velocity-renderer/src/main/java/org/apache/
    velocity/site/doxia-velocity-renderer/src/main/java/org/apache/doxia/
    velocity/site/doxia-velocity-renderer/src/main/java/org/apache/doxia/velocity/
    velocity/site/doxia-velocity-renderer/src/main/java/org/apache/doxia/velocity/plugin/
    velocity/site/doxia-velocity-renderer/src/main/java/org/apache/doxia/velocity/plugin/DoxiaVelocityRendererPlugin.java   (with props)
    velocity/site/doxia-velocity-renderer/src/main/java/org/apache/doxia/velocity/renderer/
    velocity/site/doxia-velocity-renderer/src/main/java/org/apache/doxia/velocity/renderer/AbstractVelocityRenderer.java   (with props)
    velocity/site/doxia-velocity-renderer/src/main/java/org/apache/doxia/velocity/renderer/VelocityAptRenderer.java   (with props)
    velocity/site/doxia-velocity-renderer/src/main/java/org/apache/doxia/velocity/renderer/VelocityAptSiteModule.java   (with props)
    velocity/site/doxia-velocity-renderer/src/main/java/org/apache/doxia/velocity/renderer/VelocityXdocRenderer.java   (with props)
    velocity/site/doxia-velocity-renderer/src/main/java/org/apache/doxia/velocity/renderer/VelocityXdocSiteModule.java   (with props)
    velocity/site/doxia-velocity-renderer/src/main/java/org/apache/doxia/velocity/util/
    velocity/site/doxia-velocity-renderer/src/main/java/org/apache/doxia/velocity/util/AbstractDoxiaResourceLoader.java   (with props)
    velocity/site/doxia-velocity-renderer/src/main/java/org/apache/doxia/velocity/util/DefaultDoxiaLibraryLoader.java   (with props)
    velocity/site/doxia-velocity-renderer/src/main/java/org/apache/doxia/velocity/util/DefaultDoxiaVelocityContextFactory.java   (with props)
    velocity/site/doxia-velocity-renderer/src/main/java/org/apache/doxia/velocity/util/DoxiaLibraryLoader.java   (with props)
    velocity/site/doxia-velocity-renderer/src/main/java/org/apache/doxia/velocity/util/DoxiaResourceLoader.java   (with props)
    velocity/site/doxia-velocity-renderer/src/main/java/org/apache/doxia/velocity/util/DoxiaVelocityContextFactory.java   (with props)
    velocity/site/doxia-velocity-renderer/src/main/java/org/apache/doxia/velocity/util/PlexusLogger.java   (with props)
    velocity/site/doxia-velocity-renderer/src/main/java/org/apache/doxia/velocity/util/VelocityTool.java   (with props)
    velocity/site/doxia-velocity-renderer/src/main/resources/
    velocity/site/doxia-velocity-renderer/src/main/resources/org/
    velocity/site/doxia-velocity-renderer/src/main/resources/org/apache/
    velocity/site/doxia-velocity-renderer/src/main/resources/org/apache/doxia/
    velocity/site/doxia-velocity-renderer/src/main/resources/org/apache/doxia/velocity/
    velocity/site/doxia-velocity-renderer/src/main/resources/org/apache/doxia/velocity/renderer/
    velocity/site/doxia-velocity-renderer/src/main/resources/org/apache/doxia/velocity/renderer/doxia-velocity-renderer.properties   (with props)
    velocity/site/doxia-velocity-renderer/src/site/
    velocity/site/doxia-velocity-renderer/src/site/apt/
    velocity/site/doxia-velocity-renderer/src/site/apt/index.apt

Added: velocity/site/doxia-velocity-renderer/LICENSE
URL: http://svn.apache.org/viewvc/velocity/site/doxia-velocity-renderer/LICENSE?view=auto&rev=490562
==============================================================================
--- velocity/site/doxia-velocity-renderer/LICENSE (added)
+++ velocity/site/doxia-velocity-renderer/LICENSE Wed Dec 27 12:24:58 2006
@@ -0,0 +1,202 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed 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.

Added: velocity/site/doxia-velocity-renderer/NOTICE
URL: http://svn.apache.org/viewvc/velocity/site/doxia-velocity-renderer/NOTICE?view=auto&rev=490562
==============================================================================
--- velocity/site/doxia-velocity-renderer/NOTICE (added)
+++ velocity/site/doxia-velocity-renderer/NOTICE Wed Dec 27 12:24:58 2006
@@ -0,0 +1,7 @@
+Apache Doxia Velocity Renderer
+
+Copyright (C) 2000-2006 The Apache Software Foundation
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+

Added: velocity/site/doxia-velocity-renderer/config/apache-header.txt
URL: http://svn.apache.org/viewvc/velocity/site/doxia-velocity-renderer/config/apache-header.txt?view=auto&rev=490562
==============================================================================
--- velocity/site/doxia-velocity-renderer/config/apache-header.txt (added)
+++ velocity/site/doxia-velocity-renderer/config/apache-header.txt Wed Dec 27 12:24:58 2006
@@ -0,0 +1,21 @@
+^package .*\;$
+^\s*$
+^/\*\s*$
+^ \* Licensed to the Apache Software Foundation \(ASF\) under one\s*$
+^ \* or more contributor license agreements.  See the NOTICE file\s*$
+^ \* distributed with this work for additional information\s*$
+^ \* regarding copyright ownership.  The ASF licenses this file\s*$
+^ \* to you under the Apache License, Version 2.0 \(the\s*$
+^ \* "License"\)\; you may not use this file except in compliance\s*$
+^ \* with the License.  You may obtain a copy of the License at\s*$
+^ \*\s*$
+^ \*   http://www\.apache\.org/licenses/LICENSE-2\.0\s*$
+^ \*\s*$
+^ \* Unless required by applicable law or agreed to in writing,\s*$
+^ \* software distributed under the License is distributed on an\s*$
+^ \* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\s*$
+^ \* KIND, either express or implied.  See the License for the\s*$
+^ \* specific language governing permissions and limitations\s*$
+^ \* under the License.\s*$
+^ \*/\s*$
+^\s*$

Propchange: velocity/site/doxia-velocity-renderer/config/apache-header.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Added: velocity/site/doxia-velocity-renderer/config/checkstyle.xml
URL: http://svn.apache.org/viewvc/velocity/site/doxia-velocity-renderer/config/checkstyle.xml?view=auto&rev=490562
==============================================================================
--- velocity/site/doxia-velocity-renderer/config/checkstyle.xml (added)
+++ velocity/site/doxia-velocity-renderer/config/checkstyle.xml Wed Dec 27 12:24:58 2006
@@ -0,0 +1,206 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 2001-2005 The Apache Software Foundation.
+
+ Licensed 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.
+-->
+
+<!DOCTYPE module PUBLIC
+    "-//Puppy Crawl//DTD Check Configuration 1.1//EN"
+    "http://www.puppycrawl.com/dtds/configuration_1_1.dtd">
+
+<!--
+
+  Checkstyle configuration that checks the sun coding conventions from:
+
+    - the Java Language Specification at
+      http://java.sun.com/docs/books/jls/second_edition/html/index.html
+
+    - the Sun Code Conventions at http://java.sun.com/docs/codeconv/
+
+    - the Javadoc guidelines at
+      http://java.sun.com/j2se/javadoc/writingdoccomments/index.html
+
+    - the JDK Api documentation http://java.sun.com/j2se/docs/api/index.html
+
+    - some best practices
+
+  Checkstyle is very configurable. Be sure to read the documentation at
+  http://checkstyle.sf.net (or in your downloaded distribution).
+
+  Most Checks are configurable, be sure to consult the documentation.
+
+  To completely disable a check, just comment it out or delete it from the file.
+
+  Finally, it is worth reading the documentation.
+
+-->
+
+<module name="Checker">
+
+    <!-- Checks that a package.html file exists for each package.     -->
+    <!-- See http://checkstyle.sf.net/config_javadoc.html#PackageHtml -->
+    <module name="PackageHtml"/>
+
+    <!-- Checks whether files end with a new line.                        -->
+    <!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile -->
+    <module name="NewlineAtEndOfFile"/>
+
+    <!-- Checks that property files contain the same keys.         -->
+    <!-- See http://checkstyle.sf.net/config_misc.html#Translation -->
+    <module name="Translation"/>
+
+    <module name="TreeWalker">
+
+        <property name="cacheFile" value="${checkstyle.cache.file}"/>
+
+        <!-- ************************************************************** -->
+        <!-- Checks that are different from the sun coding conventions ones -->
+        <!-- ************************************************************** -->
+        <property name="tabWidth" value="4"/>
+        <module name="LeftCurly">
+          <property name="option" value="nl"/>
+        </module>
+        <module name="RightCurly">
+          <property name="option" value="alone"/>
+        </module>
+        <module name="LineLength">
+          <property name="ignorePattern" value="@version"/>
+          <property name="max" value="132"/>
+        </module>
+        <module name="MemberName">
+          <property name="format" value="^[a-z]+_*[a-zA-Z0-9]*$"/>
+        </module>
+        <module name="StaticVariableName">
+          <property name="format" value="^[a-z]+_*[a-zA-Z0-9]*$"/>
+        </module>
+        <module name="ConstantName">
+          <property name="format" value="^(([A-Z][A-Z0-9]*(_[A-Z0-9]+)*)|log)$"/>
+        </module>
+        <module name="ParameterName">
+          <property name="format" value="^[a-z]+_*[a-zA-Z0-9]*$"/>
+        </module>
+
+        <!-- ************************************************************** -->
+        <!-- Default Sun coding conventions checks                          -->
+        <!-- ************************************************************** -->
+
+        <!-- Checks for Javadoc comments.                     -->
+        <!-- See http://checkstyle.sf.net/config_javadoc.html -->
+        <module name="JavadocMethod">
+          <property name="excludeScope" value="private"/>
+        </module>
+        <module name="JavadocType"/>
+        <module name="JavadocVariable"/>
+
+
+        <!-- Checks for Naming Conventions.                  -->
+        <!-- See http://checkstyle.sf.net/config_naming.html -->
+        <module name="LocalFinalVariableName"/>
+        <module name="LocalVariableName"/>
+        <module name="MethodName"/>
+        <module name="PackageName"/>
+        <module name="TypeName"/>
+
+
+        <!-- Checks for Headers                              -->
+        <!-- See http://checkstyle.sf.net/config_header.html -->
+        <module name="RegexpHeader">
+            <!-- The follow property value demonstrates the ability     -->
+            <!-- to have access to ANT properties. In this case it uses -->
+            <!-- the ${basedir} property to allow Checkstyle to be run  -->
+            <!-- from any directory within a project.                   -->
+            <property name="headerFile" value="${checkstyle.header.file}"/>
+        </module>
+
+        <!-- Following interprets the header file as regular expressions. -->
+        <!-- <module name="RegexpHeader"/>                                -->
+
+
+        <!-- Checks for imports                              -->
+        <!-- See http://checkstyle.sf.net/config_import.html -->
+        <module name="AvoidStarImport"/>
+        <module name="IllegalImport"/> <!-- defaults to sun.* packages -->
+        <module name="RedundantImport"/>
+        <module name="UnusedImports"/>
+
+
+        <!-- Checks for Size Violations.                    -->
+        <!-- See http://checkstyle.sf.net/config_sizes.html -->
+        <module name="FileLength"/>
+        <module name="MethodLength"/>
+        <module name="ParameterNumber"/>
+
+
+        <!-- Checks for whitespace                               -->
+        <!-- See http://checkstyle.sf.net/config_whitespace.html -->
+        <module name="EmptyForIteratorPad"/>
+        <module name="NoWhitespaceAfter"/>
+        <module name="NoWhitespaceBefore"/>
+        <module name="OperatorWrap"/>
+        <module name="ParenPad"/>
+        <module name="TabCharacter"/>
+        <module name="WhitespaceAfter"/>
+        <module name="WhitespaceAround"/>
+
+
+        <!-- Modifier Checks                                    -->
+        <!-- See http://checkstyle.sf.net/config_modifiers.html -->
+        <module name="ModifierOrder"/>
+        <module name="RedundantModifier"/>
+
+        <module name="EmptyBlock"/>
+        <module name="NeedBraces"/>
+
+        <!-- Checks for common coding problems               -->
+        <!-- See http://checkstyle.sf.net/config_coding.html -->
+        <module name="DoubleCheckedLocking"/>    <!-- MY FAVOURITE -->
+        <module name="EmptyStatement"/>
+        <module name="EqualsHashCode"/>
+        <module name="FallThrough"/>
+        <module name="HiddenField">
+          <property name="ignoreConstructorParameter" value="true"/>
+          <property name="ignoreSetter" value="true"/>
+        </module>
+        <module name="IllegalInstantiation"/>
+        <module name="InnerAssignment"/>
+        <module name="MagicNumber"/>
+        <module name="MissingSwitchDefault"/>
+<!--        <module name="OneMethodPrivateField" /> -->
+        <module name="RedundantThrows"/>
+        <module name="SimplifyBooleanExpression"/>
+        <module name="SimplifyBooleanReturn"/>
+
+        <!-- Checks for class design                         -->
+        <!-- See http://checkstyle.sf.net/config_design.html -->
+        <module name="FinalClass"/>
+        <module name="HideUtilityClassConstructor"/>
+        <module name="VisibilityModifier">
+        <module name="MissingSwitchDefault"/>
+          <property name="protectedAllowed" value="true"/>
+        </module>
+
+
+        <!-- Miscellaneous other checks.                   -->
+        <!-- See http://checkstyle.sf.net/config_misc.html -->
+        <module name="ArrayTypeStyle"/>
+<!--         <module name="FinalParameters"/> -->
+        <module name="GenericIllegalRegexp">
+            <property name="format" value="\s+$"/>
+            <property name="message" value="Line has trailing spaces."/>
+        </module>
+        <module name="UpperEll"/>
+
+    </module>
+
+</module>

Propchange: velocity/site/doxia-velocity-renderer/config/checkstyle.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: velocity/site/doxia-velocity-renderer/config/checkstyle.xml
------------------------------------------------------------------------------
    svn:keywords = Id Author Date Revision

Added: velocity/site/doxia-velocity-renderer/doap_doxia-velocity-renderer.rdf
URL: http://svn.apache.org/viewvc/velocity/site/doxia-velocity-renderer/doap_doxia-velocity-renderer.rdf?view=auto&rev=490562
==============================================================================
--- velocity/site/doxia-velocity-renderer/doap_doxia-velocity-renderer.rdf (added)
+++ velocity/site/doxia-velocity-renderer/doap_doxia-velocity-renderer.rdf Wed Dec 27 12:24:58 2006
@@ -0,0 +1,46 @@
+<!--
+  ~ Copyright 2006 The Apache Software Foundation.
+  ~
+  ~ Licensed 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.
+--> 
+<rdf:RDF xml:lang="en" xmlns="http://usefulinc.com/ns/doap#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:asfext="http://projects.apache.org/ns/asfext#" xmlns:foaf="http://xmlns.com/foaf/0.1/">
+  <Project rdf:about="http://Maven.rdf.apache.org/">
+    <created>2006</created>
+    <license rdf:resource="http://www.apache.org/licenses/LICENSE-2.0.txt"/>
+    <name>Doxia Velocity Renderer</name>
+    <homepage rdf:resource="http://people.apache.org/~henning/velocity-doxia-renderer/"/>
+    <asfext:pmc rdf:resource="http://people.apache.org/~henning/velocity-doxia-renderer/"/>
+    <shortdesc>This is a Doxia Extension that allows you to run Velocity Templates to produce APT and XDOC
+    file which then are rendered through the Doxia Renderer. This allows you to use VTL Macros and
+    Scripts when generating the Site.</shortdesc>
+    <description>This is a Doxia Extension that allows you to run Velocity Templates to produce APT and XDOC
+    file which then are rendered through the Doxia Renderer. This allows you to use VTL Macros and
+    Scripts when generating the Site.</description>
+    <mailing-list rdf:resource="http://people.apache.org/~henning/velocity-doxia-renderer/mail-lists.html"/>
+    <download-page rdf:resource="http://people.apache.org/~henning/velocity-doxia-renderer/download.html"/>
+    <programming-language>Java</programming-language>
+    <category rdf:resource="http://projects.apache.org/category/null"/>
+    <repository>
+      <SVNRepository>
+        <location rdf:resource="http://svn.apache.org/repos/asf/velocity/site/doxia-velocity-renderer/"/>
+        <browse rdf:resource="http://svn.apache.org/viewvc/velocity/site/doxia-velocity-renderer/"/>
+      </SVNRepository>
+    </repository>
+    <maintainer>
+      <foaf:Person>
+        <foaf:name>Henning P. Schmiedehausen</foaf:name>
+        <foaf:mbox rdf:resource="mailto:hps@intermeta.de"/>
+      </foaf:Person>
+    </maintainer>
+  </Project>
+</rdf:RDF>
\ No newline at end of file

Added: velocity/site/doxia-velocity-renderer/pom.xml
URL: http://svn.apache.org/viewvc/velocity/site/doxia-velocity-renderer/pom.xml?view=auto&rev=490562
==============================================================================
--- velocity/site/doxia-velocity-renderer/pom.xml (added)
+++ velocity/site/doxia-velocity-renderer/pom.xml Wed Dec 27 12:24:58 2006
@@ -0,0 +1,192 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.apache.velocity</groupId>
+  <artifactId>doxia-velocity-renderer</artifactId>
+  <packaging>maven-plugin</packaging>
+  <name>Doxia Velocity Renderer</name>
+  <url>http://people.apache.org/~henning/velocity-doxia-renderer/</url>
+  <version>0.0.1</version>
+  <description>This is a Doxia Extension that allows you to run Velocity Templates to produce APT and XDOC
+    file which then are rendered through the Doxia Renderer. This allows you to use VTL Macros and
+    Scripts when generating the Site.</description>
+  <inceptionYear>2006</inceptionYear>
+
+  <organization>
+    <name>The Apache Software Foundation</name>
+    <url>http://www.apache.org/</url>
+  </organization>
+
+  <distributionManagement>
+    <site>
+      <id>velocity.apache.org</id>
+      <url>scpexe://people.apache.org/home/henning/public_html/velocity-doxia-renderer</url>
+    </site>
+  </distributionManagement>
+
+  <developers>
+    <developer>
+      <name>Henning P. Schmiedehausen</name>
+      <id>henning</id>
+      <email>henning@apache.org</email>
+      <url>http://henning.schmiedehausen.org/</url>
+      <organization>The Apache Software Foundation</organization>
+      <roles>
+        <role>Java Developer</role>
+      </roles>
+      <timezone>1</timezone>
+    </developer>
+  </developers>
+
+  <licenses>
+    <license>
+      <name>Apache 2</name>
+       <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
+       <distribution>repo</distribution>
+       <comments>The Apache Software License 2.0</comments>
+     </license>
+  </licenses>
+
+  <scm>
+    <connection>scm:svn:http://svn.apache.org/repos/asf/velocity/site/doxia-velocity-renderer/</connection>
+    <developerConnection>scm:svn:https://svn.apache.org/repos/asf/velocity/site/doxia-velocity-renderer/</developerConnection>
+    <tag>HEAD</tag>
+    <url>http://svn.apache.org/viewvc/velocity/site/doxia-velocity-renderer/</url>
+  </scm>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.codehaus.plexus</groupId>
+        <artifactId>plexus-maven-plugin</artifactId>
+        <version>1.2</version>
+        <executions>
+          <execution>
+            <goals>
+              <goal>descriptor</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+
+  <reporting>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-project-info-reports-plugin</artifactId>
+        <reportSets>
+          <reportSet>
+            <reports>
+              <report>dependencies</report>
+              <report>license</report>
+              <report>summary</report>
+              <report>scm</report>
+              <report>project-team</report>
+            </reports>
+          </reportSet>
+        </reportSets>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-plugin-plugin</artifactId>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-checkstyle-plugin</artifactId>
+        <configuration>
+          <configLocation>config/checkstyle.xml</configLocation>
+          <headerLocation>config/apache-header.txt</headerLocation>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-pmd-plugin</artifactId>
+      </plugin>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>taglist-maven-plugin</artifactId>
+        <configuration>
+          <tag>TODO</tag>
+          <tag>FIXME</tag>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-jxr-plugin</artifactId>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-javadoc-plugin</artifactId>
+        <configuration>
+          <links>
+            <link>http://java.sun.com/j2ee/1.4/docs/api</link>
+            <link>http://jakarta.apache.org/commons/collections/apidocs-COLLECTIONS_3_0/</link>
+            <link>http://jakarta.apache.org/velocity/api/</link>
+          </links>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>changelog-maven-plugin</artifactId>
+      </plugin>
+    </plugins>
+  </reporting>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.maven.doxia</groupId>
+      <artifactId>doxia-core</artifactId>
+      <version>1.0-alpha-8</version>
+    </dependency>
+    <dependency>
+      <groupId>commons-collections</groupId>
+      <artifactId>commons-collections</artifactId>
+      <version>3.1</version>
+    </dependency>
+    <dependency>
+      <groupId>commons-lang</groupId>
+      <artifactId>commons-lang</artifactId>
+      <version>2.1</version>
+    </dependency>
+    <dependency>
+      <groupId>org.codehaus.plexus</groupId>
+      <artifactId>plexus-container-default</artifactId>
+      <version>1.0-alpha-8</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.velocity</groupId>
+      <artifactId>velocity</artifactId>
+      <version>1.5-beta2</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-project</artifactId>
+      <version>2.0.4</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-plugin-api</artifactId>
+      <version>2.0.4</version>
+    </dependency>
+  </dependencies>
+</project>

Propchange: velocity/site/doxia-velocity-renderer/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: velocity/site/doxia-velocity-renderer/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Id Author Date Revision

Added: velocity/site/doxia-velocity-renderer/src/main/java/org/apache/doxia/velocity/plugin/DoxiaVelocityRendererPlugin.java
URL: http://svn.apache.org/viewvc/velocity/site/doxia-velocity-renderer/src/main/java/org/apache/doxia/velocity/plugin/DoxiaVelocityRendererPlugin.java?view=auto&rev=490562
==============================================================================
--- velocity/site/doxia-velocity-renderer/src/main/java/org/apache/doxia/velocity/plugin/DoxiaVelocityRendererPlugin.java (added)
+++ velocity/site/doxia-velocity-renderer/src/main/java/org/apache/doxia/velocity/plugin/DoxiaVelocityRendererPlugin.java Wed Dec 27 12:24:58 2006
@@ -0,0 +1,225 @@
+package org.apache.doxia.velocity.plugin;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.File;
+import java.util.List;
+
+import org.apache.doxia.velocity.util.DoxiaLibraryLoader;
+import org.apache.doxia.velocity.util.DoxiaVelocityContextFactory;
+import org.apache.doxia.velocity.util.VelocityTool;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.project.MavenProject;
+
+
+/**
+ * <p>This plugin allows the transfer of configuration and other information that is only
+ * available in the Mojo API to the actual extension code. It is tied to the site lifecycle in the pre-site phase, so
+ * it will have run before the site-plugin itself triggers the Doxia rendering.</p>
+ *
+ * <p>This plugin can be configured through the POM:</p>
+ *
+ * <p>Configuration from the POM about the libraries to use.</p>
+ *
+ * <pre>
+ *   &lt;libraries&gt;
+ *     &lt;library&gt;macro1.vm&lt;/library&gt;
+ *     &lt;library&gt;macro2.vm&lt;/library&gt;
+ *   &lt;/libraries&gt;
+ * </pre>
+ *
+ * <p>Can contain multiple libraries. All must exist and are loaded from <code>${siteDirectory}/velocity/resources</code>.</p>
+ *
+ * <p>Configuration from the POM about the Tools to use. Velocity Tools are instances of Java objects that are available through
+ * the Velocity context. All Tools are instantiated only once and the put in the context. So don't change the inner state of the
+ * Tools!</p>
+ *
+ * <pre>
+ *   &lt;tools&gt;
+ *     &lt;tool&gt;
+ *       &lt;toolName&gt;tool_a&lt;/toolName&gt;
+ *       &lt;toolClass&gt;java.util.Date&lt;/toolClass&gt;
+ *     &lt;/tool&gt;
+ *     &lt;tool&gt;
+ *       &lt;toolName&gt;tool_b&lt;/toolName&gt;
+ *       &lt;toolClass&gt;java.lang.String&lt;/toolClass&gt;
+ *     &lt;/tool&gt;
+ *   &lt;/tools&gt;
+ * </pre>
+ *
+ * This adds a {@link java.util.Date} and a {@link String} object to the context.
+ * These are accessible as ${tool_a} and ${tool_b} from Velocity templates.
+ *
+ * @author  <a href="mailto:henning@apache.org">Henning P. Schmiedehausen</a>
+ * @version  $Revision$
+ *
+ * @goal  pre-site
+ * @phase  pre-site
+ * @requiresDependencyResolution  test
+ */
+public class DoxiaVelocityRendererPlugin
+    extends AbstractMojo
+{
+
+    /**
+     * Directory containing the site files. Will be used to load the Velocity Macro files through
+     * the {@link DoxiaLibraryLoader}.
+     *
+     * @parameter  expression="${basedir}/src/site"
+     * @required
+     */
+    private File siteDirectory;
+
+    /**
+     * The maven project descriptor.
+     *
+     * @parameter  expression="${project}"
+     * @required
+     * @readonly
+     */
+    private MavenProject project;
+
+    /**
+     * The local repository descriptor.
+     *
+     * @parameter  expression="${localRepository}"
+     */
+    private ArtifactRepository localRepository;
+
+    /**
+     * The List of reactor project descriptors.
+     *
+     * @parameter  expression="${reactorProjects}"
+     * @required
+     * @readonly
+     */
+    private List reactorProjects;
+
+    /**
+     * Specifies the input encoding for the templates.
+     *
+     * <p>TODO: Is that really useful?</p>
+     *
+     * @parameter  expression="${inputEncoding}" default-value="ISO-8859-1"
+     */
+    private String inputEncoding;
+
+    /**
+     * Specifies the output encoding for the templates.
+     *
+     * <p>TODO: Is that really useful?</p>
+     *
+     * @parameter  expression="${outputEncoding}" default-value="ISO-8859-1"
+     */
+    private String outputEncoding;
+
+    /**
+     * The Velocity Context Factory. This gets managed by Plexus as a singleton and
+     * we leverage the fact that this singleton goes through the plugin before Doxia
+     * runs.
+     *
+     * @component
+     */
+    private DoxiaVelocityContextFactory doxiaVelocityContextFactory;
+
+    /**
+     * The Velocity Library Loader. This gets managed by Plexus as a singleton and
+     * we leverage the fact that this singleton goes through the plugin before Doxia
+     * runs.
+     *
+     * @component
+     */
+    private DoxiaLibraryLoader doxiaLibraryLoader;
+
+    /**
+     * Configuration from the POM about the libraries to use.
+     *
+     * <pre>
+     *   &lt;libraries&gt;
+     *     &lt;library&gt;macro1.vm&lt;/library&gt;
+     *     &lt;library&gt;macro2.vm&lt;/library&gt;
+     *   &lt;/libraries&gt;
+     * </pre>
+     *
+     * Can contain multiple libraries. All must exist and are loaded from <code>${siteDirectory}/velocity/resources</code>.
+     *
+     * @parameter  expression="${libraries}"
+     */
+    private String[] libraries;
+
+    /**
+     * Configuration from the POM about the Tools to use. Velocity Tools are instances of Java objects that are available through
+     * the Velocity context. All Tools are instantiated only once and the put in the context. So don't change the inner state of the
+     * Tools!
+     *
+     * <pre>
+     *   &lt;tools&gt;
+     *     &lt;tool&gt;
+     *       &lt;toolName&gt;tool_a&lt;/toolName&gt;
+     *       &lt;toolClass&gt;java.util.Date&lt;/toolClass&gt;
+     *     &lt;/tool&gt;
+     *     &lt;tool&gt;
+     *       &lt;toolName&gt;tool_b&lt;/toolName&gt;
+     *       &lt;toolClass&gt;java.lang.String&lt;/toolClass&gt;
+     *     &lt;/tool&gt;
+     *   &lt;/tools&gt;
+     * </pre>
+     *
+     * This adds a {@link java.util.Date} and a {@link String} object to the context.
+     * These are accessible as ${tool_a} and ${tool_b} from Velocity templates.
+     *
+     * <p>TODO: Maybe use Velocity Tools.</p>
+     *
+     * @parameter  expression="${tools}"
+     */
+    private VelocityTool [] tools;
+
+    /**
+     * <p>Plugin Execution. Must be run in the pre-site phase of the site lifecycle.
+     * Copies the injected field parameter into the {@link DoxiaVelocityContextFactory}
+     * and {@link DoxiaLibraryLoader} singletons so that they are available in the
+     * actual Maven extension.</p>
+     *
+     * <p>TODO: Find out if that is actually legal and/or the recommended way to do.</p>
+     *
+     */
+    public void execute()
+    {
+
+        if (doxiaVelocityContextFactory != null)
+        {
+            doxiaVelocityContextFactory.addContextElement("siteDirectory", siteDirectory);
+            doxiaVelocityContextFactory.addContextElement("project", project);
+            doxiaVelocityContextFactory.addContextElement("localRepository", localRepository);
+            doxiaVelocityContextFactory.addContextElement("reactorProjects", reactorProjects);
+            doxiaVelocityContextFactory.addContextElement("inputEncoding", inputEncoding);
+            doxiaVelocityContextFactory.addContextElement("outputEncoding", outputEncoding);
+
+            doxiaVelocityContextFactory.setTools(tools);
+        }
+
+        if (doxiaLibraryLoader != null)
+        {
+            doxiaLibraryLoader.setKnownLibraries(libraries);
+            doxiaLibraryLoader.setSiteDirectory(siteDirectory);
+        }
+    }
+}

Propchange: velocity/site/doxia-velocity-renderer/src/main/java/org/apache/doxia/velocity/plugin/DoxiaVelocityRendererPlugin.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: velocity/site/doxia-velocity-renderer/src/main/java/org/apache/doxia/velocity/plugin/DoxiaVelocityRendererPlugin.java
------------------------------------------------------------------------------
    svn:keywords = Id Author Date Revision

Added: velocity/site/doxia-velocity-renderer/src/main/java/org/apache/doxia/velocity/renderer/AbstractVelocityRenderer.java
URL: http://svn.apache.org/viewvc/velocity/site/doxia-velocity-renderer/src/main/java/org/apache/doxia/velocity/renderer/AbstractVelocityRenderer.java?view=auto&rev=490562
==============================================================================
--- velocity/site/doxia-velocity-renderer/src/main/java/org/apache/doxia/velocity/renderer/AbstractVelocityRenderer.java (added)
+++ velocity/site/doxia-velocity-renderer/src/main/java/org/apache/doxia/velocity/renderer/AbstractVelocityRenderer.java Wed Dec 27 12:24:58 2006
@@ -0,0 +1,278 @@
+package org.apache.doxia.velocity.renderer;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Reader;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.util.Iterator;
+
+import org.apache.commons.collections.ExtendedProperties;
+import org.apache.commons.collections.iterators.ArrayIterator;
+import org.apache.commons.lang.StringUtils;
+import org.apache.doxia.velocity.util.DoxiaLibraryLoader;
+import org.apache.doxia.velocity.util.DoxiaResourceLoader;
+import org.apache.doxia.velocity.util.DoxiaVelocityContextFactory;
+import org.apache.doxia.velocity.util.PlexusLogger;
+import org.apache.maven.doxia.parser.AbstractParser;
+import org.apache.maven.doxia.parser.ParseException;
+import org.apache.maven.doxia.parser.Parser;
+import org.apache.maven.doxia.sink.Sink;
+import org.apache.velocity.Template;
+import org.apache.velocity.VelocityContext;
+import org.apache.velocity.app.VelocityEngine;
+import org.apache.velocity.runtime.RuntimeConstants;
+import org.codehaus.plexus.logging.LogEnabled;
+import org.codehaus.plexus.logging.Logger;
+import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
+import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;
+
+
+/**
+ * <p>This is the base class for the various parsers. This does not run inside the Mojo API and the
+ * plugin cycle but gets instantiated by Plexus itself. However as the Plexus annotation parser does
+ * not look into super classes (the Mojo API parser does), all fields that are set through
+ * annotations must be declared in the derived classes which leads to a number of code duplications
+ * and strange abstract methods below.</p>
+ *
+ * <p><b>NOTE:</b> This parser could be so much easier if it were possible to inject the ParserManager.
+ * Then only one instance would be needed and the class could decide whether the supplied input was
+ * XDoc or APT or something else. However, Plexus chokes on cyclic definitions (The Parsers are injected
+ * into the ParserManager which in turn should be injected into one Parser).
+ * Maybe the Plexus authors should do less Spring bashing (Spring gets this right) and fix their injectors...</p>
+ *
+ * @author  <a href="mailto:henning@apache.org">Henning P. Schmiedehausen</a>
+ * @version  $Revision$
+ */
+public abstract class AbstractVelocityRenderer
+    extends AbstractParser
+    implements Initializable,
+        LogEnabled
+{
+
+    /** Plexus Logger object. Injected by {@link LogEnabled} interface. */
+    private Logger logger = null;
+
+    /**
+     * Velocity Engine instance. Now you could argue that Plexus offers a Velocity component
+     * that could be used. However what this component not offers is an actual Engine instance
+     * but a configured singleton. This parser lives from the fact that we can customize its
+     * configuration, its loaders and macro libraries. Nothing of this is offered by the Plexus Velocity component
+     * so it is not usable here.
+     */
+    private VelocityEngine engine = null;
+
+    /** Loader that reads the templates from the input reader. */
+    private DoxiaResourceLoader doxiaResourceLoader = null;
+
+    /**
+     * Creates a new AbstractVelocityRenderer object.
+     */
+    protected AbstractVelocityRenderer()
+    {
+    }
+
+    /**
+     * Returns the actual Parser (currently only Apt and Xdoc) must be injected into an instance of this
+     * component. As the Plexus injector does not look at base classes (or maybe it does and only the Maven plugin does not),
+     * we must get this value from the actual implementation class.
+     *
+     * <p>TODO: Maybe write a custom components.xml file that declares this dependency and not use the
+     * maven-plexus-plugin. Then again, maybe not.</p>
+     *
+     * @return  A {@link Parser} instance that is the actual parser for this document type once Velocity processed the template.
+     */
+    protected abstract Parser getParser();
+
+    /**
+     * Returns the Velocity Context factory which contains the values set by the Plugin for the Velocity renderer.
+     *
+     * It must be injected into an instance of this
+     * component. As the Plexus injector does not look at base classes (or maybe it does and only the Maven plugin does not),
+     * we must get this value from the actual implementation class.
+     *
+     * <p>TODO: Maybe write a custom components.xml file that declares this dependency and not use the
+     * maven-plexus-plugin. Then again, maybe not.</p>
+     *
+     * @return  A {@link DoxiaVelocityContextFactory} instance that generates
+     *          {@link VelocityContext} objects for the render process.
+     */
+    protected abstract DoxiaVelocityContextFactory getContextFactory();
+
+    /**
+     * Returns a {@link org.apache.velocity.runtime.resource.loader.ResourceLoader} to load macro libraries. Its libraries are
+     * configured through the plugin.
+     *
+     * It must be injected into an instance of this
+     * component. As the Plexus injector does not look at base classes (or maybe it does and only the Maven plugin does not),
+     * we must get this value from the actual implementation class.
+     *
+     * <p>TODO: Maybe write a custom components.xml file that declares this dependency and not use the
+     * maven-plexus-plugin. Then again, maybe not.</p>
+     *
+     * @return  A {@link org.apache.velocity.runtime.resource.loader.ResourceLoader} object.
+     */
+    protected abstract DoxiaLibraryLoader getLibraryLoader();
+
+    /**
+     * Returns the Plexus logger.
+     *
+     * @return  The Plexus logger object.
+     */
+    protected Logger getLogger()
+    {
+        return logger;
+    }
+
+    /**
+     * Plexus logging. Defined by {@link LogEnabled}.
+     *
+     * @param  logger  A {@link Logger} object.
+     */
+    public void enableLogging(final Logger logger)
+    {
+        this.logger = logger;
+    }
+
+    /**
+     * Plexus Lifecycle. Defined by {@link Initializable}.
+     *
+     * @throws  InitializationException When the Velocity Engine could not be configured.
+     */
+    public void initialize()
+        throws InitializationException
+    {
+        engine = new VelocityEngine();
+        doxiaResourceLoader = new DoxiaResourceLoader(logger);
+
+        InputStream inputStream = null;
+        ExtendedProperties properties = new ExtendedProperties();
+
+        // We load a default properties file from the classpath. This file in in the src/main/resources directory
+        // It is intentionally *NOT* named velocity.properties!
+        try
+        {
+            inputStream = getClass().getResourceAsStream("doxia-velocity-renderer.properties");
+            properties.load(inputStream);
+        }
+        catch (IOException ioe)
+        {
+            logger.error("Could not load Default properties: ", ioe);
+        }
+        finally
+        {
+            if (inputStream != null)
+            {
+                try
+                {
+                    inputStream.close();
+                }
+                catch (IOException ioe2)
+                {
+                    logger.error("While closing Stream: ", ioe2);
+                }
+            }
+        }
+
+        engine.setExtendedProperties(properties);
+
+        // We have a custom Plexus Logger for Velocity messages.
+        engine.setProperty(RuntimeConstants.RUNTIME_LOG_LOGSYSTEM,
+                           new PlexusLogger(logger));
+
+        // Add the Resource Loader instance to the Velocity configuration.
+        engine.setProperty("doxia-loader."
+                + RuntimeConstants.RESOURCE_LOADER
+                + ".instance", doxiaResourceLoader);
+
+        // Add the Library loader to the Velocity configuration.
+        DoxiaLibraryLoader libraryLoader = getLibraryLoader();
+
+        engine.setProperty("doxia-library-loader."
+                + RuntimeConstants.RESOURCE_LOADER
+                + ".instance", libraryLoader);
+
+        // Add all configured Velocity Macro libraries to the configuration. So they are loaded immediately at init time.
+        String[] knownLibraries = libraryLoader.getKnownLibraries();
+
+        if (knownLibraries != null)
+        {
+            for (Iterator it = new ArrayIterator(knownLibraries); it.hasNext();)
+            {
+                String library = (String) it.next();
+
+                if (StringUtils.isNotEmpty(library))
+                {
+                    engine.addProperty(RuntimeConstants.VM_LIBRARY, library);
+                }
+            }
+        }
+
+        try
+        {
+            engine.init();
+        }
+        catch (Exception e)
+        {
+            throw new InitializationException("Velocity Init:", e);
+        }
+    }
+
+    /**
+     * This is the actual parsing stage. We pull the template from the Reader
+     * using the {@link DoxiaResourceLoader}, render the Template into a String
+     * and then pass the actual rendering to the injected Renderer (Xdoc or Apt).
+     *
+     * @param reader The reader which returns the actual template data.
+     * @param sink The Doxia Sink to send our information to.
+     *
+     * @throws parseException When Velocity can not load or process the template.
+     */
+    public final synchronized void parse(final Reader reader, final Sink sink)
+        throws ParseException
+    {
+        // Set the Reader in the Resource loader.
+        doxiaResourceLoader.setTemplateReader(reader);
+
+        try
+        {
+
+            // Name must be the empty string so the doxia-loader gets hit.
+            Template renderTemplate = engine.getTemplate("");
+            VelocityContext ctx = getContextFactory().getVelocityContext();
+
+            StringWriter writer = new StringWriter();
+
+            renderTemplate.merge(ctx, writer);
+            writer.flush();
+
+            StringReader strReader = new StringReader(writer.toString());
+
+            getParser().parse(strReader, sink);
+
+        }
+        catch (Exception e)
+        {
+            throw new ParseException(e);
+        }
+    }
+}

Propchange: velocity/site/doxia-velocity-renderer/src/main/java/org/apache/doxia/velocity/renderer/AbstractVelocityRenderer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: velocity/site/doxia-velocity-renderer/src/main/java/org/apache/doxia/velocity/renderer/AbstractVelocityRenderer.java
------------------------------------------------------------------------------
    svn:keywords = Id Author Date Revision

Added: velocity/site/doxia-velocity-renderer/src/main/java/org/apache/doxia/velocity/renderer/VelocityAptRenderer.java
URL: http://svn.apache.org/viewvc/velocity/site/doxia-velocity-renderer/src/main/java/org/apache/doxia/velocity/renderer/VelocityAptRenderer.java?view=auto&rev=490562
==============================================================================
--- velocity/site/doxia-velocity-renderer/src/main/java/org/apache/doxia/velocity/renderer/VelocityAptRenderer.java (added)
+++ velocity/site/doxia-velocity-renderer/src/main/java/org/apache/doxia/velocity/renderer/VelocityAptRenderer.java Wed Dec 27 12:24:58 2006
@@ -0,0 +1,93 @@
+package org.apache.doxia.velocity.renderer;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.doxia.velocity.util.DoxiaLibraryLoader;
+import org.apache.doxia.velocity.util.DoxiaVelocityContextFactory;
+import org.apache.maven.doxia.parser.Parser;
+
+
+/**
+ * This is the apt-parsing instance of the {@link AbstractVelocityRenderer}.
+ *
+ * @plexus.component  role="org.apache.maven.doxia.parser.Parser" role-hint="velocity-apt"
+ *
+ * @author  <a href="mailto:henning@apache.org">Henning P. Schmiedehausen</a>
+ * @version  $Revision$
+ */
+public class VelocityAptRenderer
+    extends AbstractVelocityRenderer
+{
+    /**
+     * Creates a new VelocityAptRenderer object.
+     */
+    public VelocityAptRenderer()
+    {
+    }
+
+    /**
+     * Here we get the actual apt parser from the Doxia core. It will render our processed template.
+     *
+     * @plexus.requirement  role="org.apache.maven.doxia.parser.Parser" role-hint="apt"
+     */
+    private Parser parser;
+
+    /**
+     * @see AbstractVelocityRenderer#getParser()
+     */
+    protected Parser getParser()
+    {
+        return parser;
+    }
+
+    /**
+     * The Velocity Context Factory. This gets managed by Plexus as a singleton. However as
+     * we are not inside the Mojo API here, we must use the Plexus requirement annotation, not
+     * the Mojo component annotation. Yes, this is important (and confusing, too).
+     *
+     * @plexus.requirement  role="org.apache.doxia.velocity.util.DoxiaVelocityContextFactory"
+     */
+    private DoxiaVelocityContextFactory doxiaVelocityContextFactory;
+
+    /**
+     * @see AbstractVelocityRenderer#getContextFactory()
+     */
+    protected DoxiaVelocityContextFactory getContextFactory()
+    {
+        return doxiaVelocityContextFactory;
+    }
+
+    /**
+     * The Velocity Library Loader. This gets managed by Plexus as a singleton. However as
+     * we are not inside the Mojo API here, we must use the Plexus requirement annotation, not
+     * the Mojo component annotation. Yes, this is important (and confusing, too).
+     *
+     * @plexus.requirement  role="org.apache.doxia.velocity.util.DoxiaLibraryLoader"
+     */
+    private DoxiaLibraryLoader doxiaLibraryLoader;
+
+    /**
+     * @see AbstractVelocityRenderer#getLibraryLoader()
+     */
+    protected DoxiaLibraryLoader getLibraryLoader()
+    {
+        return doxiaLibraryLoader;
+    }
+}

Propchange: velocity/site/doxia-velocity-renderer/src/main/java/org/apache/doxia/velocity/renderer/VelocityAptRenderer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: velocity/site/doxia-velocity-renderer/src/main/java/org/apache/doxia/velocity/renderer/VelocityAptRenderer.java
------------------------------------------------------------------------------
    svn:keywords = Id Author Date Revision

Added: velocity/site/doxia-velocity-renderer/src/main/java/org/apache/doxia/velocity/renderer/VelocityAptSiteModule.java
URL: http://svn.apache.org/viewvc/velocity/site/doxia-velocity-renderer/src/main/java/org/apache/doxia/velocity/renderer/VelocityAptSiteModule.java?view=auto&rev=490562
==============================================================================
--- velocity/site/doxia-velocity-renderer/src/main/java/org/apache/doxia/velocity/renderer/VelocityAptSiteModule.java (added)
+++ velocity/site/doxia-velocity-renderer/src/main/java/org/apache/doxia/velocity/renderer/VelocityAptSiteModule.java Wed Dec 27 12:24:58 2006
@@ -0,0 +1,63 @@
+package org.apache.doxia.velocity.renderer;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.doxia.site.module.SiteModule;
+
+
+/**
+ * This module connects the renderer with the Doxia core. It defines the parameters for the Velocity/Apt rendering process.
+ *
+ * @plexus.component  role="org.apache.maven.doxia.site.module.SiteModule" role-hint="velocity-apt"
+ *
+ * @author  <a href="mailto:henning@apache.org">Henning P. Schmiedehausen</a>
+ * @version  $Revision$
+ */
+public final class VelocityAptSiteModule
+    implements SiteModule
+{
+    /**
+     * Returns the Source Directory. Default value is <code>velocity/apt</code>.
+     * @see  SiteModule#getSourceDirectory()
+     */
+    public String getSourceDirectory()
+    {
+        return "velocity/apt";
+    }
+
+    /**
+     * Returns the File extension. Default value is <code>apt</code>.
+     * @see  SiteModule#getExtension()
+     */
+    public String getExtension()
+    {
+        return "apt";
+    }
+
+    /**
+     * Returns the parser id for the files to render. Points to the {@link VelocityAptRenderer}.
+     * @see  SiteModule#getParserId()
+     */
+    public String getParserId()
+    {
+        return "velocity-apt";
+    }
+
+}

Propchange: velocity/site/doxia-velocity-renderer/src/main/java/org/apache/doxia/velocity/renderer/VelocityAptSiteModule.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: velocity/site/doxia-velocity-renderer/src/main/java/org/apache/doxia/velocity/renderer/VelocityAptSiteModule.java
------------------------------------------------------------------------------
    svn:keywords = Id Author Date Revision

Added: velocity/site/doxia-velocity-renderer/src/main/java/org/apache/doxia/velocity/renderer/VelocityXdocRenderer.java
URL: http://svn.apache.org/viewvc/velocity/site/doxia-velocity-renderer/src/main/java/org/apache/doxia/velocity/renderer/VelocityXdocRenderer.java?view=auto&rev=490562
==============================================================================
--- velocity/site/doxia-velocity-renderer/src/main/java/org/apache/doxia/velocity/renderer/VelocityXdocRenderer.java (added)
+++ velocity/site/doxia-velocity-renderer/src/main/java/org/apache/doxia/velocity/renderer/VelocityXdocRenderer.java Wed Dec 27 12:24:58 2006
@@ -0,0 +1,93 @@
+package org.apache.doxia.velocity.renderer;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.doxia.velocity.util.DoxiaLibraryLoader;
+import org.apache.doxia.velocity.util.DoxiaVelocityContextFactory;
+import org.apache.maven.doxia.parser.Parser;
+
+
+/**
+ * This is the xdoc-parsing instance of the {@link AbstractVelocityRenderer}.
+ *
+ * @plexus.component  role="org.apache.maven.doxia.parser.Parser" role-hint="velocity-xdoc"
+ *
+ * @author  <a href="mailto:henning@apache.org">Henning P. Schmiedehausen</a>
+ * @version  $Revision$
+ */
+public class VelocityXdocRenderer
+    extends AbstractVelocityRenderer
+{
+    /**
+     * Creates a new VelocityXdocRenderer object.
+     */
+    public VelocityXdocRenderer()
+    {
+    }
+
+    /**
+     * Here we get the actual apt parser from the Doxia core. It will render our processed template.
+     *
+     * @plexus.requirement  role="org.apache.maven.doxia.parser.Parser" role-hint="xdoc"
+     */
+    private Parser parser;
+
+    /**
+     * @see AbstractVelocityRenderer#getParser()
+     */
+    protected Parser getParser()
+    {
+        return parser;
+    }
+
+    /**
+     * The Velocity Context Factory. This gets managed by Plexus as a singleton. However as
+     * we are not inside the Mojo API here, we must use the Plexus requirement annotation, not
+     * the Mojo component annotation. Yes, this is important (and confusing, too).
+     *
+     * @plexus.requirement  role="org.apache.doxia.velocity.util.DoxiaVelocityContextFactory"
+     */
+    private DoxiaVelocityContextFactory doxiaVelocityContextFactory;
+
+    /**
+     * @see AbstractVelocityRenderer#getContextFactory()
+     */
+    protected DoxiaVelocityContextFactory getContextFactory()
+    {
+        return doxiaVelocityContextFactory;
+    }
+
+    /**
+     * The Velocity Library Loader. This gets managed by Plexus as a singleton. However as
+     * we are not inside the Mojo API here, we must use the Plexus requirement annotation, not
+     * the Mojo component annotation. Yes, this is important (and confusing, too).
+     *
+     * @plexus.requirement  role="org.apache.doxia.velocity.util.DoxiaLibraryLoader"
+     */
+    private DoxiaLibraryLoader doxiaLibraryLoader;
+
+    /**
+     * @see AbstractVelocityRenderer#getLibraryLoader()
+     */
+    protected DoxiaLibraryLoader getLibraryLoader()
+    {
+        return doxiaLibraryLoader;
+    }
+}

Propchange: velocity/site/doxia-velocity-renderer/src/main/java/org/apache/doxia/velocity/renderer/VelocityXdocRenderer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: velocity/site/doxia-velocity-renderer/src/main/java/org/apache/doxia/velocity/renderer/VelocityXdocRenderer.java
------------------------------------------------------------------------------
    svn:keywords = Id Author Date Revision

Added: velocity/site/doxia-velocity-renderer/src/main/java/org/apache/doxia/velocity/renderer/VelocityXdocSiteModule.java
URL: http://svn.apache.org/viewvc/velocity/site/doxia-velocity-renderer/src/main/java/org/apache/doxia/velocity/renderer/VelocityXdocSiteModule.java?view=auto&rev=490562
==============================================================================
--- velocity/site/doxia-velocity-renderer/src/main/java/org/apache/doxia/velocity/renderer/VelocityXdocSiteModule.java (added)
+++ velocity/site/doxia-velocity-renderer/src/main/java/org/apache/doxia/velocity/renderer/VelocityXdocSiteModule.java Wed Dec 27 12:24:58 2006
@@ -0,0 +1,63 @@
+package org.apache.doxia.velocity.renderer;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.doxia.site.module.SiteModule;
+
+
+/**
+ * This module connects the renderer with the Doxia core. It defines the parameters for the Velocity/Xdoc rendering process.
+ *
+ * @plexus.component  role="org.apache.maven.doxia.site.module.SiteModule" role-hint="velocity-xdoc"
+ *
+ * @author  <a href="mailto:henning@apache.org">Henning P. Schmiedehausen</a>
+ * @version  $Revision$
+ */
+public final class VelocityXdocSiteModule
+    implements SiteModule
+{
+    /**
+     * Returns the Source Directory. Default value is <code>velocity/xdoc</code>.
+     * @see  SiteModule#getSourceDirectory()
+     */
+    public String getSourceDirectory()
+    {
+        return "velocity/xdoc";
+    }
+
+    /**
+     * Returns the File extension. Default value is <code>xml</code>.
+     * @see  SiteModule#getExtension()
+     */
+    public String getExtension()
+    {
+        return "xml";
+    }
+
+    /**
+     * Returns the parser id for the files to render. Points to the {@link VelocityXdocRenderer}.
+     * @see  SiteModule#getParserId()
+     */
+    public String getParserId()
+    {
+        return "velocity-xdoc";
+    }
+
+}

Propchange: velocity/site/doxia-velocity-renderer/src/main/java/org/apache/doxia/velocity/renderer/VelocityXdocSiteModule.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: velocity/site/doxia-velocity-renderer/src/main/java/org/apache/doxia/velocity/renderer/VelocityXdocSiteModule.java
------------------------------------------------------------------------------
    svn:keywords = Id Author Date Revision

Added: velocity/site/doxia-velocity-renderer/src/main/java/org/apache/doxia/velocity/util/AbstractDoxiaResourceLoader.java
URL: http://svn.apache.org/viewvc/velocity/site/doxia-velocity-renderer/src/main/java/org/apache/doxia/velocity/util/AbstractDoxiaResourceLoader.java?view=auto&rev=490562
==============================================================================
--- velocity/site/doxia-velocity-renderer/src/main/java/org/apache/doxia/velocity/util/AbstractDoxiaResourceLoader.java (added)
+++ velocity/site/doxia-velocity-renderer/src/main/java/org/apache/doxia/velocity/util/AbstractDoxiaResourceLoader.java Wed Dec 27 12:24:58 2006
@@ -0,0 +1,94 @@
+package org.apache.doxia.velocity.util;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.InputStream;
+
+import org.apache.commons.collections.ExtendedProperties;
+import org.apache.velocity.exception.ResourceNotFoundException;
+import org.apache.velocity.runtime.resource.Resource;
+import org.apache.velocity.runtime.resource.loader.ResourceLoader;
+
+
+/**
+ * This is the base for Doxia-related Velocity {@link ResourceLoader}. It short cuts
+ * the caching mechanism and makes sure that Resource loaders deriving from this base
+ * class never cache templates.
+ *
+ * @author  <a href="mailto:henning@apache.org">Henning P. Schmiedehausen</a>
+ * @version  $Revision$
+ */
+public abstract class AbstractDoxiaResourceLoader
+    extends ResourceLoader
+{
+
+    /**
+     * Creates a new AbstractDoxiaResourceLoader object.
+     */
+    protected AbstractDoxiaResourceLoader()
+    {
+        super.setCachingOn(false);
+    }
+
+    /**
+     * @see ResourceLoader#init(ExtendedProperties)
+     */
+    public void init(final ExtendedProperties properties)
+    {
+    }
+
+    /**
+     * @see ResourceLoader#setCachingOn(boolean)
+     */
+    public void setCachingOn(final boolean caching)
+    {
+        // Does nothing. We never want to be cached!
+    }
+
+    /**
+     * @see ResourceLoader#isCachingOn()
+     */
+    public boolean isCachingOn()
+    {
+        return false;
+    }
+
+    /**
+     * @see ResourceLoader#getLastModified(Resource)
+     */
+    public long getLastModified(final Resource resource)
+    {
+        return 0;
+    }
+
+    /**
+     * @see ResourceLoader#isSourceModified(Resource)
+     */
+    public boolean isSourceModified(final Resource resource)
+    {
+        return false;
+    }
+
+    /**
+     * @see ResourceLoader#getResourceStream(String)
+     */
+    public abstract InputStream getResourceStream(final String templateName)
+        throws ResourceNotFoundException;
+}

Propchange: velocity/site/doxia-velocity-renderer/src/main/java/org/apache/doxia/velocity/util/AbstractDoxiaResourceLoader.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: velocity/site/doxia-velocity-renderer/src/main/java/org/apache/doxia/velocity/util/AbstractDoxiaResourceLoader.java
------------------------------------------------------------------------------
    svn:keywords = Id Author Date Revision

Added: velocity/site/doxia-velocity-renderer/src/main/java/org/apache/doxia/velocity/util/DefaultDoxiaLibraryLoader.java
URL: http://svn.apache.org/viewvc/velocity/site/doxia-velocity-renderer/src/main/java/org/apache/doxia/velocity/util/DefaultDoxiaLibraryLoader.java?view=auto&rev=490562
==============================================================================
--- velocity/site/doxia-velocity-renderer/src/main/java/org/apache/doxia/velocity/util/DefaultDoxiaLibraryLoader.java (added)
+++ velocity/site/doxia-velocity-renderer/src/main/java/org/apache/doxia/velocity/util/DefaultDoxiaLibraryLoader.java Wed Dec 27 12:24:58 2006
@@ -0,0 +1,179 @@
+package org.apache.doxia.velocity.util;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Iterator;
+
+import org.apache.commons.collections.iterators.ArrayIterator;
+import org.apache.commons.lang.StringUtils;
+import org.apache.velocity.exception.ResourceNotFoundException;
+import org.codehaus.plexus.logging.LogEnabled;
+import org.codehaus.plexus.logging.Logger;
+
+
+/**
+ * This {@link org.apache.velocity.runtime.resource.loader.ResourceLoader} is responsible for loading the
+ * configured macro libraries. It can load only the defined macro libraries (no inclusion or parsing is possible
+ * for security reasons) from the <code>${siteDirectory}/velocity/resources</code> directory.
+ *
+ * This is a plexus-managed component which gets configured by the {@link
+ * org.apache.doxia.velocity.plugin.DoxiaVelocityRendererPlugin} during the post-site phase.
+ *
+ * @plexus.component  role="org.apache.doxia.velocity.util.DoxiaLibraryLoader"
+ *
+ * @author  <a href="mailto:henning@apache.org">Henning P. Schmiedehausen</a>
+ * @version  $Revision$
+ */
+public class DefaultDoxiaLibraryLoader
+    extends AbstractDoxiaResourceLoader
+    implements DoxiaLibraryLoader,
+        LogEnabled
+{
+
+    /** List of libraries known to this loader. */
+    private String[] knownLibraries = null;
+
+    /** File object representing the site source directory. */
+    private File siteDirectory = null;
+
+    /** Plexus Logger object */
+    private Logger logger = null;
+
+    /**
+     * Creates a new DefaultDoxiaLibraryLoader object.
+     */
+    public DefaultDoxiaLibraryLoader()
+    {
+    }
+
+    /**
+     * @see LogEnabled#enableLogging(Logger)
+     */
+    public void enableLogging(final Logger logger)
+    {
+        this.logger = logger;
+    }
+
+    /**
+     * Sets the list of known library. This is called from the {@link org.apache.doxia.velocity.plugin.DoxiaVelocityRendererPlugin}.
+     *
+     * @param  knownLibraries  An Array of Strings with the names of libraries to load. Can be null.
+     */
+    public void setKnownLibraries(final String[] knownLibraries)
+    {
+        this.knownLibraries = knownLibraries;
+
+        if (logger.isDebugEnabled())
+        {
+            logger.debug("Known Libraries: " + knownLibraries);
+        }
+    }
+
+    /**
+     * Returns the list of known macro libraries.
+     *
+     * @return  An array of strings with the names of the known libraries or null if none are defined.
+     */
+    public String[] getKnownLibraries()
+    {
+        return this.knownLibraries;
+    }
+
+    /**
+     * Set the base directory for the maven site generation.
+     *
+     * @param  siteDirectory  A file object representing the site source directory.
+     */
+    public void setSiteDirectory(File siteDirectory)
+    {
+        this.siteDirectory = siteDirectory;
+
+        if (logger.isDebugEnabled())
+        {
+            logger.debug("Site Directory: " + siteDirectory);
+        }
+    }
+
+    /**
+     * Returns an input stream for the given template name. This resource loader can only
+     * load the macro libraries configured with the {@link #setKnownLibraries(String[])} method
+     * and they must be located in the <code>velocity/resources</code> sub-directory of the
+     * maven site source directory.
+     *
+     * @param  templateName  The name of the template to load.
+     *
+     * @return  An {@link InputStream} object for the given template name or null when the
+     *          template is now available through this resource loader.
+     *
+     * @throws ResourceNotFoundException When the resource loader should have been able to
+     *                                   supply this resource but encountered an error.
+     */
+    public InputStream getResourceStream(final String templateName)
+        throws ResourceNotFoundException
+    {
+
+        if ((knownLibraries == null) || (siteDirectory == null) || StringUtils.isEmpty(templateName))
+        {
+            return null;
+        }
+
+        for (Iterator it = new ArrayIterator(knownLibraries); it.hasNext();)
+        {
+            String library = (String) it.next();
+
+            if (StringUtils.equals(library, templateName))
+            {
+                File macroFile = new File(siteDirectory, "/velocity/resources/" + templateName);
+
+                if (logger.isDebugEnabled())
+                {
+                    logger.debug("Macro File is " + macroFile + " (exists: " + macroFile.exists() + ")");
+                }
+
+                if (macroFile.exists() && macroFile.isFile())
+                {
+                    try
+                    {
+                        return new FileInputStream(macroFile);
+                    }
+                    catch (IOException ioe)
+                    {
+                        throw new ResourceNotFoundException("While opening " + macroFile + ": ", ioe);
+                    }
+                }
+                else
+                {
+                    if (logger.isWarnEnabled())
+                    {
+                        throw new ResourceNotFoundException(macroFile + " could not be loaded!");
+                    }
+                }
+
+                return null;
+            }
+        }
+
+        return null;
+    }
+}

Propchange: velocity/site/doxia-velocity-renderer/src/main/java/org/apache/doxia/velocity/util/DefaultDoxiaLibraryLoader.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: velocity/site/doxia-velocity-renderer/src/main/java/org/apache/doxia/velocity/util/DefaultDoxiaLibraryLoader.java
------------------------------------------------------------------------------
    svn:keywords = Id Author Date Revision

Added: velocity/site/doxia-velocity-renderer/src/main/java/org/apache/doxia/velocity/util/DefaultDoxiaVelocityContextFactory.java
URL: http://svn.apache.org/viewvc/velocity/site/doxia-velocity-renderer/src/main/java/org/apache/doxia/velocity/util/DefaultDoxiaVelocityContextFactory.java?view=auto&rev=490562
==============================================================================
--- velocity/site/doxia-velocity-renderer/src/main/java/org/apache/doxia/velocity/util/DefaultDoxiaVelocityContextFactory.java (added)
+++ velocity/site/doxia-velocity-renderer/src/main/java/org/apache/doxia/velocity/util/DefaultDoxiaVelocityContextFactory.java Wed Dec 27 12:24:58 2006
@@ -0,0 +1,103 @@
+package org.apache.doxia.velocity.util;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.apache.commons.collections.iterators.ArrayIterator;
+import org.apache.commons.lang.StringUtils;
+import org.apache.velocity.VelocityContext;
+
+
+/**
+ * This factory returns configured {@link VelocityContext} objects for the renderers.
+ *
+ * This is a plexus managed singleton which gets configured by the {@link
+ * org.apache.doxia.velocity.plugin.DoxiaVelocityRendererPlugin} during the pre-site phase.
+ *
+ * The various Velocity renderer then instantiate the configured Factory through Plexus in the actual site phase.
+ *
+ * @plexus.component  role="org.apache.doxia.velocity.util.DoxiaVelocityContextFactory"
+ *
+ * @author  <a href="mailto:henning@apache.org">Henning P. Schmiedehausen</a>
+ * @version  $Revision$
+ */
+public class DefaultDoxiaVelocityContextFactory
+    implements DoxiaVelocityContextFactory
+{
+    /** Map of elements that should be put in the context. */
+    private final Map contextElements = new HashMap();
+
+    /**
+     * List of user configured Velocity Tools.
+     *
+     * @see org.apache.doxia.velocity.plugin.DoxiaVelocityRendererPlugin#tools.
+     */
+    private VelocityTool [] tools;
+
+    /**
+     * @see DoxiaVelocityContextFactory#setTools(VelocityTool[])
+     */
+    public void setTools(final VelocityTool[] tools)
+    {
+        this.tools = tools;
+    }
+
+    /**
+     * @see DoxiaVelocityContextFactory#addContextElement(String, Object)
+     */
+    public void addContextElement(final String elementName, final Object elementValue)
+    {
+        contextElements.put(elementName, elementValue);
+    }
+
+    /**
+     * @see DoxiaVelocityContextFactory#getVelocityContext()
+     */
+    public VelocityContext getVelocityContext()
+    {
+        VelocityContext ctx = new VelocityContext();
+
+        for (Iterator it = contextElements.entrySet().iterator(); it.hasNext(); )
+        {
+            Map.Entry entry = (Map.Entry) it.next();
+
+            ctx.put(String.valueOf(entry.getKey()), entry.getValue());
+        }
+
+        if (tools != null)
+        {
+            for (Iterator it = new ArrayIterator(tools); it.hasNext();)
+            {
+                VelocityTool tool = (VelocityTool) it.next();
+
+                if (StringUtils.isNotEmpty(tool.getToolName()))
+                {
+                    ctx.put(tool.getToolName(),
+                            tool.getInstance());
+                }
+            }
+        }
+
+        return ctx;
+    }
+}

Propchange: velocity/site/doxia-velocity-renderer/src/main/java/org/apache/doxia/velocity/util/DefaultDoxiaVelocityContextFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: velocity/site/doxia-velocity-renderer/src/main/java/org/apache/doxia/velocity/util/DefaultDoxiaVelocityContextFactory.java
------------------------------------------------------------------------------
    svn:keywords = Id Author Date Revision