public class KKJSONEngBase
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected static com.fasterxml.jackson.databind.ObjectMapper |
mapper
JSON Data Mapping Object
|
Constructor and Description |
---|
KKJSONEngBase(EngineConfigIf engConfIn)
Constructor with an EngineConfig object.
|
Modifier and Type | Method and Description |
---|---|
protected void |
checkForException(KKJSON_ResponseIf response) |
int |
getConnectTimeout() |
EngineConfigIf |
getEngConf() |
java.net.URL |
getJsonURL() |
static com.fasterxml.jackson.databind.ObjectMapper |
getMapper() |
protected java.lang.String |
getNextId()
Return the next number in a sequence for matching requests and responses
|
int |
getReadTimeout() |
java.lang.String |
getStoreId() |
java.lang.String |
getStoreIdForRequest()
Only return the storeId if we're in a multi-store environment
|
protected static com.konakart.app.KKException |
handleThrowable(java.lang.Throwable e,
java.lang.String methodName)
Handles the exception for all methods.
|
void |
init() |
boolean |
isGenerateMatchIds() |
boolean |
isSuccessfullyInitialised() |
java.lang.String |
postRequest(java.lang.String request) |
static java.lang.String |
prettyJson(java.lang.String uglyJsonString)
To pretty-print a JSON String
|
void |
setConnectTimeout(int connectTimeout) |
void |
setEngConf(EngineConfigIf engConf) |
void |
setGenerateMatchIds(boolean generateMatchIds) |
void |
setJsonURL(java.net.URL jsonURL) |
void |
setReadTimeout(int readTimeout) |
void |
setStoreId(java.lang.String storeId) |
void |
setSuccessfullyInitialised(boolean successfullyInitialised) |
protected static com.fasterxml.jackson.databind.ObjectMapper mapper
public KKJSONEngBase(EngineConfigIf engConfIn) throws com.konakart.app.KKException
engConfIn
- the engConfIncom.konakart.app.KKException
- an unexpected KKException exceptionpublic void init() throws com.konakart.app.KKException
com.konakart.app.KKException
- an unexpected KKException exceptionprotected static com.konakart.app.KKException handleThrowable(java.lang.Throwable e, java.lang.String methodName)
We do this so that the receiver can detect the cause exception and act on it. Otherwise it gets lost.
e
- the emethodName
- the methodNameprotected void checkForException(KKJSON_ResponseIf response) throws com.konakart.app.KKException
com.konakart.app.KKException
protected java.lang.String getNextId()
public java.lang.String postRequest(java.lang.String request) throws java.lang.Exception
request
- the requestjava.lang.Exception
- an unexpected exceptionpublic static java.lang.String prettyJson(java.lang.String uglyJsonString)
uglyJsonString
- the raw JSON Stringpublic boolean isSuccessfullyInitialised()
public void setSuccessfullyInitialised(boolean successfullyInitialised)
successfullyInitialised
- the successfullyInitialised to setpublic java.lang.String getStoreIdForRequest()
public java.lang.String getStoreId()
public void setStoreId(java.lang.String storeId)
storeId
- the storeId to setpublic EngineConfigIf getEngConf()
public void setEngConf(EngineConfigIf engConf)
engConf
- the engConf to setpublic java.net.URL getJsonURL()
public void setJsonURL(java.net.URL jsonURL)
jsonURL
- the jsonURL to setpublic boolean isGenerateMatchIds()
public void setGenerateMatchIds(boolean generateMatchIds)
generateMatchIds
- the generateMatchIds to setpublic static com.fasterxml.jackson.databind.ObjectMapper getMapper()
public int getConnectTimeout()
public void setConnectTimeout(int connectTimeout)
connectTimeout
- the connectTimeout to setpublic int getReadTimeout()
public void setReadTimeout(int readTimeout)
readTimeout
- the readTimeout to setCopyright © 2018 DS Data Systems UK Ltd.