org.apache.oozie
Class WorkflowActionBean

java.lang.Object
  extended by org.apache.oozie.WorkflowActionBean
All Implemented Interfaces:
org.apache.hadoop.io.Writable, JsonBean, org.apache.oozie.client.WorkflowAction

@Entity
public class WorkflowActionBean
extends Object
implements org.apache.hadoop.io.Writable, org.apache.oozie.client.WorkflowAction, JsonBean

Bean that contains all the information to start an action for a workflow node.


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.oozie.client.WorkflowAction
org.apache.oozie.client.WorkflowAction.Status
 
Constructor Summary
WorkflowActionBean()
          Default constructor.
 
Method Summary
 String getConf()
           
 StringBlob getConfBlob()
           
 String getConsoleUrl()
           
 Date getCreatedTime()
           
 Timestamp getCreatedTimestamp()
           
 String getCred()
           
 String getData()
           
 StringBlob getDataBlob()
           
 Date getEndTime()
           
 Timestamp getEndTimestamp()
          Return the action last check time
 String getErrorCode()
           
 String getErrorMessage()
           
 String getExecutionPath()
          Return the node execution path.
 String getExecutionStats()
          Return the action statistics info.
 String getExternalChildIDs()
          Return the external child IDs.
 StringBlob getExternalChildIDsBlob()
          Get external ChildIds
 String getExternalId()
           
 String getExternalStatus()
           
 String getId()
           
 String getJobId()
          Return the job Id.
 Date getLastCheckTime()
          Return the action last check time
 Timestamp getLastCheckTimestamp()
          Return the action last check time
 String getLogToken()
          Return the job log token.
 String getName()
           
 int getPending()
           
 Date getPendingAge()
          Return the pending age of the action.
 Timestamp getPendingAgeTimestamp()
          Return the action last check time
 int getRetries()
           
 String getSignalValue()
          Return the signal value for the action.
 String getSlaXml()
           
 StringBlob getSlaXmlBlob()
           
 Date getStartTime()
           
 Timestamp getStartTimestamp()
          Return the action last check time
 String getStats()
           
 StringBlob getStatsBlob()
           
 org.apache.oozie.client.WorkflowAction.Status getStatus()
           
 String getStatusStr()
          Get status
 String getTrackerUri()
           
 String getTransition()
           
 String getType()
           
 int getUserRetryCount()
           
 int getUserRetryInterval()
           
 int getUserRetryMax()
           
 String getWfId()
          Return the job Id.
 void incRetries()
          Increments the number of retries for the action.
 void incrmentUserRetryCount()
           
 boolean inTerminalState()
          Return whether workflow action in terminal state or not
 boolean isComplete()
          Return if the action is complete.
 boolean isExecutionComplete()
          Return if the action execution is complete.
 boolean isPending()
          Return if the action is pending.
 boolean isRetryOrManual()
          Return if the action is START_RETRY or START_MANUAL or END_RETRY or END_MANUAL.
 boolean isTerminalWithFailure()
          Return if the action is complete with failure.
 boolean isUserRetry()
          Return true if the action is USER_RETRY
 void readFields(DataInput dataInput)
          Deserialize an action bean from a data input.
 void resetPending()
          Removes the pending flag and pendingAge from the action.
 void resetPendingOnly()
          Removes the pending flag from the action.
 void setConf(String conf)
           
 void setConfBlob(StringBlob conf)
           
 void setConsoleUrl(String consoleUrl)
          Set console URL
 void setCreatedTime(Date createdTime)
           
 void setCred(String cred)
           
 void setData(String data)
          Set data
 void setDataBlob(StringBlob data)
           
 void setEndData(org.apache.oozie.client.WorkflowAction.Status status, String signalValue)
          Set the completion information for an action end.
 void setEndTime(Date endTime)
          Set end time
 void setErrorInfo(String errorCode, String errorMessage)
          Set the error Info
 void setExecutionData(String externalStatus, Properties actionData)
          Set the completion information for an action start.
 void setExecutionPath(String executionPath)
          Set the node execution path.
 void setExecutionStats(String jsonStats)
          Set the action statistics info for the workflow action.
 void setExternalChildIDs(String externalChildIDs)
          Set the external child IDs for the workflow action.
 void setExternalChildIDsBlob(StringBlob externalChildIDs)
          Set external child ids
 void setExternalId(String externalId)
          Set external Id
 void setExternalStatus(String externalStatus)
          Set external status
 void setId(String id)
           
 void setJobId(String id)
          Set the job id.
 void setLastCheckTime(Date lastCheckTime)
          Sets the action last check time
 void setLogToken(String logToken)
          Set the job log token.
 void setName(String name)
           
 void setPending()
          Set the action as pending and the current time as pending.
 void setPending(int i)
          Set pending flag
 void setPendingAge(Date pendingAge)
          Set a time when the action will be pending, normally a time in the future.
 void setPendingOnly()
          Set the action pending flag to true.
 void setRetries(int retries)
           
 void setSignalValue(String signalValue)
          Set the signal value for the action.
 void setSlaXml(String slaXmlStr)
           
 void setSlaXmlBlob(StringBlob slaXml)
           
 void setStartData(String externalId, String trackerUri, String consoleUrl)
          Set a tracking information for an action, and set the action status to Action.Status#DONE
 void setStartTime(Date startTime)
          Set start time
 void setStats(String stats)
          Set stats
 void setStatsBlob(StringBlob stats)
           
 void setStatus(org.apache.oozie.client.WorkflowAction.Status val)
          Set status of job
 void setStatusStr(String statusStr)
          Set status
 void setTrackerUri(String trackerUri)
          Set tracker uri
 void setTransition(String transition)
          Set transition
 void setType(String type)
           
 void setUserRetryCount(int retryCount)
           
 void setUserRetryInterval(int retryInterval)
           
 void setUserRetryMax(int retryMax)
          Set user retry max
static org.json.simple.JSONArray toJSONArray(List<WorkflowActionBean> nodes, String timeZoneId)
          Convert a nodes list into a JSONArray.
 org.json.simple.JSONObject toJSONObject()
          Return the JSONObject for the bean with GMT time zone.
 org.json.simple.JSONObject toJSONObject(String timeZoneId)
          Return the JSONObject for the bean with the given time zone.
 String toString()
           
 void write(DataOutput dataOutput)
          Serialize the action bean to a data output.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

WorkflowActionBean

public WorkflowActionBean()
Default constructor.

Method Detail

write

public void write(DataOutput dataOutput)
           throws IOException
Serialize the action bean to a data output.

Specified by:
write in interface org.apache.hadoop.io.Writable
Parameters:
dataOutput - data output.
Throws:
IOException - thrown if the action bean could not be serialized.

readFields

public void readFields(DataInput dataInput)
                throws IOException
Deserialize an action bean from a data input.

Specified by:
readFields in interface org.apache.hadoop.io.Writable
Parameters:
dataInput - data input.
Throws:
IOException - thrown if the action bean could not be deserialized.

inTerminalState

public boolean inTerminalState()
Return whether workflow action in terminal state or not

Returns:

isExecutionComplete

public boolean isExecutionComplete()
Return if the action execution is complete.

Returns:
if the action start is complete.

isRetryOrManual

public boolean isRetryOrManual()
Return if the action is START_RETRY or START_MANUAL or END_RETRY or END_MANUAL.

Returns:
boolean true if status is START_RETRY or START_MANUAL or END_RETRY or END_MANUAL

isUserRetry

public boolean isUserRetry()
Return true if the action is USER_RETRY

Returns:
boolean true if status is USER_RETRY

isComplete

public boolean isComplete()
Return if the action is complete.

Returns:
if the action is complete.

isTerminalWithFailure

public boolean isTerminalWithFailure()
Return if the action is complete with failure.

Returns:
if the action is complete with failure.

setPendingOnly

public void setPendingOnly()
Set the action pending flag to true.


setPending

public void setPending()
Set the action as pending and the current time as pending.


setPending

public void setPending(int i)
Set pending flag


setPendingAge

public void setPendingAge(Date pendingAge)
Set a time when the action will be pending, normally a time in the future.

Parameters:
pendingAge - the time when the action will be pending.

getPendingAge

public Date getPendingAge()
Return the pending age of the action.

Returns:
the pending age of the action, null if the action is not pending.

isPending

public boolean isPending()
Return if the action is pending.

Returns:
if the action is pending.

resetPending

public void resetPending()
Removes the pending flag and pendingAge from the action.


resetPendingOnly

public void resetPendingOnly()
Removes the pending flag from the action.


incRetries

public void incRetries()
Increments the number of retries for the action.


setStartData

public void setStartData(String externalId,
                         String trackerUri,
                         String consoleUrl)
Set a tracking information for an action, and set the action status to Action.Status#DONE

Parameters:
externalId - external ID for the action.
trackerUri - tracker URI for the action.
consoleUrl - console URL for the action.

setExecutionData

public void setExecutionData(String externalStatus,
                             Properties actionData)
Set the completion information for an action start. Sets the Action status to Action.Status#DONE

Parameters:
externalStatus - action external end status.
actionData - action output data, null if there is no action output data.

getExecutionStats

public String getExecutionStats()
Return the action statistics info.

Returns:
Json representation of the stats.

setExecutionStats

public void setExecutionStats(String jsonStats)
Set the action statistics info for the workflow action.

Parameters:
Json - representation of the stats.

getExternalChildIDs

public String getExternalChildIDs()
Return the external child IDs.

Specified by:
getExternalChildIDs in interface org.apache.oozie.client.WorkflowAction
Returns:
externalChildIDs as a string.

setExternalChildIDs

public void setExternalChildIDs(String externalChildIDs)
Set the external child IDs for the workflow action.

Parameters:
externalChildIDs - as a string.

setExternalChildIDsBlob

public void setExternalChildIDsBlob(StringBlob externalChildIDs)
Set external child ids

Parameters:
externalChildIds -

getExternalChildIDsBlob

public StringBlob getExternalChildIDsBlob()
Get external ChildIds

Returns:

setEndData

public void setEndData(org.apache.oozie.client.WorkflowAction.Status status,
                       String signalValue)
Set the completion information for an action end.

Parameters:
status - action status, Action.Status#OK or Action.Status#ERROR or Action.Status#KILLED
signalValue - the signal value. In most cases, the value should be OK or ERROR.

getJobId

public String getJobId()
Return the job Id.

Returns:
the job Id.

getWfId

public String getWfId()
Return the job Id.

Returns:
the job Id.

setJobId

public void setJobId(String id)
Set the job id.

Parameters:
id - jobId;

setSlaXml

public void setSlaXml(String slaXmlStr)

getSlaXml

public String getSlaXml()

setSlaXmlBlob

public void setSlaXmlBlob(StringBlob slaXml)

getSlaXmlBlob

public StringBlob getSlaXmlBlob()

setStatus

public void setStatus(org.apache.oozie.client.WorkflowAction.Status val)
Set status of job

Parameters:
val -

getStatus

public org.apache.oozie.client.WorkflowAction.Status getStatus()
Specified by:
getStatus in interface org.apache.oozie.client.WorkflowAction

setStatusStr

public void setStatusStr(String statusStr)
Set status

Parameters:
statusStr -

getStatusStr

public String getStatusStr()
Get status

Returns:

getExecutionPath

public String getExecutionPath()
Return the node execution path.

Returns:
the node execution path.

setExecutionPath

public void setExecutionPath(String executionPath)
Set the node execution path.

Parameters:
executionPath - the node execution path.

getSignalValue

public String getSignalValue()
Return the signal value for the action.

For decision nodes it is the choosen transition, for actions it is OK or ERROR.

Returns:
the action signal value.

setSignalValue

public void setSignalValue(String signalValue)
Set the signal value for the action.

For decision nodes it is the choosen transition, for actions it is OK or ERROR.

Parameters:
signalValue - the action signal value.

getLogToken

public String getLogToken()
Return the job log token.

Returns:
the job log token.

setLogToken

public void setLogToken(String logToken)
Set the job log token.

Parameters:
logToken - the job log token.

getLastCheckTime

public Date getLastCheckTime()
Return the action last check time

Returns:
the last check time

getLastCheckTimestamp

public Timestamp getLastCheckTimestamp()
Return the action last check time

Returns:
the last check time

getStartTimestamp

public Timestamp getStartTimestamp()
Return the action last check time

Returns:
the last check time

getEndTimestamp

public Timestamp getEndTimestamp()
Return the action last check time

Returns:
the last check time

getPendingAgeTimestamp

public Timestamp getPendingAgeTimestamp()
Return the action last check time

Returns:
the last check time

setLastCheckTime

public void setLastCheckTime(Date lastCheckTime)
Sets the action last check time

Parameters:
lastCheckTime - the last check time to set.

getPending

public int getPending()

getStartTime

public Date getStartTime()
Specified by:
getStartTime in interface org.apache.oozie.client.WorkflowAction

setStartTime

public void setStartTime(Date startTime)
Set start time

Parameters:
startTime -

getEndTime

public Date getEndTime()
Specified by:
getEndTime in interface org.apache.oozie.client.WorkflowAction

setEndTime

public void setEndTime(Date endTime)
Set end time

Parameters:
endTime -

toJSONObject

public org.json.simple.JSONObject toJSONObject()
Description copied from interface: JsonBean
Return the JSONObject for the bean with GMT time zone.

Specified by:
toJSONObject in interface JsonBean
Returns:
the JSONObject for the bean with GMT time zone.

toJSONObject

public org.json.simple.JSONObject toJSONObject(String timeZoneId)
Description copied from interface: JsonBean
Return the JSONObject for the bean with the given time zone.

Specified by:
toJSONObject in interface JsonBean
Parameters:
timeZoneId - the time zone to use
Returns:
the JSONObject for the bean with the given time zone.

getId

public String getId()
Specified by:
getId in interface org.apache.oozie.client.WorkflowAction

setId

public void setId(String id)

getCreatedTimestamp

public Timestamp getCreatedTimestamp()

getCreatedTime

public Date getCreatedTime()

setCreatedTime

public void setCreatedTime(Date createdTime)

getName

public String getName()
Specified by:
getName in interface org.apache.oozie.client.WorkflowAction

setName

public void setName(String name)

getCred

public String getCred()
Specified by:
getCred in interface org.apache.oozie.client.WorkflowAction

setCred

public void setCred(String cred)

getType

public String getType()
Specified by:
getType in interface org.apache.oozie.client.WorkflowAction

setType

public void setType(String type)

getConf

public String getConf()
Specified by:
getConf in interface org.apache.oozie.client.WorkflowAction

setConf

public void setConf(String conf)

setConfBlob

public void setConfBlob(StringBlob conf)

getConfBlob

public StringBlob getConfBlob()

getRetries

public int getRetries()
Specified by:
getRetries in interface org.apache.oozie.client.WorkflowAction

setRetries

public void setRetries(int retries)

getUserRetryCount

public int getUserRetryCount()
Specified by:
getUserRetryCount in interface org.apache.oozie.client.WorkflowAction

setUserRetryCount

public void setUserRetryCount(int retryCount)

incrmentUserRetryCount

public void incrmentUserRetryCount()

getUserRetryMax

public int getUserRetryMax()
Specified by:
getUserRetryMax in interface org.apache.oozie.client.WorkflowAction

setUserRetryMax

public void setUserRetryMax(int retryMax)
Set user retry max

Parameters:
retryMax -

getUserRetryInterval

public int getUserRetryInterval()
Specified by:
getUserRetryInterval in interface org.apache.oozie.client.WorkflowAction

setUserRetryInterval

public void setUserRetryInterval(int retryInterval)

getTransition

public String getTransition()
Specified by:
getTransition in interface org.apache.oozie.client.WorkflowAction

setTransition

public void setTransition(String transition)
Set transition

Parameters:
transition -

getData

public String getData()
Specified by:
getData in interface org.apache.oozie.client.WorkflowAction

setData

public void setData(String data)
Set data

Parameters:
data -

setDataBlob

public void setDataBlob(StringBlob data)

getDataBlob

public StringBlob getDataBlob()

getStats

public String getStats()
Specified by:
getStats in interface org.apache.oozie.client.WorkflowAction

setStats

public void setStats(String stats)
Set stats

Parameters:
stats -

setStatsBlob

public void setStatsBlob(StringBlob stats)

getStatsBlob

public StringBlob getStatsBlob()

getExternalId

public String getExternalId()
Specified by:
getExternalId in interface org.apache.oozie.client.WorkflowAction

setExternalId

public void setExternalId(String externalId)
Set external Id

Parameters:
externalId -

getExternalStatus

public String getExternalStatus()
Specified by:
getExternalStatus in interface org.apache.oozie.client.WorkflowAction

setExternalStatus

public void setExternalStatus(String externalStatus)
Set external status

Parameters:
externalStatus -

getTrackerUri

public String getTrackerUri()
Specified by:
getTrackerUri in interface org.apache.oozie.client.WorkflowAction

setTrackerUri

public void setTrackerUri(String trackerUri)
Set tracker uri

Parameters:
trackerUri -

getConsoleUrl

public String getConsoleUrl()
Specified by:
getConsoleUrl in interface org.apache.oozie.client.WorkflowAction

setConsoleUrl

public void setConsoleUrl(String consoleUrl)
Set console URL

Parameters:
consoleUrl -

getErrorCode

public String getErrorCode()
Specified by:
getErrorCode in interface org.apache.oozie.client.WorkflowAction

getErrorMessage

public String getErrorMessage()
Specified by:
getErrorMessage in interface org.apache.oozie.client.WorkflowAction

setErrorInfo

public void setErrorInfo(String errorCode,
                         String errorMessage)
Set the error Info

Parameters:
errorCode -
errorMessage -

toString

public String toString()
Overrides:
toString in class Object

toJSONArray

public static org.json.simple.JSONArray toJSONArray(List<WorkflowActionBean> nodes,
                                                    String timeZoneId)
Convert a nodes list into a JSONArray.

Parameters:
nodes - nodes list.
timeZoneId - time zone to use for dates in the JSON array.
Returns:
the corresponding JSON array.


Copyright © 2015 Apache Software Foundation. All Rights Reserved.