public abstract class AbstractBinary
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
protected java.util.logging.Logger |
logger
for logging.
|
protected boolean |
outputCommandline
whether to output the commandline.
|
| Constructor and Description |
|---|
AbstractBinary()
Initializes the object.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.ProcessBuilder |
builder()
Returns a configured
ProcessBuilder to be used for executing
the rsync process. |
abstract java.util.List<java.lang.String> |
commandLineArgs()
Assembles the full command-line arguments.
|
protected abstract java.lang.String |
description()
Returns a short description for the binary.
|
com.github.fracpete.processoutput4j.output.CollectingProcessOutput |
execute()
Executes the rsync binary for the platform and waits for its completion.
|
boolean |
getOutputCommandline()
Returns output commandline flag.
|
protected net.sourceforge.argparse4j.inf.ArgumentParser |
getParser()
Configures and returns the commandline parser.
|
abstract java.util.List<java.lang.String> |
options()
Assembles the arguments for the rsync binary.
|
AbstractBinary |
outputCommandline(boolean value)
Sets output commandline flag.
|
void |
reset()
Resets the members.
|
static void |
run(AbstractBinary binary,
java.lang.String[] args)
Runs the binary with the arguments.
|
protected boolean |
setOptions(net.sourceforge.argparse4j.inf.Namespace ns)
Sets the parsed options.
|
boolean |
setOptions(java.lang.String[] options)
Sets the commandline options.
|
java.lang.Process |
start()
Starts the rsync process for the platform.
|
protected java.util.logging.Logger logger
protected boolean outputCommandline
public void reset()
public AbstractBinary outputCommandline(boolean value)
value - true if to output commandlinepublic boolean getOutputCommandline()
public abstract java.util.List<java.lang.String> options()
throws java.lang.Exception
java.lang.Exception - if failed to determine binarypublic abstract java.util.List<java.lang.String> commandLineArgs()
throws java.lang.Exception
java.lang.Exception - if failed to determine binaryoptions()public java.lang.ProcessBuilder builder()
throws java.lang.Exception
ProcessBuilder to be used for executing
the rsync process.java.lang.Exception - if execution fails or failed to determine binarycommandLineArgs()public java.lang.Process start()
throws java.lang.Exception
execute(), which waits for the process to
finish while collecting stdout and stderr output.java.lang.Exception - if execution fails or failed to determine binarybuilder()public com.github.fracpete.processoutput4j.output.CollectingProcessOutput execute()
throws java.lang.Exception
start() and
monitor the output yourself.java.lang.Exception - if execution fails or failed to determine binarycommandLineArgs()protected abstract java.lang.String description()
protected net.sourceforge.argparse4j.inf.ArgumentParser getParser()
protected boolean setOptions(net.sourceforge.argparse4j.inf.Namespace ns)
ns - the parsed optionspublic boolean setOptions(java.lang.String[] options)
throws java.lang.Exception
options - the options to usejava.lang.Exception - in case of an invalid optionpublic static void run(AbstractBinary binary, java.lang.String[] args) throws java.lang.Exception
args - the argumentsjava.lang.ExceptionCopyright © 2019 University of Waikato, Hamilton, NZ. All Rights Reserved.