public class CommunicationHandler extends Object
| Constructor and Description |
|---|
CommunicationHandler()
Initialize the Connection Handler.
|
CommunicationHandler(BeowulfJConfig config)
Initialize the Connection Handler.
|
| Modifier and Type | Method and Description |
|---|---|
static com.fasterxml.jackson.databind.ObjectMapper |
getObjectMapper()
Get a preconfigured Jackson Object Mapper instance.
|
void |
initializeNewClient(BeowulfJConfig config)
Initialize a new
client by selecting one of the configured
endpoints. |
<T> List<T> |
performRequest(JsonRPCRequest requestObject,
Class<T> targetClass)
Perform a request to the web socket API whose response will automatically
get transformed into the given object.
|
public CommunicationHandler()
throws BeowulfCommunicationException
BeowulfCommunicationException - If no connection to the Beowulf Node could be established.public CommunicationHandler(BeowulfJConfig config) throws BeowulfCommunicationException
config - The config of beowulf blockchain.BeowulfCommunicationException - If no connection to the Beowulf Node could be established.public static com.fasterxml.jackson.databind.ObjectMapper getObjectMapper()
public void initializeNewClient(BeowulfJConfig config) throws BeowulfCommunicationException
client by selecting one of the configured
endpoints.config - The config of beowulf blockchain.BeowulfCommunicationException - If no AbstractClient implementation for the given
schema is available.public <T> List<T> performRequest(JsonRPCRequest requestObject, Class<T> targetClass) throws BeowulfCommunicationException, BeowulfResponseException
T - The type that should be returned.requestObject - A request object that contains all needed parameters.targetClass - The type the response should be transformed to.BeowulfTimeoutException - If the server was not able to answer the request in the given
time (@see
setResponseTimeout())BeowulfCommunicationException - If there is a connection problem.BeowulfTransformationException - If the BeowulfJ is unable to transform the JSON response into a
Java object.BeowulfResponseException - If the Server returned an error object.Copyright © 2019. All rights reserved.