Package com.almende.eve.rpc.jsonrpc

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


                }
              }
              return null;
            } else {
             
              final JSONRequest request = JSONRPC.createRequest(
                  method, args);
             
              final SyncCallback<JSONResponse> callback = new SyncCallback<JSONResponse>();
              final AsyncCallbackQueue<JSONResponse> cbs = host
                  .getCallbackQueue(proxyId,
                      JSONResponse.class);
              if (cbs != null) {
                cbs.push(request.getId(), "", callback);
              }
              try {
                host.sendAsync(receiverUrl, request, agent,
                    null);
              } catch (final IOException e1) {
View Full Code Here


            + pushParams);
      }
      final String method = pushParams.get("method").textValue();
      final ObjectNode params = (ObjectNode) JOM.getInstance().readTree(
          pushParams.get("params").textValue());
      final JSONResponse res = JSONRPC.invoke(myAgent, new JSONRequest(method,
          params), myAgent);
     
      final JsonNode result = res.getResult();
      if (pushParams.has("onChange")
          && pushParams.get("onChange").asBoolean()) {
View Full Code Here

    params.put("pushKey", pushKey);
   
    LOG.info("Register Push:" + pushKey);
    if (pushParams.has("interval")) {
      final int interval = pushParams.get("interval").intValue();
      final JSONRequest request = new JSONRequest("monitor.doPush", params);
      result.put(
          "taskId",
          myAgent.getScheduler().createTask(request, interval, true,
              false));
    }
View Full Code Here

        final ObjectNode parms = (ObjectNode) JOM.getInstance().readTree(
            subscription.getParams());
        triggerParams = (ObjectNode) parms.putAll(triggerParams);
      }
      taskParams.put("params", triggerParams);
      final JSONRequest request = new JSONRequest("event.doTrigger", taskParams);
      final long delay = 0;
      myAgent.getScheduler().createTask(request, delay);
    }
  }
View Full Code Here

      jsonParams = JOM.getInstance().valueToTree(params);
    }
   
    // invoke the other agent via the AgentHost, allowing the factory
    // to route the request internally or externally
    final JSONRequest request = new JSONRequest(method, jsonParams);
    final SyncCallback<JSONResponse> callback = new SyncCallback<JSONResponse>();
    send(request, url, callback, null);
    JSONResponse response;
    try {
      response = callback.get();
View Full Code Here

  @Override
  @Access(AccessType.UNAVAILABLE)
  public final <T> void sendAsync(final URI url, final String method,
      final ObjectNode params, final AsyncCallback<T> callback,
      final Class<T> type) throws IOException {
    final JSONRequest request = new JSONRequest(method, params);
    sendAsync(url, request, callback, JOM.getTypeFactory()
        .uncheckedSimpleType(type));
  }
View Full Code Here

  @Override
  @Access(AccessType.UNAVAILABLE)
  public final <T> void sendAsync(final URI url, final String method,
      final ObjectNode params, final AsyncCallback<T> callback,
      final Type type) throws IOException {
    final JSONRequest request = new JSONRequest(method, params);
    sendAsync(url, request, callback,
        JOM.getTypeFactory().constructType(type));
  }
View Full Code Here

  @Override
  @Access(AccessType.UNAVAILABLE)
  public final <T> void sendAsync(final URI url, final String method,
      final ObjectNode params, final AsyncCallback<T> callback,
      final JavaType type) throws IOException {
    final JSONRequest request = new JSONRequest(method, params);
    sendAsync(url, request, callback, type);
  }
View Full Code Here

        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

        }
        if (jsonMsg instanceof JSONRequest) {
          final RequestParams params = new RequestParams();
          params.put(Sender.class, senderUrl.toASCIIString());
         
          final JSONRequest request = (JSONRequest) jsonMsg;
          final AgentInterface me = this;
          host.getPool().execute(new Runnable() {
            @Override
            public void run() {
              final Object[] signalData = new Object[2];
View Full Code Here

TOP

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

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.