Managing the session
Overview
Model transformation is carried out within a session which has the following characteristics:
· It can be interrupted during processing ("sessionAbort").
· It must end with a consistency check, since any transformation must be consistent, otherwise it is refused.
· Sessions must not be embedded.
· The final user can carry out an "undo" for a session.
· It is the final user who makes a definite backup of a session, except when the transformation mode is performed with wobjing. In this case, if the consistency check is sound, a back-up is made.
Starting a session
sessionBegin (in String sessionName, in boolean isPersistant);
This starts a session. The name of the session (chosen by the programmer) is fixed as a parameter. The "isPersistent" parameter determines whether the user model should be modified (isPersistent = true) or whether transformation should be ignored at the end of a session.
Ending a session
sessionAbort ();
This cancels
the current session. All modifications are ignored.
sessionEnd ();
This ends the current session. If the session is persistent, then consistency checks are run. If the model is consistent, Objecteering informs each of the updated "clients" (graphic
editors, explorers). If the session is transient, it ends with no impact on the user model and
the editors. This is not the case for removable consistency checks.
Note: If a J program is ended not using these primitives (end of the program or "exit" primitive), this corresponds to an "Abort".
State of a session
The following methods give the information related to the current session.
boolean sessionHasBegun()
This
determines whether a session is in progress.
String get_sessionName()
This returns the name of the current session, or "" (empty) if there is no active session.
Managing consistency
If removable
consistency checks are active, the consistency check function is activated automatically at the end of a
persistent session.
It can be launched by a program using the
following method:
boolean sessionCheck()
which
returns true if the model is consistent.