Package com.almende.eve.transform.rpc.formats

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


   * @param msg
   *            the msg
   * @return the JSON message
   */
  public static JSONMessage jsonConvert(final Object msg) {
    JSONMessage jsonMsg = null;
    if (msg == null) {
      LOG.warning("Message null!");
      return null;
    }
    try {
View Full Code Here


   * @param senderUrl
   *            the sender url
   * @return the JSON response
   */
  public JSONResponse invoke(final Object msg, final URI senderUrl) {
    final JSONMessage jsonMsg = jsonConvert(msg);
    if (jsonMsg == null) {
      LOG.log(Level.WARNING, "Received non-JSONRPC message:'" + msg + "'");
      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()) {
        final AsyncCallback<JSONResponse> callback = callbacks.pull(id);
        if (callback != null) {
          final JSONResponse response = (JSONResponse) jsonMsg;
          final JSONRPCException error = response.getError();
View Full Code Here

TOP

Related Classes of com.almende.eve.transform.rpc.formats.JSONMessage

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.