Package com.almende.eve.rpc.jsonrpc

Examples of com.almende.eve.rpc.jsonrpc.JSONRPCException


              }
              try {
                host.sendAsync(receiverUrl, request, agent,
                    null);
              } catch (final IOException e1) {
                throw new JSONRPCException(
                    CODE.REMOTE_EXCEPTION, "", e1);
              }
             
              JSONResponse response;
              try {
                response = callback.get();
              } catch (final Exception e) {
                throw new JSONRPCException(
                    CODE.REMOTE_EXCEPTION, "", e);
              }
              final JSONRPCException err = response.getError();
              if (err != null) {
                throw err;
              } else if (response.getResult() != null
                  && !method.getReturnType()
                      .equals(Void.TYPE)) {
View Full Code Here


          throw new Exception(
              "Request does not contain a valid JSON-RPC request or response");
        }
      } catch (Exception err) {
        // generate JSON error response
        JSONRPCException jsonError = new JSONRPCException(
            JSONRPCException.CODE.INTERNAL_ERROR, err.getMessage());
        JSONResponse response = new JSONResponse(jsonError);
       
        // send exception as response
        Message msg = new MessageBuilder().withRecipientJids(from)
View Full Code Here

  }
 
  @Override
  public JSONResponse send(String senderId, String receiver,
      JSONRequest request) throws JSONRPCException {
    throw new JSONRPCException("JSONResponse send(String senderId, String receiver, " +
        "JSONRequest request) not supported by GaeXmppService. " +
        "Use sendAsync(String senderId, String receiver, " +
        "JSONRequest request, String callback) instead.");
  }
View Full Code Here

            else {
              // remote agent
              JSONRequest request = JSONRPC.createRequest(method, args);
              JSONResponse response = send(senderId, receiverUrl, request);
             
              JSONRPCException err = response.getError();
              if (err != null) {
                throw err;
              }
              else if (response.getResult() != null &&
                  !method.getReturnType().equals(Void.TYPE)) {
View Full Code Here

  public void throwException() throws Exception {
    throw new Exception("Something went wrong...");
  }
 
  public void throwJSONRPCException() throws Exception {
    throw new JSONRPCException(CODE.NOT_FOUND);
  }
View Full Code Here

    // invoke the other agent via the state, allowing the state
    // to route the request internally or externally
    String id = UUID.randomUUID().toString();
    JSONRequest request = new JSONRequest(id, method, jsonParams);
    JSONResponse response = getAgentFactory().send(getId(), url, request);
    JSONRPCException err = response.getError();
    if (err != null) {
      throw err;
    }
    if (type != null && type != void.class) {
      return response.getResult(type);
View Full Code Here

        return;
      }
      jsonResponse = agentFactory.invoke(agentId, jsonRequest, requestParams);
    } catch (Exception err) {
      // generate JSON error response
      JSONRPCException jsonError = null;
      if (err instanceof JSONRPCException) {
        jsonError = (JSONRPCException) err;
      }
      else {
        jsonError = new JSONRPCException(
            JSONRPCException.CODE.INTERNAL_ERROR, err.getMessage());
        jsonError.setData(err);
      }
      jsonResponse = new JSONResponse(jsonError);
    }

    // return response
View Full Code Here

      // invoke the agent
      jsonResponse = agentFactory.invoke(agentId, jsonRequest, requestParams);
    } catch (Exception err) {
      // generate JSON error response
      JSONRPCException jsonError = null;
      if (err instanceof JSONRPCException) {
        jsonError = (JSONRPCException) err;
      }
      else {
        jsonError = new JSONRPCException(
            JSONRPCException.CODE.INTERNAL_ERROR, err.getMessage());       
        jsonError.setData(err);
      }
      jsonResponse = new JSONResponse(jsonError);
    }

    // return response
View Full Code Here

            throw new Exception("Request does not contain a valid JSON-RPC request or response");
          }
        }
        catch (Exception err) {
          // generate JSON error response
          JSONRPCException jsonError = new JSONRPCException(
              JSONRPCException.CODE.INTERNAL_ERROR, err.getMessage());
          JSONResponse response = new JSONResponse(jsonError);
         
          // send exception as response
          Message reply = new Message();
View Full Code Here

            // invoke the agent
            response = agentFactory.invoke(agentId, request, params);
          } catch (Exception err) {
            // generate JSON error response
            JSONRPCException jsonError = new JSONRPCException(
                JSONRPCException.CODE.INTERNAL_ERROR, err.getMessage());
            response = new JSONResponse(jsonError);
          }
         
          if (response != null) {
View Full Code Here

TOP

Related Classes of com.almende.eve.rpc.jsonrpc.JSONRPCException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.