]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.structural.synchronization/src/org/simantics/structural/synchronization/protocol/SynchronizationEventHandler.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.structural.synchronization / src / org / simantics / structural / synchronization / protocol / SynchronizationEventHandler.java
1 package org.simantics.structural.synchronization.protocol;\r
2 \r
3 import java.util.Collection;\r
4 \r
5 /**\r
6  * Communicates synchronization events from the synchronizer\r
7  * browsing variable structure to the simulator.\r
8  * \r
9  * TODO:\r
10  * - which properties available in the variable are sent (based on classification)\r
11  * - what to do when resource ids change (export/import)\r
12  */\r
13 public interface SynchronizationEventHandler {\r
14     \r
15     \r
16     /**\r
17      * Called at the beginning of synchronization. All other\r
18      * methods must be called between beginSynchronization/endSynchronization pair.\r
19      */\r
20     void beginSynchronization();\r
21     \r
22     /**\r
23      * Called at the end of synchronization.\r
24      */\r
25     void endSynchronization();\r
26     \r
27     /**\r
28      * Describes a component\r
29      */\r
30     void beginComponent(\r
31             String name,\r
32             String typeId,\r
33             Collection<SerializedVariable> properties,\r
34             Collection<Connection> connections,\r
35             Collection<ChildInfo> children) throws SynchronizationException;\r
36     \r
37     void endComponent();\r
38 \r
39     /*\r
40      * TODO: maybe we require that whenever a type is updated all its instances are also updated\r
41      */\r
42     void beginType(\r
43             String id,\r
44             Collection<SerializedVariable> properties) throws SynchronizationException;\r
45     void endType();\r
46 \r
47     void reportProblem(String description);\r
48 \r
49     void reportProblem(String description, Exception e);\r
50     \r
51     /**\r
52      * Called when an error happens during synchronization that prevents its continuation.\r
53      * Returns true, if the handler was able to fix the state of the mapping. If false,\r
54      * the current state is unusable and should be discarded.\r
55      */\r
56     //boolean cleanUpAfterSynchronizationFailure();\r
57 }\r