Class VelocityService

java.lang.Object
de.willuhn.jameica.services.VelocityService
All Implemented Interfaces:
de.willuhn.boot.Bootable

public class VelocityService extends Object implements de.willuhn.boot.Bootable
Resource-Loader von Velocity.
  • Constructor Details

    • VelocityService

      public VelocityService()
  • Method Details

    • depends

      public Class[] depends()
      Specified by:
      depends in interface de.willuhn.boot.Bootable
      See Also:
      • Bootable.depends()
    • init

      public void init(de.willuhn.boot.BootLoader loader, de.willuhn.boot.Bootable caller) throws de.willuhn.boot.SkipServiceException
      Specified by:
      init in interface de.willuhn.boot.Bootable
      Throws:
      de.willuhn.boot.SkipServiceException
      See Also:
      • Bootable.init(de.willuhn.boot.BootLoader, de.willuhn.boot.Bootable)
    • shutdown

      public void shutdown()
      Specified by:
      shutdown in interface de.willuhn.boot.Bootable
      See Also:
      • Bootable.shutdown()
    • getEngine

      public org.apache.velocity.app.VelocityEngine getEngine(String plugin)
      Liefert die Velocity-Engine fuer das angegebene Plugin.
      Parameters:
      plugin - Name des Plugins oder Name der Plugin-Klasse.
      Returns:
      die Velocity-Engine oder die Default-Velocity-Engine von Jameica selbst wenn keine Plugin-spezifische gefunden wurde.
    • merge

      public String merge(String source, Map<String,Object> context) throws IOException
      Interpretiert das Velocity-Template im String "source" und nimmt alle Ersetzungen gemaess dem Context. Das ist eine bequeme "Convenience"-Funktion, um mal schnell was in einem String zu ersetzen, ohne erst manuell eine ganze VelocityEngine samt Readern und Writern programmieren zu muessen.
      Parameters:
      source - Der Text mit den Velocity-Platzhaltern.
      context - Map mit den Velocity-Parametern.
      Returns:
      der verarbeitete Text.
      Throws:
      IOException