Package com.almende.eve.rpc.jsonrpc

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


   
    // stop any running task
    stopAutoUpdate();

    // schedule an update task and store the task id
    JSONRequest request = new JSONRequest("update", null);
    String task = getScheduler().createTask(request, interval);
    state.put("updateTask", task);

    logger.info("Auto update started. Interval = " + interval
        + " milliseconds");
View Full Code Here


    return json;
  }
 
  private void sendAuthorizationToAgent(String agentUrl, String agentMethod,
      ObjectNode auth) throws IOException {
    JSONRequest rpcRequest = new JSONRequest(agentMethod, auth);
    HttpUtil.post(agentUrl, rpcRequest.toString());
  }
View Full Code Here

              Agent agent = getAgent(id);
              return method.invoke(agent, args);
            }
            else {
              // remote agent
              JSONRequest request = JSONRPC.createRequest(method, args);
              JSONResponse response = send(senderId, receiverUrl, request);
             
              JSONRPCException err = response.getError();
              if (err != null) {
                throw err;
View Full Code Here

          @Override
          public Object invoke(final Object proxy,
              final Method method, final Object[] args)
              throws JSONRPCException, IOException {
           
            final JSONRequest request = JSONRPC.createRequest(
                method, args);
           
            final SyncCallback<JSONResponse> callback = new SyncCallback<JSONResponse>();
            try {
              sender.send(request, receiverUrl, callback, null);
View Full Code Here

      ObjectNode taskParams = JOM.createObjectNode();
      taskParams.put("url", subscription.url);
      taskParams.put("method", subscription.method);
      taskParams.put("params", callbackParams);
      JSONRequest request = new JSONRequest("onTrigger", taskParams);
      long delay = 0;
      getScheduler().createTask(request, delay);
    }
  }
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;
    }
View Full Code Here

   */
  @Access(AccessType.UNAVAILABLE)
  final public <T> void sendAsync(String url, String method, ObjectNode params,
      final AsyncCallback<T> callback, final Class<T> type) throws Exception {
    String id = UUID.randomUUID().toString();
    JSONRequest request = new JSONRequest(id, method, params);
    sendAsync(url, request, callback, type);
  }
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

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.