use of run.wallet.iota.api.handler.RequestHandler in project run-wallet-android by runplay.
the class BasicApiProvider method processRequest.
@Override
public ApiResponse processRequest(ApiRequest apiRequest) {
ApiResponse response = null;
try {
if (useRequestHandlerMap.containsKey(apiRequest.getClass())) {
RequestHandler requestHandler = useRequestHandlerMap.get(apiRequest.getClass());
response = requestHandler.handle(apiRequest);
}
} catch (IllegalAccessError e) {
NetworkError error = new NetworkError();
error.setErrorType(NetworkErrorType.ACCESS_ERROR);
response = error;
Log.e("ERR-B-API1", "" + e.getMessage());
} catch (Exception e) {
Log.e("ERR-B-API2", e.toString() + " -- " + e.getMessage());
response = new NetworkError();
}
return response == null ? new NetworkError() : response;
}
use of run.wallet.iota.api.handler.RequestHandler in project run-wallet-android by runplay.
the class IotaMessageApiProvider method loadRequestMap.
private void loadRequestMap() {
Map<Class<? extends ApiRequest>, RequestHandler> requestHandlerMap = new HashMap<>();
MessageSendRequestHandler sendMessageAction = new MessageSendRequestHandler(iotaApi, context);
MessageNewAddressRequestHandler newAddressAction = new MessageNewAddressRequestHandler(iotaApi, context);
MessageFirstLoadRequestHandler firstLoad = new MessageFirstLoadRequestHandler(iotaApi, context);
requestHandlerMap.put(sendMessageAction.getType(), sendMessageAction);
this.requestHandlerMap = requestHandlerMap;
}
use of run.wallet.iota.api.handler.RequestHandler in project run-wallet-android by runplay.
the class IotaMessageApiProvider method processRequest.
@Override
public ApiResponse processRequest(ApiRequest apiRequest) {
ApiResponse response = null;
try {
// Log.e("IotaMessageApiProvider", "");
if (this.requestHandlerMap.containsKey(apiRequest.getClass())) {
// Log.e("IotaMessageApiProvider", "requesting");
RequestHandler requestHandler = this.requestHandlerMap.get(apiRequest.getClass());
response = requestHandler.handle(apiRequest);
}
} catch (IllegalAccessError e) {
NetworkError error = new NetworkError();
error.setErrorType(NetworkErrorType.ACCESS_ERROR);
response = error;
// Log.e("IotaMessageApi ERR",""+e.getMessage());
} catch (Exception e) {
Log.e("ERR-API", "ex: " + e.getMessage());
response = new NetworkError();
}
return response == null ? new NetworkError() : response;
}
use of run.wallet.iota.api.handler.RequestHandler in project run-wallet-android by runplay.
the class BasicApiProvider method loadRequestMap.
private void loadRequestMap() {
if (useRequestHandlerMap == null) {
Map<Class<? extends ApiRequest>, RequestHandler> requestHandlerMap = new HashMap<>();
WebGetExchangeRatesRequestHandler webExchangeAction = new WebGetExchangeRatesRequestHandler(context);
WebGetExchangeRatesHistoryRequestHandler webExchangeHistoryAction = new WebGetExchangeRatesHistoryRequestHandler(context);
requestHandlerMap.put(webExchangeAction.getType(), webExchangeAction);
requestHandlerMap.put(webExchangeHistoryAction.getType(), webExchangeHistoryAction);
useRequestHandlerMap = requestHandlerMap;
}
}
use of run.wallet.iota.api.handler.RequestHandler in project run-wallet-android by runplay.
the class IotaApiProvider method loadRequestMap.
private void loadRequestMap() {
Map<Class<? extends ApiRequest>, RequestHandler> requestHandlerMap = new HashMap<>();
AddressSecurityChangeRequestHandler addressSecurity = new AddressSecurityChangeRequestHandler(iotaApi, context);
AddNeighborsRequestHandler addNeighborsAction = new AddNeighborsRequestHandler(iotaApi, context);
AuditAddressesRequestHandler auditAddresses = new AuditAddressesRequestHandler(iotaApi, context);
AutoNudgeHandler autoNudge = new AutoNudgeHandler(iotaApi, context);
RefreshUsedAddressesHandler refreshUsed = new RefreshUsedAddressesHandler(iotaApi, context);
FindTransactionsRequestHandler findTransactionsAction = new FindTransactionsRequestHandler(iotaApi, context);
GetBundleRequestHandler getBundleAction = new GetBundleRequestHandler(iotaApi, context);
GetNeighborsRequestHandler getNeighborsAction = new GetNeighborsRequestHandler(iotaApi, context);
GetNewAddressRequestHandler getNewAddressAction = new GetNewAddressRequestHandler(iotaApi, context);
GetAccountDataRequestHandler getAccountDataAction = new GetAccountDataRequestHandler(iotaApi, context);
RemoveNeighborsRequestHandler removeNeighborsAction = new RemoveNeighborsRequestHandler(iotaApi, context);
ReplayBundleRequestHandler replayBundleAction = new ReplayBundleRequestHandler(iotaApi, context);
SendTransferRequestHandler sendTransferAction = new SendTransferRequestHandler(iotaApi, context);
NodeInfoRequestHandler nodeInfoAction = new NodeInfoRequestHandler(iotaApi, context);
GetFirstLoadRequestHandler firstLoad = new GetFirstLoadRequestHandler(iotaApi, context);
NudgeRequestHandler nudgeRequest = new NudgeRequestHandler(iotaApi, context);
GetBalanceAndFormatRequestHandler getBalanceAndFormatRequest = new GetBalanceAndFormatRequestHandler(iotaApi, context);
requestHandlerMap.put(refreshUsed.getType(), refreshUsed);
requestHandlerMap.put(autoNudge.getType(), autoNudge);
requestHandlerMap.put(nudgeRequest.getType(), nudgeRequest);
requestHandlerMap.put(addressSecurity.getType(), addressSecurity);
requestHandlerMap.put(auditAddresses.getType(), auditAddresses);
requestHandlerMap.put(firstLoad.getType(), firstLoad);
requestHandlerMap.put(addNeighborsAction.getType(), addNeighborsAction);
requestHandlerMap.put(findTransactionsAction.getType(), findTransactionsAction);
requestHandlerMap.put(getBundleAction.getType(), getBundleAction);
requestHandlerMap.put(getNeighborsAction.getType(), getNeighborsAction);
requestHandlerMap.put(getNewAddressAction.getType(), getNewAddressAction);
requestHandlerMap.put(getAccountDataAction.getType(), getAccountDataAction);
requestHandlerMap.put(removeNeighborsAction.getType(), removeNeighborsAction);
requestHandlerMap.put(replayBundleAction.getType(), replayBundleAction);
requestHandlerMap.put(sendTransferAction.getType(), sendTransferAction);
requestHandlerMap.put(nodeInfoAction.getType(), nodeInfoAction);
requestHandlerMap.put(getBalanceAndFormatRequest.getType(), getBalanceAndFormatRequest);
this.requestHandlerMap = requestHandlerMap;
}
Aggregations