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 First published in XenServer 4.0.


Nested Class Summary
static class Event.Record
          Represents all the fields in a Event
 
Field Summary
protected  java.lang.String ref
          The XenAPI reference (OpaqueRef) to this object.
 
Method Summary
 boolean equals(java.lang.Object obj)
          If obj is a Event, compares XenAPI references for equality.
static EventBatch from(Connection c, java.util.Set<java.lang.String> classes, java.lang.String token, java.lang.Double timeout)
          Blocking call which returns a (possibly empty) batch of events First published in XenServer 6.0.
static java.lang.Long getCurrentId(Connection c)
          Return the ID of the next event to be generated by the system First published in XenServer 4.0.
 int hashCode()
           
static java.lang.String inject(Connection c, java.lang.String clazz, java.lang.String ref)
          Injects an artificial event on the given object and return the corresponding ID First published in XenServer 6.1.
static java.util.Set<Event.Record> next(Connection c)
          Blocking call which returns a (possibly empty) batch of events First published in XenServer 4.0.
static void register(Connection c, java.util.Set<java.lang.String> classes)
          Registers this session with the event system.
static Task registerAsync(Connection c, java.util.Set<java.lang.String> classes)
          Registers this session with the event system.
 java.lang.String toWireString()
           
static void unregister(Connection c, java.util.Set<java.lang.String> classes)
          Unregisters this session with the event system First published in XenServer 4.0.
static Task unregisterAsync(Connection c, java.util.Set<java.lang.String> classes)
          Unregisters this session with the event system First published in XenServer 4.0.
 
Methods inherited from class com.xensource.xenapi.XenAPIObject
isNull
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ref

protected final java.lang.String ref
The XenAPI reference (OpaqueRef) to this object.

Method Detail

toWireString

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

equals

public boolean equals(java.lang.Object obj)
If obj is a Event, compares XenAPI references for equality.

Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

registerAsync

public static Task registerAsync(Connection c,
                                 java.util.Set<java.lang.String> classes)
                          throws Types.BadServerResponse,
                                 Types.XenAPIException,
                                 org.apache.xmlrpc.XmlRpcException
Registers this session with the event system. Specifying * as the desired class will register for all classes. First published in XenServer 4.0.

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,
                            java.util.Set<java.lang.String> classes)
                     throws Types.BadServerResponse,
                            Types.XenAPIException,
                            org.apache.xmlrpc.XmlRpcException
Registers this session with the event system. Specifying * as the desired class will register for all classes. First published in XenServer 4.0.

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,
                                   java.util.Set<java.lang.String> classes)
                            throws Types.BadServerResponse,
                                   Types.XenAPIException,
                                   org.apache.xmlrpc.XmlRpcException
Unregisters this session with the event system First published in XenServer 4.0.

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,
                              java.util.Set<java.lang.String> classes)
                       throws Types.BadServerResponse,
                              Types.XenAPIException,
                              org.apache.xmlrpc.XmlRpcException
Unregisters this session with the event system First published in XenServer 4.0.

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

next

public static java.util.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 First published in XenServer 4.0.

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

from

public static EventBatch from(Connection c,
                              java.util.Set<java.lang.String> classes,
                              java.lang.String token,
                              java.lang.Double timeout)
                       throws Types.BadServerResponse,
                              Types.XenAPIException,
                              org.apache.xmlrpc.XmlRpcException,
                              Types.SessionNotRegistered,
                              Types.EventsLost
Blocking call which returns a (possibly empty) batch of events First published in XenServer 6.0.

Parameters:
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:
the batch of events
Throws:
Types.BadServerResponse
Types.XenAPIException
org.apache.xmlrpc.XmlRpcException
Types.SessionNotRegistered
Types.EventsLost

getCurrentId

public static java.lang.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 First published in XenServer 4.0.

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

inject

public static java.lang.String inject(Connection c,
                                      java.lang.String clazz,
                                      java.lang.String ref)
                               throws Types.BadServerResponse,
                                      Types.XenAPIException,
                                      org.apache.xmlrpc.XmlRpcException
Injects an artificial event on the given object and return the corresponding ID First published in XenServer 6.1.

Parameters:
clazz - class of the object
ref - A reference to the object that will be changed.
Returns:
the event ID
Throws:
Types.BadServerResponse
Types.XenAPIException
org.apache.xmlrpc.XmlRpcException