GlobalObjects
Loading...
Searching...
No Matches
Watching / notifying persistent objects

Basic information

In order to be informed about changes and states in the object database, an extensive notification system is available in GlobalObjects. Among other things, this can be used to ensure the consistency of individual objects for several instances in multi-user operation.

You can monitor individual objects, groups of objects in containers and entire AllSets and be notified of changes. It is possible to monitor operations in the object database that take longer and to be notified about the progress. Additionally it is possible to watch the opening or closing of an object database of other clients.

See also

To observe an object, derived from glo::CallBack, must be passed to the respective observation method. In order for the notification to be processed, the virtual method glo::CallBack::notify(glo::NotifyNote & rNote) for the evaluation of the glo::NotifyNote must be overwritten.

See also
Example class derived from glo::CallBack

In principle, the observing instance that has triggered the change or the event itself is also notified.

Note
The observation functionality also provides valid results in single-user mode (an observation can be set as in multi-user mode).



Watching a persistent object

A single object can be assigned to the object database for watching in a variety of ways. This can be initiated via glo::Persistent::setWatch (...), glo::TOndemand::setWatch (...) or glo::Base::setWatchObject (...).

Another possibility is to use a glo::TPointerList, a glo::TPointerSet, a glo::TOndemandList or a glo::TOndemandSet. A watching can be set in these containers. Each object that is inserted into the containers is automatically observed with the watching mode of the container, or the watching is stopped when the object is removed from the container.

Note
If necessary, referenced objects are also observed if the keyword dependent (see also in table Glo-Data Types in column TypInfo) is set and the observation depth mode glo::EnDeepMode is corresponding. This also applies to the following explanations if several objects are observed simultaneously.
There is a limitation in the observation mode \ref GLO_TD_WATCHNOTIFY_MODE "glo::TdWatchNotifyMode" 'glo::WNM_READ'. This can only be set if the observation depth mode glo::EnDeepMode is 'glo::DM_FLAT'.
Attention
An observation must be terminated with the same parameters. This can be done either via glo::Persistent::unsetWatch (...), glo::TOndemand::unsetWatch (...) or glo::Base::unsetWatchObject (...).



Watching several persistent objects

A group of persistent objects can be observed by passing a subclass of glo::BaseSet to method glo::Base::setWatchLot (...) or by directly calling glo::BaseLot::setWatch(glo::TdWatchNotifyMode, glo::EnDeepMode, glo::CallBack*) respectively glo::BaseLot::setWatch(const glo::WatchSpecification&) (glo::BaseLot is the superclass of glo::TOndemandList, glo::TOndemandSet, glo::TPointerList and glo::TPointerSet).

Attention
The observation must be terminated with the same parameters. This can be done either via glo::Base::unsetWatchLot (...) or glo::BaseLot::unsetWatch(glo::TdWatchNotifyMode, glo::EnDeepMode, glo::CallBack*) or glo::BaseLot::unsetWatch(const glo::WatchSpecification&).



Evaluate notification for watched objects

The notification of the type glo::NotifyNote transports the following information:

glo::NotifNote values
glo::NotifNote attribute Content
glo::NotifyNote::m_ulNotifyMode The glo::TdWatchNotifyMode tells, which action(s) have been performed.
Possible values are:
glo::NotifyNote::m_ipCallBack Is usually the address of the glo::CallBack object. Is used to call its method glo::CallBack::notify (...) with the glo::NotifyNote.
glo::NotifyNote::m_nSocket Contains no information.
glo::NotifyNote::m_uiCommunicatorID The unique Communicator ID of the Notify trigger (the own Communicator ID can be determined via glo::Base::getCommunicatorID()).
glo::NotifyNote::m_strClientName The name of the triggering client.
glo::NotifyNote::m_ObjID The glo::ObjID of the object on which the action glo::NotifyNote::m_ulNotifyMode was executed.
glo::NotifyNote::m_uiInfo Contains no information.
glo::NotifyNote::m_uiInfo2 Contains no information.
glo::NotifyNote::m_strInfo Contains no information.
glo::NotifyNote::m_strInfo2 Contains no information.



Watching a glo::TAllSet

In a glo::TAllSet (all persistent objects of one type in the object database) the objects can be watched in a limited way only flat (no glo::EnDeepMode is passed). In addition, however, there is the possibility that the calling instance can be notified when a new object is saved, i.e. inserted into the glo::TAllSet. This can be initiated either via glo::TAllSet::setWatch(glo::TdWatchNotifyMode, glo::CallBack*) or glo::Base::setWatchClass (...).

Attention
The watching must be terminated with the same parameters. This can be done either via glo::TAllSet::unsetWatch(glo::TdWatchNotifyMode, glo::CallBack*) or glo::Base::unsetWatchClass (...).



Evaluate notification for watched glo::TAllSet

The notification of the type glo::NotifyNote transports the following information:

glo::NotifNote values
glo::NotifNote attribute Content
glo::NotifyNote::m_ulNotifyMode The glo::TdWatchNotifyMode tells, which action(s) have been performed.
Mögliche Werte sind:
glo::NotifyNote::m_ipCallBack Is usually the address of the glo::CallBack object. Is used to call its method glo::CallBack::notify (...) with the glo::NotifyNote.
glo::NotifyNote::m_nSocket Contains no information.
glo::NotifyNote::m_uiCommunicatorID The unique Communicator ID of the Notify trigger (the own Communicator ID can be determined via glo::Base::getCommunicatorID()).
glo::NotifyNote::m_strClientName The name of the triggering client.
glo::NotifyNote::m_ObjID The glo::ObjID of the object on which the action glo::NotifyNote::m_ulNotifyMode was executed.
glo::NotifyNote::m_uiInfo Contains no information.
glo::NotifyNote::m_uiInfo2 Contains no information.
glo::NotifyNote::m_strInfo Contains no information.
glo::NotifyNote::m_strInfo2 Contains no information.



Watching the connection establishment and disconnection to a GloServer

If one is connected to a GloServer, its can be observe which clients connect to this GloServer. This is initiated via the method glo::Base::setWatchClient (...) with the parameters glo::WNM_CLIENT_CONNECTSERVER or glo::WNM_CLIENT_DISCONNECTSERVER.

Attention
The watching must be terminated with the same parameters via glo::Base::unsetWatchClient (...).



Evaluate notification for observed connection establishment or disconnection to a GloServer

The notification of the type glo::NotifyNote transports the following information:

glo::NotifNote values
glo::NotifNote attribute Content
glo::NotifyNote::m_ulNotifyMode The glo::TdWatchNotifyMode tells, which action(s) have been performed.
Possible values are:
glo::NotifyNote::m_ipCallBack Is usually the address of the glo::CallBack object. Is used to call its method glo::CallBack::notify (...) with the glo::NotifyNote.
glo::NotifyNote::m_nSocket The SOCKET of the triggering client.
glo::NotifyNote::m_uiCommunicatorID Is 0, because it is only assigned when an object database is opened.
glo::NotifyNote::m_strClientName Contains no information because the client name is only assigned when an object database is opened.
glo::NotifyNote::m_ObjID Contains no information.
glo::NotifyNote::m_uiInfo Contains no information.
glo::NotifyNote::m_uiInfo2 Contains no information.
glo::NotifyNote::m_strInfo Contains no information.
glo::NotifyNote::m_strInfo2 The IP address (possibly resolved into a name) of the triggering client.



Watching the opening and closing of an object database

If one is connected to a GloServer, its can be observe which clients open and close which object database. This is initiated via the method glo::Base::setWatchClient (...) with the parameters glo::WNM_CLIENT_OPENBASE or glo::WNM_CLIENT_CLOSEBASE.

Attention
The observation must be terminated with the same parameters via glo::Base::unsetWatchClient (...).

Evaluate notification for observed opening and closing of an object database

The notification of the type glo::NotifyNote transports the following information:

glo::NotifNote values
glo::NotifNote attribute Content
glo::NotifyNote::m_ulNotifyMode The glo::TdWatchNotifyMode tells, which action(s) have been performed.
Possible values are:
glo::NotifyNote::m_ipCallBack Is usually the address of the glo::CallBack object. Is used to call its method glo::CallBack::notify (...) with the glo::NotifyNote.
glo::NotifyNote::m_nSocket The SOCKET of the triggering client.
glo::NotifyNote::m_uiCommunicatorID The unique Communicator ID of the Notify trigger (the own Communicator ID can be determined via glo::Base::getCommunicatorID()).
glo::NotifyNote::m_strClientName The name of the triggering client.
glo::NotifyNote::m_ObjID Contains no information.
glo::NotifyNote::m_uiInfo Contains no information.
glo::NotifyNote::m_uiInfo2 Contains no information.
glo::NotifyNote::m_strInfo Name of the open/closed object database.
glo::NotifyNote::m_strInfo2 The IP address (possibly resolved into a name) of the triggering client.



Notify about reading and writing the indexes

Reading and writing the indexes may take a little longer. If an object database is opened, the index is read (if not already done). So that the user does not get the feeling that the application is "frozen", the application can be informed about the progress of the read-in and display this to the user.
In order to be informed about the progress of the import, you only have to pass a corresponding glo::CallBack object to the calls of glo::Base::open (...) and glo::Base::close (...), or glo::Base::openBase (...) and glo::Base::closeBase (...), which handles the processing of the progress notifications.

Attention
This observation does not need to be set or removed, the passing of the glo::CallBack object is sufficient.

Evaluate notification of reading and writing of indexes

The notification of the type glo::NotifyNote transports the following information:

glo::NotifNote values
glo::NotifNote attribute Content
glo::NotifyNote::m_ulNotifyMode The glo::TdWatchNotifyMode tells, which action(s) have been performed.
Possible values are:
glo::NotifyNote::m_ipCallBack Is usually the address of the glo::CallBack object. Is used to call its method glo::CallBack::notify (...) with the glo::NotifyNote.
glo::NotifyNote::m_nSocket Contains no information.
glo::NotifyNote::m_uiCommunicatorID The unique Communicator ID of the Notify trigger (the own Communicator ID can be determined via glo::Base::getCommunicatorID()).
glo::NotifyNote::m_strClientName The name of the triggering client.
glo::NotifyNote::m_ObjID The index of the class ID in the glo::ObjID is currently read or written. All changes of this value result in the number of actions from glo::NotifyNote::m_uiInfo2.
glo::NotifyNote::m_uiInfo The percentage of the current index already read or written.
glo::NotifyNote::m_uiInfo2 Number of indexes that are read or written.
glo::NotifyNote::m_strInfo Name of the read or written current index.
glo::NotifyNote::m_strInfo2 Contains no information.



Notify about reindexing

If one is connected to an object database, the indexes can be reindexed, e.g. if they are 'corrupt'. This process can take longer, depending on the number of objects. The progress can also be displayed here. To do this, the methods glo::Base::reindexBase(const std::string&, glo::CallBack* ) or glo::Base::reindexBase(glo::CallBack*) only need to be passed a corresponding glo::CallBack object which handles the processing of the progress notifications.

Attention
This observation does not have to be set or cancelled, the passing of the glo::CallBack object is sufficient.

Notify about compression

If one is connected to an object database, the tables can be compressed, the entries of the deleted objects are removed from the tables. Since there is also an index of deleted objects in addition to the index of existing objects, the latter index can be disposed of when the deleted entries in the tables are removed. This process can take longer, depending on the number of objects. The progress can also be displayed here. To do this, the methods glo::Base::compressBase(const std::string&, glo::CallBack*) or glo::Base::compressBase(glo::CallBack*) only need to be passed a corresponding glo::CallBack object, which handles the processing of the progress notifications.

Attention
This observation does not need to be set or cancelled, the transfer of the glo::CallBack object is sufficient.

Evaluate notification of a progress

The notification of the type glo::NotifyNote transports the following information:

glo::NotifNote values
glo::NotifNote attribute Content
glo::NotifyNote::m_ulNotifyMode The glo::TdWatchNotifyMode tells, which action(s) have been performed.
Possible values are:
glo::NotifyNote::m_ipCallBack Ist in der Regel die Adresse des glo::CallBack-Objekts. Wird genutzt um dessen Methode glo::CallBack::notify (...) mit der glo::NotifyNote aufzurufen.
glo::NotifyNote::m_nSocket Contains no information.
glo::NotifyNote::m_uiCommunicatorID The unique Communicator ID of the Notify trigger (the own Communicator ID can be determined via glo::Base::getCommunicatorID()).
glo::NotifyNote::m_strClientName The name of the triggering client.
glo::NotifyNote::m_ObjID The class ID in the glo::ObjID whose table is currently being processed All changes of this value result in the number of actions from glo::NotifyNote::m_uiInfo2.
glo::NotifyNote::m_uiInfo The percentage of actions completed.
glo::NotifyNote::m_uiInfo2 Number of actions.
glo::NotifyNote::m_strInfo The name of the table which is currently being processed.
glo::NotifyNote::m_strInfo2 Contains no information.



Notify about Glo-Server connection failure

If one is connected to a GloServer, a notification can be initiated if there is a disconnection to the GloServer. This is initiated by the method glo::Base::connect (…), glo::Base::reconnect (…) or glo::Base::setWatchServer (…).

Evaluate notification for watched disconnection of a GloServer

The notification of the type glo::NotifyNote transports the following information:

glo::NotifNote values
glo::NotifNote attribute Content
glo::NotifyNote::m_ulNotifyMode The glo::TdWatchNotifyMode tells, which action(s) have been performed.
Possible values are:
glo::NotifyNote::m_ipCallBack Is usually the address of the glo::CallBack object. Is used to call its method glo::CallBack::notify (...) with the glo::NotifyNote.
glo::NotifyNote::m_nSocket Contains no information.
glo::NotifyNote::m_uiCommunicatorID Contains no information (the own CommunicatorID is lost due to the termination).
glo::NotifyNote::m_strClientName Contains no information, there is no triggering client.
glo::NotifyNote::m_ObjID Contains no information.
glo::NotifyNote::m_uiInfo Contains no information.
glo::NotifyNote::m_uiInfo2 The port number of the GloServer to which the connection was broken.
glo::NotifyNote::m_strInfo Contains no information.
glo::NotifyNote::m_strInfo2 The IP address (possibly resolved into a name) of the GloServer to which the connection was broken.