Class BaseTrigger

java.lang.Object
org.codehaus.mojo.rpm.Scriptlet
org.codehaus.mojo.rpm.BaseTrigger
Direct Known Subclasses:
InstallTrigger, PostRemoveTrigger, RemoveTrigger

public abstract class BaseTrigger extends Scriptlet
A base class to support triggers.
Since:
2.0-beta-4
Author:
Brett Okken, Cerner Corporation
  • Constructor Details

    • BaseTrigger

      public BaseTrigger()
  • Method Details

    • getTriggers

      public List<String> getTriggers()
      Gets the packages/versions to trigger on.

      This is syntactically equivalent to a "Requires" specification (version numbers may be used). If multiple items are given, the trigger is run when *any* of those conditions becomes true.

      Returns:
      Returns the triggers.
    • setTriggers

      public void setTriggers(List<String> triggers)
      Sets the packages/versions to trigger on.
      Parameters:
      triggers - The triggers to set.
      See Also:
    • buildScriptletLine

      protected String buildScriptletLine(String directive)
      Builds the scriptlet line including any optional args.
      Overrides:
      buildScriptletLine in class Scriptlet
      Parameters:
      directive - The directive for the scriptlet.
      Returns:
      The scriptlet line - this does not include the script.
    • writeTrigger

      protected void writeTrigger(PrintWriter writer, AbstractRPMMojo mojo) throws IOException
      Writes the complete trigger directive. Use instead of Scriptlet.write(PrintWriter, String, AbstractRPMMojo).
      Parameters:
      writer - PrintWriter to write the trigger directive to.
      mojo - the AbstractRPMMojo which contains any resources needed when writing the trigger.
      Throws:
      IOException - if an I/IO error occurs
    • getDirective

      protected abstract String getDirective()
      Provides the trigger specific directive.
      Returns:
      The implementation specific directive.
    • toString

      public String toString()
      Overrides:
      toString in class Scriptlet