Class JsonRpcEvent

java.lang.Object
org.ovirt.vdsm.jsonrpc.client.JsonRpcEvent

public class JsonRpcEvent extends Object
Java bean representation of an event.
  • Field Details

    • ERROR_KEY

      public static final String ERROR_KEY
      See Also:
    • MESSAGE_FORMAT

      public static final String MESSAGE_FORMAT
      See Also:
    • MAPPER

      private static final com.fasterxml.jackson.databind.ObjectMapper MAPPER
    • method

      private String method
    • params

      private com.fasterxml.jackson.databind.JsonNode params
    • arrivalTime

      private long arrivalTime
  • Constructor Details

    • JsonRpcEvent

      public JsonRpcEvent(String method, com.fasterxml.jackson.databind.JsonNode params)
      Creates notification object.
      Parameters:
      method - - Name of the method which will be executed remotely.
      params - - Parameters used to execute method.
  • Method Details

    • getMethod

      public String getMethod()
      Returns:
      Id of this event which is used to match a subscriber.
    • setMethod

      public void setMethod(String method)
    • getParams

      public com.fasterxml.jackson.databind.JsonNode getParams()
      Returns:
      Content of an event.
    • setParams

      public void setParams(com.fasterxml.jackson.databind.JsonNode node)
    • fromJsonNode

      public static JsonRpcEvent fromJsonNode(com.fasterxml.jackson.databind.JsonNode node)
      Validates and builds JsonRpcEvent based on provided json node.
      Parameters:
      node - - Json representation of the notification.
      Returns:
      Notification object.
    • fromMethodAndParams

      public static JsonRpcEvent fromMethodAndParams(String method, Map<String,Object> params) throws IOException
      Create notification object for the method and params.
      Parameters:
      method - - Name of the method which will be executed remotely.
      params - - Parameters used to execute method.
      Returns:
      JsonRpcEvent representing an event.
      Throws:
      IOException - - The exception thrown if params cannot be serialized.
    • fromByteArray

      public static JsonRpcEvent fromByteArray(byte[] message)
      Parameters:
      message - - byte array representation of the notification.
      Returns:
      Request object.
      See Also:
    • toJson

      public com.fasterxml.jackson.databind.JsonNode toJson()
      Returns:
      Content of this bean as JsonNode.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getArrivalTime

      public long getArrivalTime()
    • setArrivalTime

      public void setArrivalTime(long arrivalTime)