public abstract class AbstractProcessor extends java.lang.Object implements ProcessorInterface
Modifier and Type | Field and Description |
---|---|
protected int |
INITIAL_CACHE_SIZE |
protected java.lang.String |
remoteCommand
The command from the 'reomote solo'
|
static java.lang.String |
TAG |
protected AbstractTestRunner |
testRunner
A TestRunner by definition is already a DebugListener.
|
Constructor and Description |
---|
AbstractProcessor(AbstractTestRunner testRunner) |
Modifier and Type | Method and Description |
---|---|
(package private) boolean |
cacheContainValue(java.util.Hashtable cache,
java.lang.Object value)
Test if the value is contained in the local cache.
|
protected java.lang.String |
convertToKey(java.util.Hashtable cache,
java.lang.Object item)
Convert a item to a unique key.
If the cache contain the item, return the cached key directly. Else, generate a new unique key and put the item into cache with that key then return the key. |
protected java.lang.String[] |
convertToKeys(java.util.Hashtable cache,
java.util.List itemsList)
Convert a list of engine-specific objects to an array of unique keys
in the cache.
|
protected java.lang.String[] |
convertToKeys(java.util.Hashtable cache,
java.lang.Object[] items)
Convert an array of engine-specific objects to an array of unique keys
in the cache.
|
protected void |
debug(java.lang.String message)
Forward debug messages to our testRunner which may or may not have debug enabled
for performance reasons.
|
protected java.lang.Object |
getCachedItem(java.util.Hashtable cache,
java.lang.Object key)
Attempts to retrieve an item from cache using the provided key.
|
(package private) java.lang.Object |
getCacheKeyForValue(java.util.Hashtable cache,
java.lang.Object expectedValue)
To check if the local cache contains the expectedValue.
If found, return the corresponding key, otherwise return null. |
protected java.lang.String |
getStackTrace(java.lang.Throwable x)
Create a String from a Throwable suitable for debug output that provides
comparable information to x.printStackTrace();
|
protected java.lang.String |
makeUniqueCacheKey(java.lang.Object item)
Routine is used to create a unique ID String key that can be used by external
processes like Process Container to identify an engine-specific item in the
cache.
This method is thread-safe: it guarantees that multiple threads can get unique ID. |
MessageResult |
processMessage(java.lang.String message) |
void |
processProperties(java.util.Properties props)
Before calling this method, you may need to call setRemoteCommand()
|
protected void |
putCachedItem(java.util.Hashtable cache,
java.lang.Object key,
java.lang.Object item)
Attempts to put an item in cache using the provided key.
|
protected java.lang.Object |
removeCachedItem(java.util.Hashtable cache,
java.lang.Object key)
Remove an item from cache.
|
void |
resetExternalModeCache(java.util.Hashtable cache)
Clear and\or reset the internal component cache used in non-typical modes
of operation like MODE_EXTERNAL_PROCESSING (Process Container).
|
protected void |
setGeneralError(java.util.Properties props,
java.lang.String resultInfo)
set the isremoteresult to "true"
set the remoteresultcode to a constant code Message.STATUS_REMOTERESULT_FAIL_STRING Note: This method will concatenate remoteCommand with 'resultInfo', then with SoloMessage.RESULT_INFO_GENERAL_FAIL and set this string to remoteresultinfo |
protected void |
setGeneralError(java.util.Properties props,
java.lang.String resultInfo,
java.lang.String errorMessage)
set the isremoteresult to "true"
set the remoteresultcode to a constant code Message.STATUS_REMOTERESULT_FAIL_STRING set the errormsg to the string given by parameter errorMessage Note: This method will concatenate remoteCommand with 'resultInfo', then with SoloMessage.RESULT_INFO_GENERAL_FAIL and set this string to remoteresultinfo |
protected void |
setGeneralErrorWithSpecialInfo(java.util.Properties props,
java.lang.String resultInfo)
set the isremoteresult to "true"
set the remoteresultcode to a constant code Message.STATUS_REMOTERESULT_FAIL_STRING set the remoteresultinfo to the string given by parameter resultInfo Note: If remoteresultinfo should contain result of a predefined or unmodified format you MUST call this method. |
protected void |
setGeneralErrorWithSpecialInfo(java.util.Properties props,
java.lang.String resultInfo,
java.lang.String errorMessage)
set the isremoteresult to "true"
set the remoteresultcode to a constant code Message.STATUS_REMOTERESULT_FAIL_STRING set the errormsg to the string given by parameter errorMessage Note: If remoteresultinfo should contain result of 'predefined format', you MUST call this method. |
protected void |
setGeneralSuccess(java.util.Properties props)
Call to set a "<command> : successful" result into the properties object.
|
protected void |
setGeneralSuccess(java.util.Properties props,
java.lang.String resultInfo)
Call to set a "<command> : <resultInfo> successful." result into the properties object.
|
protected void |
setGeneralSuccessWithSpecialInfo(java.util.Properties props,
java.lang.String resultInfo)
Call to set a "<resultInfo>" remoteresultinfo into the properties object unmodified.
|
protected void |
setGeneralWarningWithSpecialInfo(java.util.Properties props,
java.lang.String resultInfo)
Call to set a "<resultInfo>" remoteresultinfo into the properties object unmodified.
|
void |
setRemoteCommand(java.lang.String remoteCommand) |
static boolean |
stringIsMatched(java.lang.String string1,
java.lang.String string2,
boolean partial,
boolean caseSensitive)
Test if the second string match with the first string.
|
public static java.lang.String TAG
protected java.lang.String remoteCommand
protected AbstractTestRunner testRunner
protected int INITIAL_CACHE_SIZE
public AbstractProcessor(AbstractTestRunner testRunner)
protected void debug(java.lang.String message)
This method will NOT add any prefix or suffix to the message. It is the responsibility of the caller to provide the complete message to be logged. This is to prevent cases where debugPrefix is NOT used or changed by the caller and incorrect debug output occurs.
protected java.lang.String getStackTrace(java.lang.Throwable x)
x
- public void processProperties(java.util.Properties props)
processProperties
in interface ProcessorInterface
ProcessorInterface.processProperties(Properties)
public MessageResult processMessage(java.lang.String message)
processMessage
in interface ProcessorInterface
ProcessorInterface.processMessage(String)
public void setRemoteCommand(java.lang.String remoteCommand)
setRemoteCommand
in interface ProcessorInterface
ProcessorInterface.setRemoteCommand(String)
protected void setGeneralSuccess(java.util.Properties props)
set the isremoteresult to "true"
set the remoteresultcode to a constant code Message.STATUS_REMOTERESULT_OK_STRING
Note: This method will concatenate remoteCommand
with
SoloMessage.RESULT_INFO_GENERAL_SUCCESS
and set this string to remoteresultinfo
props
- The Properties object containing the in and out parametersresultInfo
- The result information to be modified and set to remoteresultinfo of props.protected void setGeneralSuccess(java.util.Properties props, java.lang.String resultInfo)
set the isremoteresult to "true"
set the remoteresultcode to a constant code Message.STATUS_REMOTERESULT_OK_STRING
Note: This method will concatenate remoteCommand
with 'resultInfo', then with
SoloMessage.RESULT_INFO_GENERAL_SUCCESS
and set this string to remoteresultinfo
props
- The Properties object containing the in and out parametersresultInfo
- The result information to be modified and set to remoteresultinfo of props.protected void setGeneralSuccessWithSpecialInfo(java.util.Properties props, java.lang.String resultInfo)
Message.STATUS_REMOTERESULT_OK_STRING
props
- The Properties object containing the in and out parametersresultInfo
- The result information to be set unmodified to remoteresultinfo of props.protected void setGeneralWarningWithSpecialInfo(java.util.Properties props, java.lang.String resultInfo)
Message.STATUS_REMOTERESULT_WARN_STRING
props
- The Properties object containing the in and out parametersresultInfo
- The result information to be set unmodified to remoteresultinfo of props.protected void setGeneralError(java.util.Properties props, java.lang.String resultInfo)
Message.STATUS_REMOTERESULT_FAIL_STRING
remoteCommand
with 'resultInfo', then with SoloMessage.RESULT_INFO_GENERAL_FAIL
props
- The Properties object containing the in and out parametersresultInfo
- The result information to be modified and set to remoteresultinfo of props.protected void setGeneralError(java.util.Properties props, java.lang.String resultInfo, java.lang.String errorMessage)
Message.STATUS_REMOTERESULT_FAIL_STRING
remoteCommand
with 'resultInfo', then with SoloMessage.RESULT_INFO_GENERAL_FAIL
props
- The Properties object containing the in and out parametersresultInfo
- The result information to be set to resultinfo of props.errorMessage
- The error message to be set to errormessage of props. Null if no
error message is to be sent.protected void setGeneralErrorWithSpecialInfo(java.util.Properties props, java.lang.String resultInfo)
Message.STATUS_REMOTERESULT_FAIL_STRING
props
- The Properties object containing the in and out parametersresultInfo
- The result information to be set unmodified to remoteresultinfo of props.protected void setGeneralErrorWithSpecialInfo(java.util.Properties props, java.lang.String resultInfo, java.lang.String errorMessage)
Message.STATUS_REMOTERESULT_FAIL_STRING
props
- The Properties object containing the in and out parametersresultInfo
- The result information to be set unmodified to resultinfo of props.errorMessage
- The error message to be set to errormessage of props. Null if no error message
is to be sent.public void resetExternalModeCache(java.util.Hashtable cache)
cache
- Hashtable, MUST be an initialized objectmakeUniqueCacheKey(Object)
,
putCachedItem(Hashtable, Object, Object)
,
getCachedItem(Hashtable, Object)
,
removeCachedItem(Hashtable, Object)
protected java.lang.Object getCachedItem(java.util.Hashtable cache, java.lang.Object key)
cache
- Hashtable, MUST be an initialized objectkey
- Object to use as lookup reference into cachemakeUniqueCacheKey(Object)
,
putCachedItem(Hashtable, Object, Object)
,
removeCachedItem(Hashtable, Object)
protected java.lang.Object removeCachedItem(java.util.Hashtable cache, java.lang.Object key)
cache
- Hashtable, MUST be an initialized objectkey
- Object to use as lookup reference into cachemakeUniqueCacheKey(Object)
,
getCachedItem(Hashtable, Object)
,
putCachedItem(Hashtable, Object, Object)
protected void putCachedItem(java.util.Hashtable cache, java.lang.Object key, java.lang.Object item)
cache
- Hashtable, MUST be an initialized objectkey
- Object to use as lookup reference into cache.item
- Item to store in the cache.java.lang.IllegalArgumentException
- if either cache or key or item is null.makeUniqueCacheKey(Object)
,
getCachedItem(Hashtable, Object)
,
removeCachedItem(Hashtable, Object)
boolean cacheContainValue(java.util.Hashtable cache, java.lang.Object value)
cache
- Hashtable, MUST be an initialized objectvalue
- Object to be checked if it is in the cache.java.lang.Object getCacheKeyForValue(java.util.Hashtable cache, java.lang.Object expectedValue)
cache
- Hashtable, MUST be an initialized objectexpectedValue
- Object, the value to be checkedprotected java.lang.String[] convertToKeys(java.util.Hashtable cache, java.util.List itemsList)
cache
- Hashtable, MUST be an initialized objectitemsList
- List of objects to store in the cache.convertToKeys(Hashtable, Object[])
protected java.lang.String[] convertToKeys(java.util.Hashtable cache, java.lang.Object[] items)
cache
- Hashtable, MUST be an initialized objectitems
- Array of objects to store in the cache.convertToKey(Hashtable, Object)
,
makeUniqueCacheKey(Object)
,
getCachedItem(Hashtable, Object)
,
putCachedItem(Hashtable, Object, Object)
protected java.lang.String convertToKey(java.util.Hashtable cache, java.lang.Object item)
cache
- Hashtable, MUST be an initialized objectitems
- Array of objects to store in the cache.makeUniqueCacheKey(Object)
,
getCachedItem(Hashtable, Object)
,
putCachedItem(Hashtable, Object, Object)
protected java.lang.String makeUniqueCacheKey(java.lang.Object item)
item
- to be stored in cache.putCachedItem(Hashtable, Object, Object)
,
getCachedItem(Hashtable, Object)
,
removeCachedItem(Hashtable, Object)
public static boolean stringIsMatched(java.lang.String string1, java.lang.String string2, boolean partial, boolean caseSensitive)
string1,
- String, the first stringstring2,
- String, the second stringpartial
- boolean, if the comparison is partial match.caseSensitive
- boolean, if the comparison is case sensitive.Copyright © SAS Institute. All Rights Reserved.