Offline Mode » History » Version 5
Henning Blohm, 18.09.2016 17:49
1 | 1 | Henning Blohm | h1. Offline Mode |
---|---|---|---|
2 | 2 | Henning Blohm | |
3 | 5 | Henning Blohm | The purpose of the offline mode is twofold: |
4 | |||
5 | * You may use the offline mode to avoid long synchronisation times when developing in a situation poor network connectivity without turning off network connectivity as a whole. |
||
6 | * You may use the offline mode to prohibit download of latest changes from a central repository ahead of time. So you may use it as a "development in isolation" feature. |
||
7 | |||
8 | h2. How the offline mode is used. |
||
9 | |||
10 | |||
11 | |||
12 | 2 | Henning Blohm | |
13 | The offline mode can be turned on and off via a system property and interactively on the GUI. |
||
14 | |||
15 | h2. Design |
||
16 | |||
17 | * Component Repository use @AbstractRepository.checkOffline()@ whenever a connection is normally required. |
||
18 | |||
19 | The method looks essentially like this: |
||
20 | |||
21 | <pre><code class="java"> |
||
22 | protected void checkOfflineMode() { |
||
23 | if (Foundation.isOffline()) { |
||
24 | 4 | Henning Blohm | throw new OfflineModeException("Running in offline mode"); |
25 | 2 | Henning Blohm | } |
26 | } |
||
27 | </code></pre> |
||
28 | |||
29 | where @Foundation.isOffline()* checks for the boolean String value of the system property *com.zfabrik.offline*. |
||
30 | |||
31 | * Changing the system property can happen any time |
||
32 | 3 | Henning Blohm | * Initially the property is assumed as @false@ and should only be specified otherwise in @runtime.properties@. |
33 | * The system property status is backed in a JMX MBean attribute of the newly created Foundation MBean. |
||
34 | * We use the internal JMX implementation to broadcast attribute changes to all worker processes. |
||
35 | * There is a toggle checkbox in the GUI. |