Examples of JSONRequest


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

   *            the agent
   */
  public void init(final ResultMonitor monitor, final AgentInterface agent) {
    final ObjectNode params = JOM.createObjectNode();
    params.put("monitorId", monitor.getId());
    final JSONRequest request = new JSONRequest("monitor.doPoll", params);
   
    // Try to cancel any protential existing tasks.
    cancel(monitor, agent);
   
    taskId = agent.getScheduler()
View Full Code Here

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

        IOException {
      // TODO: throw exceptions when agentId, request are null or
      // delay < 0
     
      agentId = params.get("agentId");
      request = new JSONRequest(params.get("request"));
      timestamp = new DateTime(params.get("timestamp"));
      interval = Long.valueOf(params.get("interval"));
      sequential = Boolean.valueOf(params.get("sequential"));
     
      long delay = 0;
View Full Code Here

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

      throws Exception {
    // remove existing timeout
    cancelTimeToLive();
   
    // create a new timeout
    JSONRequest request = new JSONRequest("killMe", null);
    String timeoutId = getScheduler().createTask(request, interval);
    getState().put("timeoutId", timeoutId);
  }
View Full Code Here

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

  }

  @Override
  public void doPost(HttpServletRequest req, HttpServletResponse resp)
      throws IOException {
    JSONRequest jsonRequest = null;
    JSONResponse jsonResponse = null;   
    try {
      // retrieve the request body
      String body = StringUtil.streamToString(req.getInputStream());
      jsonRequest = new JSONRequest(body);
     
      // TODO: append authorized sender url to the request parameters
      RequestParams requestParams = new RequestParams();
      requestParams.put(Sender.class, null);
View Full Code Here

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

        JsonMappingException, JSONRPCException, IOException {
      // TODO: throw exceptions when agentId, request are null or delay <
      // 0
     
      agentId = params.get("agentId");
      request = new JSONRequest(params.get("request"));
      timestamp = new DateTime(params.get("timestamp"));
      interval = new Long(params.get("interval"));
      sequential = new Boolean(params.get("sequential"));
     
      long delay = 0;
View Full Code Here

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

   * JSON-RPC request as body. Response will be a JSON-RPC response.
   */
  @Override
  public void doPost(HttpServletRequest req, HttpServletResponse resp)
      throws IOException {
    JSONRequest jsonRequest = null;
    JSONResponse jsonResponse = null;
    String body = null;
    String agentUrl = null;
    String agentId = null;
    try {
      // retrieve the agent url and the request body
      body = StringUtil.streamToString(req.getInputStream());
      jsonRequest = new JSONRequest(body);

      agentUrl = req.getRequestURI();
      agentId = httpTransport.getAgentId(agentUrl);
      if (agentId == null || agentId.isEmpty()) {
        resp.sendError(400, "No agentId found in url.");
View Full Code Here

Examples of com.almende.eve.transform.rpc.formats.JSONRequest

   *             Signals that an I/O exception has occurred.
   */
  public static String invoke(final Object destination, final String request,
      final RequestParams requestParams, final Authorizor auth)
      throws IOException {
    JSONRequest jsonRequest = null;
    JSONResponse jsonResponse = null;
    try {
      jsonRequest = new JSONRequest(request);
      jsonResponse = invoke(destination, jsonRequest, requestParams, auth);
    } catch (final JSONRPCException err) {
      jsonResponse = new JSONResponse(err);
    }
   
View Full Code Here

Examples of com.almende.eve.transform.rpc.formats.JSONRequest

    try {
      id = JOM.getInstance().valueToTree(new UUID().toString());
    } catch (final Exception e) {
      LOG.log(Level.SEVERE, "Failed to generate UUID for request", e);
    }
    return new JSONRequest(id, method.getName(), params);
  }
View Full Code Here

Examples of com.almende.eve.transform.rpc.formats.JSONRequest

        if (json != null) {
          if (JSONRPC.isResponse(json)) {
            final JSONResponse response = new JSONResponse(json);
            jsonMsg = response;
          } else if (JSONRPC.isRequest(json)) {
            final JSONRequest request = new JSONRequest(json);
            jsonMsg = request;
          } else {
            LOG.warning("Message contains valid JSON, but is not JSON-RPC:"
                + json);
          }
View Full Code Here

Examples of com.almende.eve.transform.rpc.formats.JSONRequest

      return null;
    }
    final JsonNode id = jsonMsg.getId();
    try {
      if (jsonMsg.isRequest()) {
        final JSONRequest request = (JSONRequest) jsonMsg;
        final RequestParams params = new RequestParams();
        params.put(Sender.class, senderUrl.toASCIIString());
        return JSONRPC.invoke(destination.get(), request, params, auth);
      } else if (jsonMsg.isResponse() && callbacks != null && id != null
          && !id.isNull()) {
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.