Class SimpleCommandLine

java.lang.Object
net.shibboleth.metadata.cli.SimpleCommandLine

public final class SimpleCommandLine extends Object
A simple driver for the metadata aggregator.

This class takes two parameters, the first is the file path to the Spring configuration file. The second parameter is the name of bean ID of the Pipeline to be executed. If the pipeline is not initialized by Spring it will be initialized by this CLI.

Logging is configured through the logback.configurationFile system property. This property is set here depending on the command-line options selected. A value set outside this code will be overwritten and therefore ignored.

Because logback only looks at the logback.configurationFile once, on the first call to getLogger(), it is important that this code and anything referenced by it does not define static loggers, as this may cause premature initialisation with the default settings.

  • Field Details

    • RC_INIT

      public static final int RC_INIT
      Return code indicating an initialization error, 1 .
      See Also:
    • log

      private static org.slf4j.Logger log
      Class logger.
  • Constructor Details

    • SimpleCommandLine

      private SimpleCommandLine()
      Constructor.
  • Method Details

    • main

      public static void main(String[] args)
      Main method.
      Parameters:
      args - command line arguments
    • process

      private static void process(@Nonnull SimpleCommandLineArguments cli) throws SimpleCommandLine.ErrorException
      Build the context and run the pipeline.
      Parameters:
      cli - command line arguments
      Throws:
      SimpleCommandLine.ErrorException - if a problem requiring termination occurs
    • setLoggingProperty

      private static void setLoggingProperty(@Nonnull String value)
      Set the logback configuration to a specific location.

      Note that this must be done before the first logger is retrieved.

      Parameters:
      value - logback configuration location to set
    • setLoggingToLocalResource

      private static void setLoggingToLocalResource(@Nonnull String value)
      Set the logback configuration to a specific package-local resource.
      Parameters:
      value - name of resource to use as the logback configuration file
    • initLogging

      protected static void initLogging(SimpleCommandLineArguments cli)
      Initialize the logging subsystem.

      Because this sets the system property logback uses for configuration, it must be called before any calls to LoggerFactory.getLogger(java.lang.Class<?>).

      Parameters:
      cli - command line arguments