Class SimpleCommandLine
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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classException to be thrown during processing. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected static voidInitialize the logging subsystem.static voidMain method.private static voidBuild the context and run the pipeline.private static voidsetLoggingProperty(String value) Set the logback configuration to a specific location.private static voidsetLoggingToLocalResource(String value) Set the logback configuration to a specific package-local resource.
-
Field Details
-
RC_INIT
public static final int RC_INITReturn code indicating an initialization error, 1 .- See Also:
-
log
private static org.slf4j.Logger logClass logger.
-
-
Constructor Details
-
SimpleCommandLine
private SimpleCommandLine()Constructor.
-
-
Method Details
-
main
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
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
Set the logback configuration to a specific package-local resource.- Parameters:
value- name of resource to use as the logback configuration file
-
initLogging
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
-