partially implemented simpleclient.EventGenerator
[vamsas.git] / src / org / vamsas / client / Events.java
1 package org.vamsas.client;
2
3 /**
4  * Enumerates the event types generated during the lifecycle of a Vamsas
5  * session.
6  */
7
8 public class Events {
9   /**
10    * Generated when a client has finished updating the document. Passes
11    * applicationHandle of client so the updating client can recognise its own
12    * updates.
13    */
14   public static final String DOCUMENT_UPDATE = "org.vamsas.client.events.documentUpdateEvent";
15
16   /**
17    * Generated when a new vamsas document is created (perhaps from some existing
18    * Vamsas data) so an application may do its own data space initialization.
19    * TODO: decide if this is called when an app is connected to a stored
20    * session...
21    */
22   public static final String DOCUMENT_CREATE = "org.vamsas.client.events.documentCreateEvent";
23
24   /**
25    * Generated when a new vamsas client is attached to a session (Handle is
26    * passed) Note: the newly created client does not receive the event.
27    */
28   public static final String CLIENT_CREATION = "org.vamsas.client.events.clientCreateEvent";
29
30   /**
31    * Generated when a vamsas client leaves a session (Handle is passed to all
32    * others).
33    */
34   public static final String CLIENT_FINALIZATION = "org.vamsas.client.events.clientFinalizationEvent";
35
36   /**
37    * Generated prior to session Shutdown, after the last participating vamsas
38    * client has finalized.
39    */
40   public static final String SESSION_SHUTDOWN = "org.vamsas.client.events.SessionShutdownEvent";
41
42   /**
43    * Generated for all clients when any client calls IClient.storeDocument() to
44    * allow them to store any updates before an offline copy of the session is
45    * created. Any client that handles this should call the
46    * IClient.getDocument(), update and then IClient.updateDocument in the same
47    * handler thread.
48    * EventName: <Vamsas-session URN>
49    * NewValue: org.vamsas.client.IClient for session.
50    */
51   public static final String DOCUMENT_FINALIZEAPPDATA = "org.vamsas.client.events.DocumentFinalizeAppData";
52
53   /**
54    * Generated by Vorba stub after the penultimate client makes a call to
55    * closeDocument(). Sequence is as follows : 1. All other vamsas clients have
56    * called closeDocument() 2. Final living client monitors closures, and
57    * realises that it is last. 3. Final client generates event to prompt
58    * associated application to inquire if the user wishes to save the document
59    * for future reference.
60    *  * Any call to closeDocument in a thread other than the registered
61    * EventListener will block until the RequestToClose handler has exited.
62    * 
63    */
64   public static final String DOCUMENT_REQUESTTOCLOSE = "org.vamas.client.DocumentRequestToCloseEvent";
65
66   public static java.util.Vector EventList = initList();
67
68   private static java.util.Vector initList() {
69     java.util.Vector vec = new java.util.Vector();
70     vec.add((Object) DOCUMENT_UPDATE);
71     vec.add((Object) DOCUMENT_CREATE);
72     vec.add((Object) CLIENT_CREATION);
73     vec.add((Object) CLIENT_FINALIZATION);
74     vec.add((Object) SESSION_SHUTDOWN);
75     vec.add((Object) DOCUMENT_REQUESTTOCLOSE);
76     vec.add((Object) DOCUMENT_FINALIZEAPPDATA);
77     return vec;
78   }
79 }