Package org.silverpeas.core.util.exec
Class ExternalExecution.Config
- java.lang.Object
-
- org.silverpeas.core.util.exec.ExternalExecution.Config
-
- Enclosing class:
- ExternalExecution
public static class ExternalExecution.Config extends Object
This class permits to parametrize the external execution of a command.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ExternalExecution.Config
doNotDisplayErrorTrace()
Calling this method avoids to log errors thrown during the execution of a command into log handlers of the server.
It is useful for a command for which an execution error can be interpreted as a functional information.int
getSuccessfulExitStatusValue()
Gets the code value of a successful exit status.static ExternalExecution.Config
init()
Initializes a config with default values: the code value of a successful exit status is 0 the exception errors are traced bySilverLogger.error(Throwable)
boolean
isDisplayErrorTraceEnabled()
Indicates if the Silverpeas error trace must be displayed when an execution error is detected.ExternalExecution.Config
successfulExitStatusValueIs(int successfulExitStatusValue)
Sets the code value of a successful exit status.
-
-
-
Method Detail
-
init
public static ExternalExecution.Config init()
Initializes a config with default values:- the code value of a successful exit status is 0
- the exception errors are traced by
SilverLogger.error(Throwable)
- Returns:
- an instance of
ExternalExecution.Config
initialized with default values.
-
successfulExitStatusValueIs
public ExternalExecution.Config successfulExitStatusValueIs(int successfulExitStatusValue)
Sets the code value of a successful exit status.- Parameters:
successfulExitStatusValue
- anInteger
that represents the code value of a successful exit status.- Returns:
- the
ExternalExecution.Config
instance completed with the given information.
-
getSuccessfulExitStatusValue
public int getSuccessfulExitStatusValue()
Gets the code value of a successful exit status.- Returns:
- an integer that represents the code value.
-
doNotDisplayErrorTrace
public ExternalExecution.Config doNotDisplayErrorTrace()
Calling this method avoids to log errors thrown during the execution of a command into log handlers of the server.
It is useful for a command for which an execution error can be interpreted as a functional information. For example, a command that verifies the existence of an external tool.- Returns:
- the
ExternalExecution.Config
instance completed with the given information.
-
isDisplayErrorTraceEnabled
public boolean isDisplayErrorTraceEnabled()
Indicates if the Silverpeas error trace must be displayed when an execution error is detected.- Returns:
- true if errors must be traced, false otherwise.
-
-