1
2
3
4
5
6 package net.kwfgrid.gworkflowdl.protocol.server;
7
8 import net.kwfgrid.gworkflowdl.protocol.structure.IRootObject;
9 import net.kwfgrid.gworkflowdl.protocol.IncompatibleVersionsException;
10 import net.kwfgrid.gworkflowdl.protocol.IllegalModificationException;
11
12 /***
13 Interface for a root object on the server side of a distributed structure.
14 */
15 public interface IServerRootObject extends IRootObject {
16 /***
17 Get the modifications that happened since the specified version number.
18 @param clientversion The version number of the client.
19 The first modification returned by this method must be the one that changed the structure from
20 <code>clientversion</code> to <code>clientversion+1</code>.
21 @return The modifications necessary to update the client's structure to the server's version.
22 An array of string array. The second level array are of length 3 and contain the following information:<br>
23 <code>{ VERSIONNUMBER, "COMMAND", "MODIFICATION" }</code>.<br>
24 VERSIONNUMBER is the number of the version of the structure that has been produced by the according modification.<br>
25 COMMAND is the update command, one of "FULLUPDATE" or "MODIFICATION". "FULLUPDATE" means that the version of the client is too
26 old to specify the differences between client and server by means of modifications. The complete XML description of the structure
27 will then be contained in the last position of the array. "MODIFICATION" means that the array contains a normal modification at the
28 last position which expresses a difference between two versions.<br>
29 MODIFICATION Either the specification of the modification or the full XML description of the structure (see above).<br>
30
31 */
32 String[][] getModificationsForUpdate(int clientversion);
33
34 /***
35 Commit a modification to the server structure.
36 @param clientversion The version of the client before the specified modifications have been applied.
37 @param modification A modification to apply to the structure.
38 @return The version number of the structure after the modification has been applied.
39 @exception IncompatibleVersionsException If <code>clientversion</code> is not equal to the server's version.
40 @exception IllegalModificationException If the modification could not be interpreted.
41 */
42 int commitModification(int clientversion, String modification) throws IncompatibleVersionsException, IllegalModificationException;
43
44 /***
45 Get the current version number of the structure.
46 */
47 int getVersionNumber();
48
49 /***
50 Get the XML description of the complete structure.
51 */
52 String getXML();
53
54 /***
55 Set the XML description of the complete structure.
56 */
57 void setXML(String xml);
58
59 /***
60 Set if the XML description of the structure is valid.
61 */
62 void setXMLValid(boolean valid);
63
64 /***
65 Check if the XML description of the structure is valid.
66 */
67 boolean isXMLValid();
68
69 /***
70 Increment the version number of the structure.
71 @return The version number of the structure after incrementation.
72 */
73 int incrementVersionNumber();
74
75 /***
76 Get the modification buffer used by this structure.
77 @return The modification buffer used by this structure.
78 */
79 ModificationBuffer getModificationBuffer();
80
81 /***
82 Check if a client has queried this server for update.
83 */
84 boolean getClientUpdateOccured();
85
86 /***
87 Set that a client update has occured.
88 */
89 void setClientUpdateOccured();
90 }