Intel

Developer Zone

EventManager


com.intel.util
Class EventManager

java.lang.Object
  extended by com.intel.util.EventManager

public class EventManager
extends java.lang.Object

This class allows applets' registration for receiving events as well as posting events to other applets in the system or the native layer/application.


Field Summary
static int ACTOR_APPLET
Event is destined to or originated from another applet in the system.
static int ACTOR_NATIVE
Event is destined to or originated from native layer/application.
Method Summary
static void post(int reason, byte[] data, int index, int length)
This method posts an event to all registered clients in the system.
static void post(int reason, byte[] data, int index, int length, java.lang.String targetUUID, int targetType)
This method posts an event to a specific applet (according to provided UUID) or the native layer.
static void register(int reason, EventClient client)
This method registers the provided EventClient for handling events with the specified reason code.
static void unregister(int reason)
This method removes any previous registration of an EventClient for the specified reason code.
Methods inherited from class java.lang.Object
equals, hashCode, toString

Field Detail

ACTOR_NATIVE

public static final int ACTOR_NATIVE
Event is destined to or originated from native layer/application.

See Also:
Constant Field Values

ACTOR_APPLET

public static final int ACTOR_APPLET
Event is destined to or originated from another applet in the system.

See Also:
Constant Field Values
Method Detail

register

public static final void register(int reason,
                                  EventClient client)
                           throws UtilException
This method registers the provided EventClient for handling events with the specified reason code. Note that in order to be able to register for a specific event code, the applet must have this reason code included in the "applet.event.register" list in its configuration file (used during applet download package generation). If there was a previous EventClient registered to the specified reason code its registration will be replaced with the new client.

Parameters:
reason - reason code that the provided EventClient will be handling
client - the EventClient to be registered for handling the events. Must not be null.
Throws:
AccessDeniedException - in case the reason code provided did not appear in this applet's configuration file ("applet.event.register" list).
UtilException

unregister

public static final void unregister(int reason)
                             throws UtilException
This method removes any previous registration of an EventClient for the specified reason code. If no previous registration was done, calling this method will have no effect.

Parameters:
reason - the reason code for un-registration
Throws:
AccessDeniedException - in case the reason code provided did not appear in this applet's configuration file ("applet.event.register" list).
UtilException

post

public static final void post(int reason,
                              byte[] data,
                              int index,
                              int length,
                              java.lang.String targetUUID,
                              int targetType)
                       throws UtilException
This method posts an event to a specific applet (according to provided UUID) or the native layer. Note that if the target applet has several instances in the system that registered for this event, all of them will receive the event notification. In addition, note that in order to be able to post an event with the specified event code, the applet must have this reason code included in the "applet.event.post" list in its configuration file (used during applet download package generation).

Parameters:
reason - event code of the published event
data - byte array holding the data to be sent with event
index - start of the data to be send in the array
length - the length of the data to be sent
targetUUID - UUID string specifying the target applet
targetType - target type: ACTOR_NATIVE or ACTOR_APPLET
Throws:
IllegalParameterException - in one of the following cases: 1. specified target is invalid. 2. data is not null but the array is zero in size. 3. data is not null but length parameter is zero. 4. data is null but length parameter is not zero.
AccessDeniedException - in case the reason code provided did not appear in this applet's configuration file ("applet.event.post" list).
UtilOutOfResourcesException - in case the system has no resources available for sending this event.
UtilException

post

public static final void post(int reason,
                              byte[] data,
                              int index,
                              int length)
                       throws UtilException
This method posts an event to all registered clients in the system. Note that in order to be able to post an event with the specified event code, the applet must have this reason code included in the "applet.event.post" list in its configuration file (used during applet download package generation).

Parameters:
reason - event code of the published event
data - byte array holding the data to be sent with event
index - start of the data to be send in the array
length - the length of the data to be sent
Throws:
IllegalParameterException - in one of the following cases: 1. data is not null but the array is zero in size. 2. data is not null but length parameter is zero. 3. data is null but length parameter is not zero.
AccessDeniedException - in case the reason code provided did not appear in this applet's configuration file ("applet.event.post" list).
UtilOutOfResourcesException - in case the system has no resources available for sending this event.
UtilException