Search in sources :

Example 6 with RequestHandler

use of run.wallet.iota.api.handler.RequestHandler in project run-wallet-android by runplay.

the class IotaApiProvider method processRequest.

@Override
public ApiResponse processRequest(ApiRequest apiRequest) {
    ApiResponse response = null;
    try {
        // Log.e("iotaApiProv",apiRequest.getClass()+" - "+this.requestHandlerMap.containsKey(apiRequest.getClass()));
        if (this.requestHandlerMap.containsKey(apiRequest.getClass())) {
            RequestHandler requestHandler = this.requestHandlerMap.get(apiRequest.getClass());
            response = requestHandler.handle(apiRequest);
        }
    } catch (IllegalAccessError e) {
        NetworkError error = new NetworkError();
        error.setErrorType(NetworkErrorType.ACCESS_ERROR);
        error.setMessage(e.getMessage());
        response = error;
        // if(error.getErrorType()==401 && e.getMessage().contains("getNeighbours"))
        Log.e("ERR-API1", "" + e.getMessage());
    } catch (Exception e) {
        Log.e("ERR-API2", e.toString() + " -- " + e.getMessage());
        response = new NetworkError();
    }
    return response == null ? new NetworkError() : response;
}
Also used : GetAccountDataRequestHandler(run.wallet.iota.api.handler.GetAccountDataRequestHandler) GetBundleRequestHandler(run.wallet.iota.api.handler.GetBundleRequestHandler) RemoveNeighborsRequestHandler(run.wallet.iota.api.handler.RemoveNeighborsRequestHandler) GetNewAddressRequestHandler(run.wallet.iota.api.handler.GetNewAddressRequestHandler) GetFirstLoadRequestHandler(run.wallet.iota.api.handler.GetFirstLoadRequestHandler) GetBalanceAndFormatRequestHandler(run.wallet.iota.api.handler.GetBalanceAndFormatRequestHandler) ReplayBundleRequestHandler(run.wallet.iota.api.handler.ReplayBundleRequestHandler) NudgeRequestHandler(run.wallet.iota.api.handler.NudgeRequestHandler) FindTransactionsRequestHandler(run.wallet.iota.api.handler.FindTransactionsRequestHandler) GetNeighborsRequestHandler(run.wallet.iota.api.handler.GetNeighborsRequestHandler) AddressSecurityChangeRequestHandler(run.wallet.iota.api.handler.AddressSecurityChangeRequestHandler) AuditAddressesRequestHandler(run.wallet.iota.api.handler.AuditAddressesRequestHandler) RequestHandler(run.wallet.iota.api.handler.RequestHandler) NodeInfoRequestHandler(run.wallet.iota.api.handler.NodeInfoRequestHandler) AddNeighborsRequestHandler(run.wallet.iota.api.handler.AddNeighborsRequestHandler) SendTransferRequestHandler(run.wallet.iota.api.handler.SendTransferRequestHandler) NetworkError(run.wallet.iota.api.responses.error.NetworkError) ApiResponse(run.wallet.iota.api.responses.ApiResponse)

Aggregations

RequestHandler (run.wallet.iota.api.handler.RequestHandler)6 HashMap (java.util.HashMap)3 ApiRequest (run.wallet.iota.api.requests.ApiRequest)3 ApiResponse (run.wallet.iota.api.responses.ApiResponse)3 NetworkError (run.wallet.iota.api.responses.error.NetworkError)3 AddNeighborsRequestHandler (run.wallet.iota.api.handler.AddNeighborsRequestHandler)2 AddressSecurityChangeRequestHandler (run.wallet.iota.api.handler.AddressSecurityChangeRequestHandler)2 AuditAddressesRequestHandler (run.wallet.iota.api.handler.AuditAddressesRequestHandler)2 FindTransactionsRequestHandler (run.wallet.iota.api.handler.FindTransactionsRequestHandler)2 GetAccountDataRequestHandler (run.wallet.iota.api.handler.GetAccountDataRequestHandler)2 GetBalanceAndFormatRequestHandler (run.wallet.iota.api.handler.GetBalanceAndFormatRequestHandler)2 GetBundleRequestHandler (run.wallet.iota.api.handler.GetBundleRequestHandler)2 GetFirstLoadRequestHandler (run.wallet.iota.api.handler.GetFirstLoadRequestHandler)2 GetNeighborsRequestHandler (run.wallet.iota.api.handler.GetNeighborsRequestHandler)2 GetNewAddressRequestHandler (run.wallet.iota.api.handler.GetNewAddressRequestHandler)2 MessageFirstLoadRequestHandler (run.wallet.iota.api.handler.MessageFirstLoadRequestHandler)2 MessageNewAddressRequestHandler (run.wallet.iota.api.handler.MessageNewAddressRequestHandler)2 MessageSendRequestHandler (run.wallet.iota.api.handler.MessageSendRequestHandler)2 NodeInfoRequestHandler (run.wallet.iota.api.handler.NodeInfoRequestHandler)2 NudgeRequestHandler (run.wallet.iota.api.handler.NudgeRequestHandler)2