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/30 21:07:56 UTC

svn commit: r491298 - in /velocity/site/doxia-velocity-renderer/src/main/java/org/apache/doxia/velocity/renderer: AbstractVelocityRenderer.java VelocityAptRenderer.java VelocityXdocRenderer.java

Author: henning
Date: Sat Dec 30 12:07:55 2006
New Revision: 491298

URL: http://svn.apache.org/viewvc?view=rev&rev=491298
Log:
Update Renderer because the Plexus plugin does work as expected (thanks trygvis).


Modified:
    velocity/site/doxia-velocity-renderer/src/main/java/org/apache/doxia/velocity/renderer/AbstractVelocityRenderer.java
    velocity/site/doxia-velocity-renderer/src/main/java/org/apache/doxia/velocity/renderer/VelocityAptRenderer.java
    velocity/site/doxia-velocity-renderer/src/main/java/org/apache/doxia/velocity/renderer/VelocityXdocRenderer.java

Modified: 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=diff&rev=491298&r1=491297&r2=491298
==============================================================================
--- velocity/site/doxia-velocity-renderer/src/main/java/org/apache/doxia/velocity/renderer/AbstractVelocityRenderer.java (original)
+++ velocity/site/doxia-velocity-renderer/src/main/java/org/apache/doxia/velocity/renderer/AbstractVelocityRenderer.java Sat Dec 30 12:07:55 2006
@@ -49,10 +49,7 @@
 
 /**
  * <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>
+ * plugin cycle but gets instantiated by Plexus itself.</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
@@ -85,6 +82,24 @@
     private DoxiaResourceLoader doxiaResourceLoader = null;
 
     /**
+     * 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;
+
+    /**
+     * 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;
+
+    /**
      * Creates a new AbstractVelocityRenderer object.
      */
     protected AbstractVelocityRenderer()
@@ -93,11 +108,7 @@
 
     /**
      * 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>
+     * component. This is where the Xdoc and the Apt parser differ.
      *
      * @return  A {@link Parser} instance that is the actual parser for this document type once Velocity processed the template.
      */
@@ -106,32 +117,28 @@
     /**
      * 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>
+     * It must be injected into an instance of this component.
      *
      * @return  A {@link DoxiaVelocityContextFactory} instance that generates
      *          {@link VelocityContext} objects for the render process.
      */
-    protected abstract DoxiaVelocityContextFactory getContextFactory();
+    protected DoxiaVelocityContextFactory getContextFactory()
+    {
+        return doxiaVelocityContextFactory;
+    }
 
     /**
      * 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>
+     * It must be injected into an instance of this component.
      *
      * @return  A {@link org.apache.velocity.runtime.resource.loader.ResourceLoader} object.
      */
-    protected abstract DoxiaLibraryLoader getLibraryLoader();
+    protected DoxiaLibraryLoader getLibraryLoader()
+    {
+        return doxiaLibraryLoader;
+    }
 
     /**
      * Returns the Plexus logger.

Modified: 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=diff&rev=491298&r1=491297&r2=491298
==============================================================================
--- velocity/site/doxia-velocity-renderer/src/main/java/org/apache/doxia/velocity/renderer/VelocityAptRenderer.java (original)
+++ velocity/site/doxia-velocity-renderer/src/main/java/org/apache/doxia/velocity/renderer/VelocityAptRenderer.java Sat Dec 30 12:07:55 2006
@@ -19,8 +19,6 @@
  * under the License.
  */
 
-import org.apache.doxia.velocity.util.DoxiaLibraryLoader;
-import org.apache.doxia.velocity.util.DoxiaVelocityContextFactory;
 import org.apache.maven.doxia.parser.Parser;
 
 
@@ -55,39 +53,5 @@
     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;
     }
 }

Modified: 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=diff&rev=491298&r1=491297&r2=491298
==============================================================================
--- velocity/site/doxia-velocity-renderer/src/main/java/org/apache/doxia/velocity/renderer/VelocityXdocRenderer.java (original)
+++ velocity/site/doxia-velocity-renderer/src/main/java/org/apache/doxia/velocity/renderer/VelocityXdocRenderer.java Sat Dec 30 12:07:55 2006
@@ -19,8 +19,6 @@
  * under the License.
  */
 
-import org.apache.doxia.velocity.util.DoxiaLibraryLoader;
-import org.apache.doxia.velocity.util.DoxiaVelocityContextFactory;
 import org.apache.maven.doxia.parser.Parser;
 
 
@@ -55,39 +53,5 @@
     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;
     }
 }