Class Event


public class Event extends XenAPIObject
Asynchronous event registration and handling First published in XenServer 4.0.
Author:
Cloud Software Group, Inc.
  • Field Details

    • ref

      protected final String ref
      The XenAPI reference (OpaqueRef) to this object.
  • Method Details

    • toWireString

      public String toWireString()
      Specified by:
      toWireString in class XenAPIObject
      Returns:
      The XenAPI reference (OpaqueRef) to this object.
    • equals

      public boolean equals(Object obj)
      If obj is a Event, compares XenAPI references for equality.
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • registerAsync

      @Deprecated public static Task registerAsync(Connection c, Set<String> classes) throws Types.BadServerResponse, Types.XenAPIException, org.apache.xmlrpc.XmlRpcException
      Deprecated.
      Registers this session with the event system for a set of given classes. This method is only recommended for legacy use in conjunction with event.next. Minimum allowed role: read-only First published in XenServer 4.0.
      Parameters:
      c - The connection the call is made on
      classes - the classes for which the session will register with the event system; specifying * as the desired class will register for all classes
      Returns:
      Task
      Throws:
      Types.BadServerResponse - Thrown if the response from the server contains an invalid status.
      Types.XenAPIException - Thrown if the call failed.
      org.apache.xmlrpc.XmlRpcException - Thrown if the result of an asynchronous call could not be parsed.
    • register

      @Deprecated public static void register(Connection c, Set<String> classes) throws Types.BadServerResponse, Types.XenAPIException, org.apache.xmlrpc.XmlRpcException
      Deprecated.
      Registers this session with the event system for a set of given classes. This method is only recommended for legacy use in conjunction with event.next. Minimum allowed role: read-only First published in XenServer 4.0.
      Parameters:
      c - The connection the call is made on
      classes - the classes for which the session will register with the event system; specifying * as the desired class will register for all classes
      Throws:
      Types.BadServerResponse - Thrown if the response from the server contains an invalid status.
      Types.XenAPIException - Thrown if the call failed.
      org.apache.xmlrpc.XmlRpcException - Thrown if the result of an asynchronous call could not be parsed.
    • unregisterAsync

      @Deprecated public static Task unregisterAsync(Connection c, Set<String> classes) throws Types.BadServerResponse, Types.XenAPIException, org.apache.xmlrpc.XmlRpcException
      Deprecated.
      Removes this session's registration with the event system for a set of given classes. This method is only recommended for legacy use in conjunction with event.next. Minimum allowed role: read-only First published in XenServer 4.0.
      Parameters:
      c - The connection the call is made on
      classes - the classes for which the session's registration with the event system will be removed
      Returns:
      Task
      Throws:
      Types.BadServerResponse - Thrown if the response from the server contains an invalid status.
      Types.XenAPIException - Thrown if the call failed.
      org.apache.xmlrpc.XmlRpcException - Thrown if the result of an asynchronous call could not be parsed.
    • unregister

      @Deprecated public static void unregister(Connection c, Set<String> classes) throws Types.BadServerResponse, Types.XenAPIException, org.apache.xmlrpc.XmlRpcException
      Deprecated.
      Removes this session's registration with the event system for a set of given classes. This method is only recommended for legacy use in conjunction with event.next. Minimum allowed role: read-only First published in XenServer 4.0.
      Parameters:
      c - The connection the call is made on
      classes - the classes for which the session's registration with the event system will be removed
      Throws:
      Types.BadServerResponse - Thrown if the response from the server contains an invalid status.
      Types.XenAPIException - Thrown if the call failed.
      org.apache.xmlrpc.XmlRpcException - Thrown if the result of an asynchronous call could not be parsed.
    • next

      Deprecated.
      Blocking call which returns a (possibly empty) batch of events. This method is only recommended for legacy use. New development should use event.from which supercedes this method. Minimum allowed role: read-only First published in XenServer 4.0.
      Parameters:
      c - The connection the call is made on
      Returns:
      A set of events
      Throws:
      Types.BadServerResponse - Thrown if the response from the server contains an invalid status.
      Types.XenAPIException - Thrown if the call failed.
      org.apache.xmlrpc.XmlRpcException - Thrown if the result of an asynchronous call could not be parsed.
      Types.SessionNotRegistered - This session is not registered to receive events. You must call event.register before event.next. The session handle you are using is echoed.
      Types.EventsLost - Some events have been lost from the queue and cannot be retrieved.
    • from

      public static EventBatch from(Connection c, Set<String> classes, String token, Double timeout) throws Types.BadServerResponse, Types.XenAPIException, org.apache.xmlrpc.XmlRpcException, Types.SessionNotRegistered, Types.EventsLost
      Blocking call which returns a new token and a (possibly empty) batch of events. The returned token can be used in subsequent calls to this function. Minimum allowed role: read-only First published in XenServer 6.0.
      Parameters:
      c - The connection the call is made on
      classes - register for events for the indicated classes
      token - A token representing the point from which to generate database events. The empty string represents the beginning.
      timeout - Return after this many seconds if no events match
      Returns:
      a structure consisting of a token ('token'), a map of valid references per object type ('valid_ref_counts'), and a set of event records ('events').
      Throws:
      Types.BadServerResponse - Thrown if the response from the server contains an invalid status.
      Types.XenAPIException - Thrown if the call failed.
      org.apache.xmlrpc.XmlRpcException - Thrown if the result of an asynchronous call could not be parsed.
      Types.SessionNotRegistered - This session is not registered to receive events. You must call event.register before event.next. The session handle you are using is echoed.
      Types.EventsLost - Some events have been lost from the queue and cannot be retrieved.
    • getCurrentId

      public static Long getCurrentId(Connection c) throws Types.BadServerResponse, Types.XenAPIException, org.apache.xmlrpc.XmlRpcException
      Return the ID of the next event to be generated by the system Minimum allowed role: read-only First published in XenServer 4.0.
      Parameters:
      c - The connection the call is made on
      Returns:
      the event ID
      Throws:
      Types.BadServerResponse - Thrown if the response from the server contains an invalid status.
      Types.XenAPIException - Thrown if the call failed.
      org.apache.xmlrpc.XmlRpcException - Thrown if the result of an asynchronous call could not be parsed.
    • inject

      public static String inject(Connection c, String clazz, String ref) throws Types.BadServerResponse, Types.XenAPIException, org.apache.xmlrpc.XmlRpcException
      Injects an artificial event on the given object and returns the corresponding ID in the form of a token, which can be used as a point of reference for database events. For example, to check whether an object has reached the right state before attempting an operation, one can inject an artificial event on the object and wait until the token returned by consecutive event.from calls is lexicographically greater than the one returned by event.inject. Minimum allowed role: read-only First published in XenServer 6.1.
      Parameters:
      c - The connection the call is made on
      clazz - class of the object
      ref - A reference to the object that will be changed.
      Returns:
      the event ID in the form of a token
      Throws:
      Types.BadServerResponse - Thrown if the response from the server contains an invalid status.
      Types.XenAPIException - Thrown if the call failed.
      org.apache.xmlrpc.XmlRpcException - Thrown if the result of an asynchronous call could not be parsed.