Class CliBootstrap

java.lang.Object
nz.org.riskscape.engine.cli.CliBootstrap

public class CliBootstrap extends Object

Class for controlling engine boostrapping for a CLI process/engine

  • Field Details

  • Constructor Details

    • CliBootstrap

      public CliBootstrap()
  • Method Details

    • getInstance

      public static CliBootstrap getInstance()
    • changeState

      protected void changeState(CliBootstrap.State nextState, Runnable callback)
    • setApplicationHome

      public void setApplicationHome(Path appHome)
    • initializePlugins

      public void initializePlugins()
    • setRootOptions

      public void setRootOptions(CliRoot root)
    • setTerminal

      public void setTerminal(nz.org.riskscape.cli.Terminal term)
    • buildEngine

      public nz.org.riskscape.engine.DefaultEngine buildEngine()

      Builds an Engine and populates it with any service providers that may be provided by Plugins.

      Returns:
      engine as built
    • buildProject

      public nz.org.riskscape.engine.Project buildProject()

      Populates project resources (type, functions, bookmarks etc).

    • addApiI18nToMessages

      public void addApiI18nToMessages()

      We need a special case for loading any default messages defined in the api's jar. The api code is not loaded as a plugin so we need a special case

    • setLogLevel

      public void setLogLevel(String[] args)

      Scans a list of command line args looking for --log-level=foo or --log-level foo

    • parseLogLevelFromArgs

      public static List<nz.org.riskscape.engine.util.Pair<ch.qos.logback.classic.Logger,ch.qos.logback.classic.Level>> parseLogLevelFromArgs(String[] args, nz.org.riskscape.cli.Terminal terminal)

      Available as a separate static method for unit testing

    • getBuilder

      public nz.org.riskscape.engine.ProjectBuilder getBuilder()
    • getState

      public CliBootstrap.State getState()
    • getTerminal

      public nz.org.riskscape.cli.Terminal getTerminal()
    • getCliRoot

      public CliRoot getCliRoot()
    • getEngine

      public nz.org.riskscape.engine.DefaultEngine getEngine()
    • getProject

      public nz.org.riskscape.engine.Project getProject()
    • getSettings

      public Map<String,List<String>> getSettings()
    • getPluginRepository

      public nz.org.riskscape.engine.plugin.PluginRepository getPluginRepository()
    • setPluginRepository

      public void setPluginRepository(nz.org.riskscape.engine.plugin.PluginRepository pluginRepository)
    • getExtensionPoints

      public nz.org.riskscape.engine.plugin.ExtensionPoints getExtensionPoints()
    • getMessages

      public nz.org.riskscape.engine.i18n.DefaultMessages getMessages()
    • getLayout

      public AppLayout getLayout()