Class CommandLineProcessor
- java.lang.Object
-
- org.pentaho.platform.plugin.services.importexport.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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CommandLineProcessor.DatasourceType
static class
CommandLineProcessor.RequestType
static class
CommandLineProcessor.ResourceType
-
Constructor Summary
Constructors Modifier Constructor Description protected
CommandLineProcessor(String[] args)
Parses the command line and handles the situation where it isn't a valid import or export or rest request
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static String
getErrorMessage()
static Exception
getException()
Returns information about any exception encountered (if one was generated)protected String
getOptionValue(String option, boolean required, boolean emptyOk)
Returns the option value from the command lineprotected org.pentaho.platform.api.repository2.unified.IUnifiedRepository
getRepository()
Why does this return a web service? Going directly to the IUnifiedRepository requires the following:protected CommandLineProcessor.RequestType
getRequestType()
static void
main(String[] args)
How this class is executed from the command line.protected static void
printHelp()
void
setRepository(org.pentaho.platform.api.repository2.unified.IUnifiedRepository repository)
-
-
-
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, ornull
if none was generated
-
getRequestType
protected CommandLineProcessor.RequestType getRequestType()
-
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 requiredemptyOk
- 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()
-
-