Class DefaultVelocityManager

  • All Implemented Interfaces:
    org.xwiki.component.phase.Initializable, org.xwiki.velocity.VelocityManager

    @Component
    @Singleton
    public class DefaultVelocityManager
    extends Object
    implements org.xwiki.velocity.VelocityManager, org.xwiki.component.phase.Initializable
    Note: This class should be moved to the Velocity module. However this is not possible right now since we need to populate the Velocity Context with XWiki objects that are located in the Core (such as the XWiki object for example) and since the Core needs to call the Velocity module this would cause a circular dependency.
    Since:
    1.5M1
    Version:
    $Id: b9a57cac3768c15065fca4c49e54ff913e596cbc $
    • Constructor Detail

      • DefaultVelocityManager

        public DefaultVelocityManager()
    • Method Detail

      • initialize

        public void initialize()
                        throws org.xwiki.component.phase.InitializationException
        Specified by:
        initialize in interface org.xwiki.component.phase.Initializable
        Throws:
        org.xwiki.component.phase.InitializationException
      • getVelocityContext

        public org.apache.velocity.VelocityContext getVelocityContext()
        Specified by:
        getVelocityContext in interface org.xwiki.velocity.VelocityManager
      • getCurrentVelocityContext

        public org.apache.velocity.VelocityContext getCurrentVelocityContext()
        Specified by:
        getCurrentVelocityContext in interface org.xwiki.velocity.VelocityManager
      • getVelocityEngine

        public org.xwiki.velocity.VelocityEngine getVelocityEngine()
                                                            throws org.xwiki.velocity.XWikiVelocityException
        Specified by:
        getVelocityEngine in interface org.xwiki.velocity.VelocityManager
        Returns:
        the Velocity Engine corresponding to the current execution context. More specifically returns the Velocity Engine for the current skin since each skin has its own Velocity Engine so that each skin can have global velocimacros defined
        Throws:
        org.xwiki.velocity.XWikiVelocityException - in case of an error while creating a Velocity Engine
      • evaluate

        public boolean evaluate​(Writer out,
                                String templateName,
                                Reader source)
                         throws org.xwiki.velocity.XWikiVelocityException
        Specified by:
        evaluate in interface org.xwiki.velocity.VelocityManager
        Throws:
        org.xwiki.velocity.XWikiVelocityException