public abstract class AbstractServerAction extends Object implements ServerAction
Modifier and Type | Field and Description |
---|---|
protected ActionLog |
actionLog
The ActionLog that used to log execution progress of ServerAction
|
protected com.google.gson.Gson |
gson
Used to deserialized JSON.
|
ACTION_NAME, ACTION_USER_NAME, DEFAULT_LONG_RUNNING_TASK_TIMEOUT_SECONDS, WRAPPED_CLASS_NAME
Constructor and Description |
---|
AbstractServerAction() |
Modifier and Type | Method and Description |
---|---|
protected void |
auditLog(AuditEvent ae) |
protected CommandReport |
createCommandReport(int exitCode,
HostRoleStatus status,
String structuredOut,
String stdout,
String stderr)
Creates a CommandReport used to report back to Ambari the status of this ServerAction.
|
protected CommandReport |
createCompletedCommandReport() |
protected Map<String,String> |
getCommandParameters()
Returns the command parameters value from the ExecutionCommand
The returned map should be assumed to be read-only.
|
protected String |
getCommandParameterValue(String propertyName)
Attempts to safely retrieve a property with the specified name from the this action's relevant
command parameters Map.
|
ExecutionCommand |
getExecutionCommand()
Gets the ExecutionCommand property of this ServerAction.
|
HostRoleCommand |
getHostRoleCommand()
Gets the HostRoleCommand property of this ServerAction.
|
void |
setExecutionCommand(ExecutionCommand executionCommand)
Sets the ExecutionCommand property of this ServerAction.
|
void |
setHostRoleCommand(HostRoleCommand hostRoleCommand)
Sets the HostRoleCommand property of this ServerAction.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
execute
protected ActionLog actionLog
@Inject protected com.google.gson.Gson gson
public ExecutionCommand getExecutionCommand()
ServerAction
getExecutionCommand
in interface ServerAction
public void setExecutionCommand(ExecutionCommand executionCommand)
ServerAction
setExecutionCommand
in interface ServerAction
executionCommand
- the ExecutionCommand data to setpublic HostRoleCommand getHostRoleCommand()
ServerAction
getHostRoleCommand
in interface ServerAction
public void setHostRoleCommand(HostRoleCommand hostRoleCommand)
ServerAction
setHostRoleCommand
in interface ServerAction
hostRoleCommand
- the HostRoleCommand data to setprotected CommandReport createCompletedCommandReport()
protected CommandReport createCommandReport(int exitCode, HostRoleStatus status, String structuredOut, String stdout, String stderr)
exitCode
- an integer value declaring the exit code for this action - 0 typically
indicates success.status
- a HostRoleStatus indicating the status of this actionstructuredOut
- a String containing the (typically) JSON-formatted data representing the
output from this action (this data is stored in the database, along with
the command status)stdout
- A string containing the data from the standard out stream (this data is stored in
the database, along with the command status)stderr
- A string containing the data from the standard error stream (this data is stored
in the database, along with the command status)protected Map<String,String> getCommandParameters()
protected String getCommandParameterValue(String propertyName)
propertyName
- a String declaring the name of the item from commandParameters to retrieveprotected void auditLog(AuditEvent ae)
Copyright © 2022 Apache Software Foundation. All rights reserved.