Offline Mode

The purpose of the offline mode is twofold:

  • 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.
  • 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.

How the offline mode is used.

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".

This works regardlessly of how this system property is set in the home process. Worker processes receive an updated value upon synchronization.

Enabling Offline mode at start time

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.

Toggling Offline Mode during Development

Alternatively the offline mode may be switched on or off using a check box on the Z2 gui.

Design

  • Component Repository use AbstractRepository.checkOffline() whenever a connection is normally required.

The method looks essentially like this:

    protected void checkOfflineMode() {
        if (Foundation.isOffline()) {
            throw new OfflineModeException("Running in offline mode");
        }
    }

where @Foundation.isOffline()* checks for the boolean String value of the system property com.zfabrik.offline.

  • Changing the system property can happen any time
  • Initially the property is assumed as false and should only be specified otherwise in runtime.properties.
  • The offline mode is conveyed to worker process via the COMMAND_COMPLETE message send to workers in the verify phase of the synchronization process.
  • There is a toggle checkbox in the GUI.