Class AbstractLogCommandOutput
java.lang.Object
com.anrisoftware.globalpom.exec.internal.logoutputs.AbstractLogCommandOutput
- All Implemented Interfaces:
CommandOutput,LogCommandOutput,Callable<CommandOutput>
- Direct Known Subclasses:
AbstractLogCommandOutput.DebugLogCommandOutput,AbstractLogCommandOutput.ErrorLogCommandOutput,AbstractLogCommandOutput.InfoLogCommandOutput,AbstractLogCommandOutput.TraceLogCommandOutput
Pipes the read data from the output of the command to a logger.
- Since:
- 2.0
- Author:
- Erwin Mueller, erwin.mueller@deventm.org
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classLogs the output as debug level.static classLogs the output as error level.static classLogs the output as info level.static classLogs the output as trace level. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractLogCommandOutput(org.slf4j.Logger logger, CommandLine commandLine) -
Method Summary
Modifier and TypeMethodDescriptioncall()Reads the standard output from the connected stream.abstract CommandOutputclone()Clones the standard output reader.static CommandOutputcreateDebugLogCommandOutput(org.slf4j.Logger logger, CommandLine commandLine) static CommandOutputcreateErrorLogCommandOutput(org.slf4j.Logger logger, CommandLine commandLine) static CommandOutputcreateInfoLogCommandOutput(org.slf4j.Logger logger, CommandLine commandLine) static CommandOutputcreateTraceLogCommandOutput(org.slf4j.Logger logger, CommandLine commandLine) Returns the command for the logging message.Returns the command line for the logging message.getInput()Returns the stream that is connected to output of the executed command.org.slf4j.LoggerReturns the logger that is filled with the piped to the output of the command.Returns the message string.protected abstract voidLog the line red from the command output.voidsetBufferSize(int size) Sets the buffer size.voidsetInput(InputStream stream) Sets the stream that is connected to output of the executed command.voidsetLogger(org.slf4j.Logger logger) Sets the logger that is filled with the piped to the output of the command.voidsetMessage(String message) Sets the message string.toString()
-
Constructor Details
-
AbstractLogCommandOutput
- Parameters:
logger- theLogger.commandLine- the theCommandLinefor the logging message.
-
-
Method Details
-
createInfoLogCommandOutput
public static CommandOutput createInfoLogCommandOutput(org.slf4j.Logger logger, CommandLine commandLine) - Parameters:
logger- theLoggercommandLine- theCommandLine- Returns:
- the
CommandOutput
-
createDebugLogCommandOutput
public static CommandOutput createDebugLogCommandOutput(org.slf4j.Logger logger, CommandLine commandLine) - Parameters:
logger- theLoggercommandLine- theCommandLine- Returns:
- the
CommandOutput
-
createTraceLogCommandOutput
public static CommandOutput createTraceLogCommandOutput(org.slf4j.Logger logger, CommandLine commandLine) - Parameters:
logger- theLoggercommandLine- theCommandLine- Returns:
- the
CommandOutput
-
createErrorLogCommandOutput
public static CommandOutput createErrorLogCommandOutput(org.slf4j.Logger logger, CommandLine commandLine) - Parameters:
logger- theLoggercommandLine- theCommandLine- Returns:
- the
CommandOutput
-
setInput
Description copied from interface:CommandOutputSets the stream that is connected to output of the executed command.- Specified by:
setInputin interfaceCommandOutput- Parameters:
stream- theInputStream.
-
getInput
Description copied from interface:LogCommandOutputReturns the stream that is connected to output of the executed command.- Specified by:
getInputin interfaceLogCommandOutput- Returns:
- the
InputStream.
-
setBufferSize
public void setBufferSize(int size) Description copied from interface:LogCommandOutputSets the buffer size.- Specified by:
setBufferSizein interfaceLogCommandOutput- Parameters:
size- the size in bytes.
-
setLogger
public void setLogger(org.slf4j.Logger logger) Description copied from interface:LogCommandOutputSets the logger that is filled with the piped to the output of the command.- Specified by:
setLoggerin interfaceLogCommandOutput- Parameters:
logger- theLogger.
-
getLogger
public org.slf4j.Logger getLogger()Description copied from interface:LogCommandOutputReturns the logger that is filled with the piped to the output of the command.- Specified by:
getLoggerin interfaceLogCommandOutput- Returns:
- the
Logger.
-
getCommandLine
Description copied from interface:LogCommandOutputReturns the command line for the logging message.- Specified by:
getCommandLinein interfaceLogCommandOutput- Returns:
- the
CommandLine.
-
getCommand
Description copied from interface:LogCommandOutputReturns the command for the logging message.- Specified by:
getCommandin interfaceLogCommandOutput- Returns:
- the
Stringcommand.
-
setMessage
Description copied from interface:LogCommandOutputSets the message string.- Specified by:
setMessagein interfaceLogCommandOutput- Parameters:
message- theStringmessage.
-
getMessage
Description copied from interface:LogCommandOutputReturns the message string.- Specified by:
getMessagein interfaceLogCommandOutput- Returns:
- the
Stringmessage.
-
call
Description copied from interface:CommandOutputReads the standard output from the connected stream.- Specified by:
callin interfaceCallable<CommandOutput>- Specified by:
callin interfaceCommandOutput- Throws:
Exception
-
clone
Description copied from interface:CommandOutputClones the standard output reader. The cloned reader have the same connected input stream.- Specified by:
clonein interfaceCommandOutput- Overrides:
clonein classObject- Returns:
- the cloned
CommandOutput.
-
logLine
Log the line red from the command output.- Parameters:
line- theStringline.
-
toString
-