public class KKJSONAdminEngBase
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private AdminEngineConfig |
adminEngConf
Configuration parameter passed when the engine is instantiated
|
private static org.apache.commons.configuration2.PropertiesConfiguration |
allConfig
Used to read all of the properties from the properties file
|
private int |
CONNECT_TIMEOUT_DEFAULT |
private int |
connectTimeout |
private boolean |
generateMatchIds |
private java.net.URL |
jsonURL |
private static org.apache.commons.configuration2.Configuration |
konakartConfig
Used to read the KonaKart properties from the properties file
|
private static org.apache.commons.logging.Log |
log |
protected static com.fasterxml.jackson.databind.ObjectMapper |
mapper
JSON Data Mapping Object
|
private long |
nextId |
private int |
READ_TIMEOUT_DEFAULT |
private int |
readTimeout |
private java.lang.String |
storeId |
private boolean |
successfullyInitialised |
Constructor and Description |
---|
KKJSONAdminEngBase(AdminEngineConfig engConfIn)
Constructor with an AdminEngineConfig object.
|
Modifier and Type | Method and Description |
---|---|
protected void |
checkForException(KKJSONAdmin_ResponseIf response) |
AdminEngineConfig |
getAdminEngConf() |
int |
getConnectTimeout() |
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 KKAdminException |
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(AdminEngineConfig adminEngConf) |
void |
setGenerateMatchIds(boolean generateMatchIds) |
void |
setJsonURL(java.net.URL jsonURL) |
void |
setReadTimeout(int readTimeout) |
void |
setStoreId(java.lang.String storeId) |
void |
setSuccessfullyInitialised(boolean successfullyInitialised) |
private static org.apache.commons.logging.Log log
private static org.apache.commons.configuration2.PropertiesConfiguration allConfig
private static org.apache.commons.configuration2.Configuration konakartConfig
private boolean successfullyInitialised
private java.lang.String storeId
private AdminEngineConfig adminEngConf
private java.net.URL jsonURL
private long nextId
private boolean generateMatchIds
private final int CONNECT_TIMEOUT_DEFAULT
private final int READ_TIMEOUT_DEFAULT
private int connectTimeout
private int readTimeout
protected static com.fasterxml.jackson.databind.ObjectMapper mapper
public KKJSONAdminEngBase(AdminEngineConfig engConfIn) throws KKAdminException
engConfIn
- the engConfInKKAdminException
- an unexpected exception in the KonaKart Admin enginepublic void init() throws KKAdminException
KKAdminException
- an unexpected exception in the KonaKart Admin engineprotected static KKAdminException 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(KKJSONAdmin_ResponseIf response) throws KKAdminException
KKAdminException
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 AdminEngineConfig getAdminEngConf()
public void setEngConf(AdminEngineConfig adminEngConf)
adminEngConf
- the adminEngConf 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.