JSUP SHARED AND USER DOMAINS (BOZZA) ------------------------------------------------------------------------------ Indice Argomenti 1. Shared domain 2. User domain A [JSup application], to support multi user, is divided into two different domains: * Shared: the common part, system part of the application; in other words it is the part that does not depend of the user and that must work without a connected user (see [JSup execution modes]). A single instance of the shared domain is created for a JSup application. * User: the user specific part of the application. For every user that connects to the JSup application a private instance of the User domain is created, with logic and [tag] values independent from the other users. For each domain, a [code] valid for the entire domain can be defined: * On startup: a [JavaCode] that will be executed at the start of the domain (at the application startup, in the case of the shared domain, at the user connection in the case of the user domain). * While active: a [JavaCode] that runs periodically while the domain is active (deprecated, better to use Triggered/timed code). * On shutdown: a [JavaCode] that will be executed when the domain is stopped (at the application shutdown in the case of the shared domain, when the user disconnects in the case of the user domain). * Condition: code associated with a condition (a [code] that returns true/false), for that condition you can specify what to do when the condition becomes true, while the condition is true (with execution period indicated), when the condition becomes false and while the condition is false (with indicated execution period). * Triggered / Timed: code that can be executed either when the value of one or more tags changes (or is forced), or periodically every given milliseconds, or it can be scheduled at the application level (in edit mode) or it can be made available for the [scheduling] by the user (at runtime). These various modes of execution are not mutually exclusive. * JavaCode function: functions written in [JavaCode] that can accept parameters, return a value (and even throw exceptions) and that can be called from JavaCode of the same domain (but the JavaCode functions of the Shared domain can also be made available for the User domain) or even from [Math code]. They can also be called by [Math code] embedded in strings, for example alarm descriptions or IOHook#Programmatically calculated items|calculated Tag I/O items]. * Key code: available only int the User domain, they allow you to associate (globally throughout the application and not for a single [window]) the pressure of a key (or a combination of keys) to the execution of a code ([JavaCode] typically. * JavaCode common: A code written in pure Java that allows you to define global static fields or even static methods, although it is better, when possible, to use JavaCode functions for this purpose. 1. Shared domain The shared domain includes: * shared [tags] of the variable database: Tools / Tag database; * the communication with external devices (for the shared [tags] for where [I/O hooks] have been defined); * the shared logic: File / Application properties / Edit SHARED code; * the [alarm handling]; * the variable, alarm and event historian: see [JSup historian]; * the shared instance of the [JSup scheduler]; * critical section handling (used from [JavaCode] to synchronize the access to some resources or operations from different users and shared login). 2. User domain Every connected user has its own private user domain instance that is independent from the other user's user domain. So when a user writes a user [tags], the value of the same [tags] in the other user domains is not affected. The user domain includes: * the user [tags] of variable database: Tools / Tag database; * the user logic: File / Application properties / Edit USER code; * the [graphic windows] with their own logic: Window / Window properties; * the user instance of the [JSup scheduler] (which can be used, but is unusual).