Examples of JSONRPCException


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

            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

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

            // invoke the agent
            response = agentFactory.receive(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

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

            JSONRequest request = JSONRPC.createRequest(method,
                args);
            JSONResponse response = send(sender, receiverUrl,
                request);

            JSONRPCException err = response.getError();
            if (err != null) {
              throw err;
            } else if (response.getResult() != null
                && !method.getReturnType().equals(Void.TYPE)) {
              return response.getResult(method.getReturnType());
View Full Code Here

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

    state.init();
   
    // read the agents class name from state
    Class<?> agentType = state.getAgentType();
    if (agentType == null) {
      throw new JSONRPCException("Cannot instantiate agent. "
          + "Class information missing in the agents state "
          + "(agentId='" + agentId + "')");
    }
   
    // instantiate the agent
View Full Code Here

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

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

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

        JSONResponse response = JSONRPC.invoke(receiver, request,
            requestParams, receiver);
        return response;
      }
    } catch (Exception e) {
      throw new JSONRPCException("Couldn't instantiate agent for id '"
          + receiverId + "'", e);
    }
    throw new JSONRPCException("Agent with id '" + receiverId
        + "' not found");
  }
View Full Code Here

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

    // invoke the other agent via the AgentHost, allowing the factory
    // to route the request internally or externally
    String id = UUID.randomUUID().toString();
    JSONRequest request = new JSONRequest(id, method, jsonParams);
    JSONResponse response = getAgentHost().send(this, url, request);
    JSONRPCException err = response.getError();
    if (err != null) {
      throw err;
    }
    return response;
  }
View Full Code Here

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

    SyncCallback<JSONResponse> callback = new SyncCallback<JSONResponse>();
    sendAsync(senderUrl, receiver, request, callback);
    try {
      return callback.get();
    } catch (Exception e) {
      throw new JSONRPCException("Couldn't handle XMPP return.", e);
    }
  }
View Full Code Here

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

    }
    if (connection != null) {
      // remove the protocol from the receiver url
      String protocol = "xmpp:";
      if (!receiver.startsWith(protocol)) {
        throw new JSONRPCException("Receiver url must start with '"
            + protocol + "' (receiver='" + receiver + "')");
      }
      // username@domain
      String fullUsername = receiver.substring(protocol.length());
      connection.send(fullUsername, request, callback);
    } else {
      // TODO: use an anonymous xmpp connection when the sender agent has
      // no xmpp connection.
      throw new JSONRPCException("Cannot send an xmpp request, "
          + "agent has no xmpp connection.");
    }
  }
View Full Code Here

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

                  .decrypt(encryptedResource);
            }
            connect(agentId, username, password, resource);
          }
        } catch (Exception e) {
          throw new JSONRPCException("Failed to connect XMPP.", e);
        }
      }
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.