Offline Mode » History » Version 6
Henning Blohm, 18.09.2016 19:11
| 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 | 6 | Henning Blohm | The offline mode is enabled or disabled by setting the system property *com.zfabrik.offline* to "true" or "false" respectively. The default value of this property is "false". |
| 11 | 5 | Henning Blohm | |
| 12 | 6 | Henning Blohm | This works regardlessly of how this system property is set in the home process. Worker processes receive an updated value upon synchronization. |
| 13 | 2 | Henning Blohm | |
| 14 | 6 | Henning Blohm | h3. Enabling Offline mode at start time |
| 15 | 1 | Henning Blohm | |
| 16 | 6 | Henning Blohm | Using the file *<Z2 home>/run/bin/runtime.properties* the offline mode can be enabled at starting time already. Not however that typically some collected offline content needs to be retrieved before working with a z2 system. |
| 17 | 1 | Henning Blohm | |
| 18 | 6 | Henning Blohm | h3. Toggling Offline Mode during Development |
| 19 | |||
| 20 | Alternatively the offline mode may be switched on or off using a check box on the Z2 gui. |
||
| 21 | |||
| 22 | |||
| 23 | 2 | Henning Blohm | h2. Design |
| 24 | |||
| 25 | * Component Repository use @AbstractRepository.checkOffline()@ whenever a connection is normally required. |
||
| 26 | |||
| 27 | The method looks essentially like this: |
||
| 28 | |||
| 29 | <pre><code class="java"> |
||
| 30 | protected void checkOfflineMode() { |
||
| 31 | if (Foundation.isOffline()) { |
||
| 32 | throw new OfflineModeException("Running in offline mode"); |
||
| 33 | } |
||
| 34 | } |
||
| 35 | </code></pre> |
||
| 36 | |||
| 37 | where @Foundation.isOffline()* checks for the boolean String value of the system property *com.zfabrik.offline*. |
||
| 38 | 1 | Henning Blohm | |
| 39 | 3 | Henning Blohm | * Changing the system property can happen any time |
| 40 | * Initially the property is assumed as @false@ and should only be specified otherwise in @runtime.properties@. |
||
| 41 | 6 | Henning Blohm | * The offline mode is conveyed to worker process via the _COMMAND_COMPLETE_ message send to workers in the verify phase of the synchronization process. |
| 42 | 3 | Henning Blohm | * There is a toggle checkbox in the GUI. |
