Class CommandLineProcessor


  • public class CommandLineProcessor
    extends Object
    Handles the parsing of command line arguments and creates an import process based upon them
    Author:
    David M. Kincade
    • Constructor Detail

      • CommandLineProcessor

        protected CommandLineProcessor​(String[] args)
                                throws org.apache.commons.cli.ParseException
        Parses the command line and handles the situation where it isn't a valid import or export or rest request
        Parameters:
        args - the command line arguments
        Throws:
        org.apache.commons.cli.ParseException - indicates that neither (or both) an import and/or export have been request
    • Method Detail

      • main

        public static void main​(String[] args)
                         throws Exception
        How this class is executed from the command line.
        Parameters:
        args -
        Throws:
        Exception
      • getException

        public static Exception getException()
        Returns information about any exception encountered (if one was generated)
        Returns:
        the Exception that was generated, or null if none was generated
      • setRepository

        public void setRepository​(org.pentaho.platform.api.repository2.unified.IUnifiedRepository repository)
      • getRepository

        protected org.pentaho.platform.api.repository2.unified.IUnifiedRepository getRepository()
                                                                                         throws org.apache.commons.cli.ParseException,
                                                                                                org.pentaho.di.core.exception.KettleException
        Why does this return a web service? Going directly to the IUnifiedRepository requires the following:

        • PentahoSessionHolder setup including password and tenant ID. (The server doesn't even process passwords today-- it assumes that Spring Security processed it. This would require code changes.)
        • User must specify path to Jackrabbit files (i.e. system/jackrabbit).
        Throws:
        org.apache.commons.cli.ParseException
        org.pentaho.di.core.exception.KettleException
      • getOptionValue

        protected String getOptionValue​(String option,
                                        boolean required,
                                        boolean emptyOk)
                                 throws org.apache.commons.cli.ParseException
        Returns the option value from the command line
        Parameters:
        option - the option whose value should be returned (NOTE: null will be returned if the option was not provided)
        required - indicates if the option is required
        emptyOk - indicates if a blank value is acceptable
        Returns:
        the value provided from the command line, or null if none was provided
        Throws:
        org.apache.commons.cli.ParseException - indicates the required or non-blank value was not provided
      • getErrorMessage

        public static String getErrorMessage()
      • printHelp

        protected static void printHelp()