Interface ModernizerBackend


public interface ModernizerBackend
Operations the terminal UI delegates to the modernizer
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    applyRecipe(String recipe, String plugin, boolean dryRun)
    Apply a recipe to a plugin.
    Validate the configuration and describe the environment: Java, Maven, GitHub, cache and installed JDKs.
    boolean
     
    Expand what a user typed for one plugin: a file lists plugins one per line (like --plugin-file), a directory is a local plugin (like --plugin-path) and anything else is a plugin name.
    boolean
    Collect the metadata of a plugin.
     
    sources(String plugin)
    Directory holding the sources of a plugin: the directory itself for a local plugin, its clone in the cache otherwise.
     
  • Method Details

    • version

      String version()
      Returns:
      the version of the modernizer
    • recipes

      List<RecipeInfo> recipes()
      Returns:
      the available recipes
    • expandPlugins

      List<String> expandPlugins(String value)
      Expand what a user typed for one plugin: a file lists plugins one per line (like --plugin-file), a directory is a local plugin (like --plugin-path) and anything else is a plugin name.
      Parameters:
      value - a plugin name, a directory or a file, as an absolute path for files and directories
      Returns:
      the plugin names or paths to process
      Throws:
      IllegalArgumentException - if a file cannot be read
    • fetchMetadata

      boolean fetchMetadata(String plugin) throws Exception
      Collect the metadata of a plugin. Called from a task thread.
      Parameters:
      plugin - plugin name or local plugin path
      Returns:
      true if the metadata was collected without errors
      Throws:
      Exception - if the plugin cannot be processed
    • applyRecipe

      boolean applyRecipe(String recipe, String plugin, boolean dryRun) throws Exception
      Apply a recipe to a plugin. Called from a task thread.
      Parameters:
      recipe - recipe name, as listed by recipes()
      plugin - plugin name or local plugin path
      dryRun - true to only apply the recipe locally, false to also open a pull request
      Returns:
      true if the recipe was applied without errors
      Throws:
      Exception - if the plugin cannot be processed
    • sources

      Path sources(String plugin)
      Directory holding the sources of a plugin: the directory itself for a local plugin, its clone in the cache otherwise. A remote plugin is only cloned once a task processes it.
      Parameters:
      plugin - plugin name or local plugin path
      Returns:
      the absolute path of the sources, which may not exist yet
    • doctor

      List<DoctorCheck> doctor()
      Validate the configuration and describe the environment: Java, Maven, GitHub, cache and installed JDKs. Called from a background thread.
      Returns:
      the checks, grouped by section in display order
    • draft

      boolean draft()
      Returns:
      true if pull requests are opened as drafts