Package com.almende.eve.rpc.jsonrpc

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


      jsonResponse = agentHost.receive(agentId, jsonRequest,
          requestParams);
    } catch (Exception err) {
      // generate JSON error response
      LOG.log(Level.WARNING, "", err);
      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


      // instantiate a packet listener
      conn.addPacketListener(new JSONRPCListener(conn, agentHost,
          agentId, resource, callbacks), null);
    } catch (XMPPException e) {
      LOG.log(Level.WARNING, "", e);
      throw new JSONRPCException("Failed to connect to messenger", e);
    }
  }
View Full Code Here

        conn.sendPacket(reply);
      } else {
        throw new Exception("Cannot send request, not connected");
      }
    } catch (Exception e) {
      throw new JSONRPCException("Failed to send RPC through XMPP.", e);
    }
  }
View Full Code Here

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

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

      } finally {
        httpPost.reset();
      }
      return response;
    } catch (Exception e) {
      throw new JSONRPCException("Failed to send RPC call through HTTP",
          e);
    }
  }
View Full Code Here

    if (myAgent.getState().containsKey(pushKey)) {
      ObjectNode pushParams = (ObjectNode) JOM.getInstance()
          .readTree(myAgent.getState().get(pushKey, String.class))
          .get("config");
      if (!(pushParams.has("method") && pushParams.has("params"))) {
        throw new JSONRPCException("Missing push configuration fields:"
            + pushParams);
      }
      String method = pushParams.get("method").textValue();
      ObjectNode params = (ObjectNode) JOM.getInstance().readTree(
          pushParams.get("params").textValue());
View Full Code Here

      throws JSONRPCException {
   
    String[] ids = pushId.split("_");
   
    if (ids.length != 2) {
      throw new JSONRPCException("PushId is invalid!");
    }
    String monitorId = ids[0];
   
    try {
     
View Full Code Here

    ObjectNode calendars = JOM.getInstance().readValue(resp, ObjectNode.class);

    // check for errors
    if (calendars.has("error")) {
      ObjectNode error = (ObjectNode)calendars.get("error");
      throw new JSONRPCException(error);
    }

    // get items from response
    ArrayNode items = null;
    if (calendars.has("items")) {
View Full Code Here

    ObjectNode json = mapper.readValue(resp, ObjectNode.class);
   
    // check for errors
    if (json.has("error")) {
      ObjectNode error = (ObjectNode)json.get("error");
      throw new JSONRPCException(error);
    }

    // get items from the response
    ArrayNode items = null;
    if (json.has("items")){
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.