@Tracked(value=TRACE) public abstract class TextAdapterActivity extends DefaultActivityImpl implements com.centurylink.mdw.activity.types.AdapterActivity, com.centurylink.mdw.adapter.AdapterInvocationError, com.centurylink.mdw.adapter.TextAdapter
DISABLED, GROOVY, JAVA_EL, JAVASCRIPT, logger, OUTPUTDOCSCOMPCODE_AUTO_RETRY, DEFAULT_STUBBER_PORT, DEFAULT_STUBBER_TIMEOUT, DO_LOGGING, MAKE_ACTUAL_CALL, PROP_MAX_TRIES, PROP_RETRY_INTERVAL, PROP_SYNCHRONOUS_RESPONSE, PROP_TIMEOUT, REQUEST_VARIABLE, REQUEST_XSD, RESPONSE_VARIABLE, RESPONSE_XSD| Constructor and Description |
|---|
TextAdapterActivity() |
| Modifier and Type | Method and Description |
|---|---|
protected abstract boolean |
canBeAsynchronous() |
protected abstract boolean |
canBeSynchronous() |
com.centurylink.mdw.model.Response |
directInvoke(java.lang.String request,
int timeout,
java.util.Map<java.lang.String,java.lang.String> meta_data)
This method is used for directly invoke the adapter activity
from code, rather than as part of process execution flow.
|
com.centurylink.mdw.model.Response |
doInvoke(java.lang.Object connection,
com.centurylink.mdw.model.request.Request request,
int timeout,
java.util.Map<java.lang.String,java.lang.String> headers) |
protected boolean |
doLogging()
Determines if external requests/responses should
be logged into adapter instance table.
|
void |
execute()
Subclasses do not normally override this method.
|
protected void |
executePostScript() |
protected java.lang.Object |
executePreScript(java.lang.Object requestData) |
protected java.lang.String |
filterStubResponse(java.lang.String unfiltered,
java.lang.Object request)
TODO implements this for simulation response
|
java.lang.String |
getAdapterInvocationErrorMessage()
This method allows the concrete adapters to define whatever they need for
a decent error message.
|
protected java.lang.String |
getAttribute(java.lang.String name,
java.lang.String defval,
boolean isSmart) |
protected int |
getErrorCode(java.lang.Throwable ex) |
protected int |
getMaxTries()
This is only used by activities, not connection pools
|
protected java.lang.String |
getRequestData()
The method overrides the one from the super class and perform the followings:
It gets the value of the variable with the name specified in the attribute
REQUEST_VARIABLE.
|
protected java.util.Map<java.lang.String,java.lang.String> |
getRequestHeaders()
Override to return protocol-specific headers to be included on the request.
|
protected org.json.JSONObject |
getRequestMeta() |
protected com.centurylink.mdw.model.Response |
getResponse(java.lang.Object connection,
java.lang.String responseString)
Override to set protocol response status/message.
|
protected java.util.Map<java.lang.String,java.lang.String> |
getResponseHeaders()
Protocol adapter must call setResponseHeaders() with appropriate values extracted from the response.
|
protected org.json.JSONObject |
getResponseMeta() |
protected int |
getRetryInterval()
This is only used by activities, not connection pools
|
protected com.centurylink.mdw.model.Response |
getStubbedResponse(java.lang.String requestData) |
protected com.centurylink.mdw.model.event.AdapterStubRequest |
getStubRequest(java.lang.String requestContent) |
protected java.lang.String |
getStubResponse(java.lang.String requestData)
Deprecated.
|
protected int |
getTimeoutForResponse()
Timeout value for waiting for responses.
|
protected void |
handleConnectionException(int errorCode,
java.lang.Throwable originalCause)
Typically you should not override this method.
|
protected void |
handleException(java.lang.Throwable errorCause) |
protected void |
handleRetry(int errorCode,
java.lang.Throwable originalCause)
Added so retry in executed for certain exceptions.
|
protected boolean |
hasPostScript() |
protected boolean |
hasPreScript() |
boolean |
isRetryable(java.lang.Throwable ex)
Default behavior returns true if Throwable is included in RETRY_EXCEPTIONS
attribute (if declared).
|
protected boolean |
isStubMode() |
boolean |
isSynchronous()
The method is used to determine if the current usage is synchronous (waiting for response) or not.
|
protected java.lang.Long |
logRequest(com.centurylink.mdw.model.request.Request request) |
protected java.lang.Long |
logRequest(java.lang.String message)
Deprecated.
|
protected java.lang.Long |
logResponse(com.centurylink.mdw.model.Response response) |
protected java.lang.Long |
logResponse(java.lang.String message)
Deprecated.
|
java.lang.String |
onFailure(java.lang.Throwable errorCause)
The method is invoked on the failure of each try.
|
void |
onSuccess(java.lang.String response)
The method is invoked when the external system interaction is a success.
|
protected void |
setResponseHeaders(java.util.Map<java.lang.String,java.lang.String> headers) |
executecloseDatabaseAccess, createDocument, createDocument, createDocument, createDocument, doCompatibilityCodeSubstitutions, evaluateExpression, executeScript, getActivityId, getActivityInstance, getActivityInstanceId, getActivityName, getAsset, getAttribute, getAttribute, getAttribute, getAttribute, getAttributes, getAttributeValue, getAttributeValueAsVariableName, getAttributeValueSmart, getDocument, getDocumentContent, getDocumentForUpdate, getEngine, getEntryCode, getExternalEventInstanceDetails, getMainProcessDefinition, getMasterRequestId, getOutputDocuments, getPackage, getParameterId, getParameters, getParameterStringValue, getParameterType, getParameterValue, getParameterValue, getParentProcessId, getPerformanceLevel, getProcessDefinition, getProcessId, getProcessInstance, getProcessInstanceId, getProcessInstanceOwner, getProcessInstanceOwnerId, getProperty, getRequiredAttribute, getRequiredVariableValue, getReturnCode, getReturnMessage, getRuntimeContext, getScriptEvaluator, getScriptExecClassName, getScriptExecutor, getValue, getValueSmart, getVariableInstance, getVariableValue, getVariableValueSmart, getWorkTransitionInstanceId, initialize, isDisabled, isLogDebugEnabled, isLogInfoEnabled, isOutputDocument, lockActivityInstance, lockProcessInstance, logdebug, logexception, loginfo, logsevere, logtag, logwarn, openDatabaseAccess, prepare, setOutputDocuments, setParameterValue, setParameterValue, setParameterValueAsDocument, setParameterValues, setProcessInstanceCompletionCode, setReturnCode, setReturnMessage, setValue, setVariableValue, setVariableValue, startTransaction, stopTransaction, translatePlaceHolder, updateDocumentContent, updateDocumentInfo, updateDocumentInfo, valueIsJavaExpression, valueIsVariableprotected int getTimeoutForResponse()
protected abstract boolean canBeSynchronous()
protected abstract boolean canBeAsynchronous()
protected java.lang.String getRequestData()
throws com.centurylink.mdw.activity.ActivityException
com.centurylink.mdw.activity.ActivityExceptionpublic boolean isSynchronous()
isSynchronous in interface com.centurylink.mdw.activity.types.AdapterActivitypublic void onSuccess(java.lang.String response)
throws com.centurylink.mdw.activity.ActivityException,
com.centurylink.mdw.connector.adapter.ConnectionException,
com.centurylink.mdw.connector.adapter.AdapterException
onSuccess in interface com.centurylink.mdw.adapter.TextAdapterresponse - response message from the external systemcom.centurylink.mdw.connector.adapter.ConnectionException - this exception indicates a system connection
failure (most likely between the direct interfacing system to down
stream systems, as direct connection failure will not some to this method).
The exception is auto-retriable.com.centurylink.mdw.connector.adapter.AdapterException - thrown when the external system responded but
the response needs to be handled as a non-auto-retriable error.com.centurylink.mdw.activity.ActivityException - thrown when the post processing
logic hits an exception that needs to fail the activity.
This error is not auto-retriable, either.public java.lang.String onFailure(java.lang.Throwable errorCause)
throws com.centurylink.mdw.connector.adapter.AdapterException,
com.centurylink.mdw.connector.adapter.ConnectionException
onFailure in interface com.centurylink.mdw.adapter.TextAdaptererrorCause - the exception receivedcom.centurylink.mdw.connector.adapter.AdapterException - when no retry is expectedcom.centurylink.mdw.connector.adapter.ConnectionException - when retry is expectedprotected int getMaxTries()
throws com.centurylink.mdw.activity.ActivityException
com.centurylink.mdw.activity.ActivityExceptionprotected int getRetryInterval()
throws com.centurylink.mdw.activity.ActivityException
com.centurylink.mdw.activity.ActivityExceptionpublic void execute()
throws com.centurylink.mdw.activity.ActivityException
execute in interface com.centurylink.mdw.activity.types.GeneralActivityexecute in class DefaultActivityImplcom.centurylink.mdw.activity.ActivityExceptionprotected com.centurylink.mdw.model.event.AdapterStubRequest getStubRequest(java.lang.String requestContent)
throws com.centurylink.mdw.connector.adapter.AdapterException
com.centurylink.mdw.connector.adapter.AdapterExceptionprotected int getErrorCode(java.lang.Throwable ex)
protected void handleRetry(int errorCode,
java.lang.Throwable originalCause)
throws com.centurylink.mdw.activity.ActivityException
errorCode - com.centurylink.mdw.activity.ActivityExceptionprotected void handleConnectionException(int errorCode,
java.lang.Throwable originalCause)
throws com.centurylink.mdw.activity.ActivityException
errorCode - com.centurylink.mdw.activity.ActivityExceptionprotected void handleException(java.lang.Throwable errorCause)
throws com.centurylink.mdw.activity.ActivityException
com.centurylink.mdw.activity.ActivityExceptionpublic boolean isRetryable(java.lang.Throwable ex)
protected boolean doLogging()
protected java.lang.Long logRequest(com.centurylink.mdw.model.request.Request request)
@Deprecated protected java.lang.Long logRequest(java.lang.String message)
protected java.lang.Long logResponse(com.centurylink.mdw.model.Response response)
@Deprecated protected java.lang.Long logResponse(java.lang.String message)
protected org.json.JSONObject getRequestMeta()
throws java.lang.Exception
java.lang.Exceptionprotected org.json.JSONObject getResponseMeta()
throws java.lang.Exception
java.lang.Exceptionprotected boolean isStubMode()
protected java.lang.String filterStubResponse(java.lang.String unfiltered,
java.lang.Object request)
unfiltered - request - protected com.centurylink.mdw.model.Response getStubbedResponse(java.lang.String requestData)
@Deprecated protected java.lang.String getStubResponse(java.lang.String requestData)
getStubbedResponsepublic com.centurylink.mdw.model.Response directInvoke(java.lang.String request,
int timeout,
java.util.Map<java.lang.String,java.lang.String> meta_data)
throws com.centurylink.mdw.connector.adapter.AdapterException,
com.centurylink.mdw.connector.adapter.ConnectionException
com.centurylink.mdw.connector.adapter.AdapterExceptioncom.centurylink.mdw.connector.adapter.ConnectionExceptionprotected java.lang.String getAttribute(java.lang.String name,
java.lang.String defval,
boolean isSmart)
throws com.centurylink.mdw.connector.adapter.AdapterException
com.centurylink.mdw.connector.adapter.AdapterExceptionprotected boolean hasPreScript()
protected java.lang.Object executePreScript(java.lang.Object requestData)
throws com.centurylink.mdw.activity.ActivityException
com.centurylink.mdw.activity.ActivityExceptionprotected boolean hasPostScript()
protected void executePostScript()
throws com.centurylink.mdw.activity.ActivityException
com.centurylink.mdw.activity.ActivityExceptionpublic com.centurylink.mdw.model.Response doInvoke(java.lang.Object connection,
com.centurylink.mdw.model.request.Request request,
int timeout,
java.util.Map<java.lang.String,java.lang.String> headers)
throws com.centurylink.mdw.connector.adapter.AdapterException,
com.centurylink.mdw.connector.adapter.ConnectionException
doInvoke in interface com.centurylink.mdw.adapter.TextAdaptercom.centurylink.mdw.connector.adapter.AdapterExceptioncom.centurylink.mdw.connector.adapter.ConnectionExceptionprotected com.centurylink.mdw.model.Response getResponse(java.lang.Object connection,
java.lang.String responseString)
throws java.io.IOException
java.io.IOExceptionprotected java.util.Map<java.lang.String,java.lang.String> getRequestHeaders()
protected java.util.Map<java.lang.String,java.lang.String> getResponseHeaders()
protected void setResponseHeaders(java.util.Map<java.lang.String,java.lang.String> headers)
public java.lang.String getAdapterInvocationErrorMessage()
This method allows the concrete adapters to define whatever they need for a decent error message. For instance they can include endpoint urls etc
getAdapterInvocationErrorMessage in interface com.centurylink.mdw.adapter.AdapterInvocationError