com.xensource.xenapi
Class Event

java.lang.Object
  extended by com.xensource.xenapi.XenAPIObject
      extended by com.xensource.xenapi.Event

public class Event
extends XenAPIObject

Asynchronous event registration and handling


Nested Class Summary
static class Event.Record
          Represents all the fields in a Event
 
Field Summary
protected  String ref
          The XenAPI reference to this object.
 
Method Summary
 boolean equals(Object obj)
          If obj is a Event, compares XenAPI references for equality.
static Long getCurrentId(Connection c)
          Return the ID of the next event to be generated by the system
 int hashCode()
           
static Set<Event.Record> next(Connection c)
          Blocking call which returns a (possibly empty) batch of events
static void register(Connection c, Set<String> classes)
          Registers this session with the event system.
static Task registerAsync(Connection c, Set<String> classes)
          Registers this session with the event system.
 String toWireString()
           
static void unregister(Connection c, Set<String> classes)
          Unregisters this session with the event system
static Task unregisterAsync(Connection c, Set<String> classes)
          Unregisters this session with the event system
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ref

protected final String ref
The XenAPI reference to this object.

Method Detail

toWireString

public String toWireString()
Specified by:
toWireString in class XenAPIObject

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

public static Task registerAsync(Connection c,
                                 Set<String> classes)
                          throws Types.BadServerResponse,
                                 Types.XenAPIException,
                                 org.apache.xmlrpc.XmlRpcException
Registers this session with the event system. Specifying the empty list will register for all classes.

Parameters:
classes - register for events for the indicated classes
Returns:
Task
Throws:
Types.BadServerResponse
Types.XenAPIException
org.apache.xmlrpc.XmlRpcException

register

public static void register(Connection c,
                            Set<String> classes)
                     throws Types.BadServerResponse,
                            Types.XenAPIException,
                            org.apache.xmlrpc.XmlRpcException
Registers this session with the event system. Specifying the empty list will register for all classes.

Parameters:
classes - register for events for the indicated classes
Throws:
Types.BadServerResponse
Types.XenAPIException
org.apache.xmlrpc.XmlRpcException

unregisterAsync

public static Task unregisterAsync(Connection c,
                                   Set<String> classes)
                            throws Types.BadServerResponse,
                                   Types.XenAPIException,
                                   org.apache.xmlrpc.XmlRpcException
Unregisters this session with the event system

Parameters:
classes - remove this session's registration for the indicated classes
Returns:
Task
Throws:
Types.BadServerResponse
Types.XenAPIException
org.apache.xmlrpc.XmlRpcException

unregister

public static void unregister(Connection c,
                              Set<String> classes)
                       throws Types.BadServerResponse,
                              Types.XenAPIException,
                              org.apache.xmlrpc.XmlRpcException
Unregisters this session with the event system

Parameters:
classes - remove this session's registration for the indicated classes
Throws:
Types.BadServerResponse
Types.XenAPIException
org.apache.xmlrpc.XmlRpcException

next

public static Set<Event.Record> next(Connection c)
                              throws Types.BadServerResponse,
                                     Types.XenAPIException,
                                     org.apache.xmlrpc.XmlRpcException,
                                     Types.SessionNotRegistered,
                                     Types.EventsLost
Blocking call which returns a (possibly empty) batch of events

Returns:
the batch of events
Throws:
Types.BadServerResponse
Types.XenAPIException
org.apache.xmlrpc.XmlRpcException
Types.SessionNotRegistered
Types.EventsLost

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

Returns:
the event ID
Throws:
Types.BadServerResponse
Types.XenAPIException
org.apache.xmlrpc.XmlRpcException