Interface Command

All Known Implementing Classes:
Clean, Infer, Make, Mark, Publish

public interface Command
The Command interface must be implemented by all Nyx commands.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Returns true if this command is up to date, which means that the internal state (state()) would not change by running (run()) the command again.
    run()
    Runs the command and returns the updated reference to the state object.
    Returns the state object.
  • Method Details

    • state

      State state()
      Returns the state object.
      Returns:
      the state object that was passed in the constructor (never null, even when or after run() returns null).
    • isUpToDate

      Returns true if this command is up to date, which means that the internal state (state()) would not change by running (run()) the command again. It other words, when this method returns true any invocation of the (run()) method is needless and idempotent about the state. This method uses the quickest method to verify whether the state is up to date or not. This method must not rely on dependencies and it must always evaluate its own status independently. As a general rule this method checks if its inputs (i.e. from the configuration) have changed since the last run.
      Returns:
      true if this command is up to date
      Throws:
      DataAccessException - in case the configuration can't be loaded for some reason.
      IllegalPropertyException - in case the configuration has some illegal options.
      GitException - in case of unexpected issues when accessing the Git repository.
      See Also:
      state(), run()
    • run

      Runs the command and returns the updated reference to the state object. In order to improve performances you should only invoke this method when isUpToDate() returns false.
      Returns:
      the updated reference to the state object. The returned object is the same instance passed in the constructor or null if the command has cleared the state.
      Throws:
      DataAccessException - in case the configuration can't be loaded for some reason.
      IllegalPropertyException - in case the configuration has some illegal options.
      GitException - in case of unexpected issues when accessing the Git repository.
      ReleaseException - if the task is unable to complete for reasons due to the release process.
      See Also:
      isUpToDate(), state()