#include "ApplicationBase.h"
Classes | |
struct | structServiceInformation |
Public Member Functions | |
ApplicationBase (const std::string &_serviceName, const std::string &_serviceType, AbstractUiNotifier *_uiNotifier=nullptr, AbstractModelNotifier *_modelNotifier=nullptr) | |
virtual | ~ApplicationBase () |
virtual void | run (void)=0 |
Will be called when the service was successfully started, the hppt and/or websocket connection is established and the service may start its work. | |
virtual std::string | processAction (const std::string &_action, JsonDocument &_doc)=0 |
Will be called whenever a action should be processed. Core actions will be processed in the base and will not be forwarded to this function (see documentation) | |
virtual std::string | processMessage (ServiceBase *_sender, const std::string &_message, JsonDocument &_doc)=0 |
Will be called whenever a message should be processed. Core messages will be processed in the base and will not be forwarded to this function (see documentation) | |
virtual void | uiConnected (components::UiComponent *_ui)=0 |
Will be called when a UI connected to the session and is ready to work. | |
virtual void | uiDisconnected (const components::UiComponent *_serviceInfo)=0 |
Will be called when a UI disconnected from the session (is already closed) | |
virtual void | modelConnected (components::ModelComponent *_model)=0 |
Will be called when a model service connected to the session and is ready to work. | |
virtual void | modelDisconnected (const components::ModelComponent *_serviceInfo)=0 |
Will be called when a mode service disconnected from the session (is already closed) | |
virtual void | serviceConnected (ServiceBase *_service)=0 |
Will be called when a service is connected to the session (UI and model services will not trigger this function) | |
virtual void | serviceDisconnected (const ServiceBase *_service)=0 |
Will be called when a service is disconnected from the session (is already closed) (UI and model services will not trigger this function) | |
virtual void | preShutdown (void)=0 |
Will be called before the whole session starts to shut down (shut down can not be stopped) At this point all services, that are listed as connected, are still reachable. | |
virtual void | shuttingDown (void)=0 |
Will be called when the application is shutting down (shut down can not be stopped) At this point all services, that are listed as connected, might not be reachable anymore. This function will be called after the preShutDown call. | |
virtual bool | startAsRelayService (void) const =0 |
Will return true if this application requires a relay service for a websocket connection. | |
virtual PropertyGridCfg | createSettings (void) const =0 |
Create settings that your application uses that are editable in the uiService. The created class will be deleted after used for sending or synchronizing with the database. The created settings will be requested upon Service startup to synchronize with the database, aswell as when the uiService is connected. | |
virtual void | settingsSynchronized (const PropertyGridCfg &_config)=0 |
This function will be called when the settings were synchronized with the database. At this point the values from the dataset should be stored since the dataset will be deleted after this function call. | |
virtual bool | settingChanged (const Property *_property)=0 |
This function will be called when the settings were changed in the uiService. The value of the provided item should be stored. If the change of the item will change the item visibility of any settings item, this function should return true, otherwise false. When returning true, the function createSettings() will be called and the created dataset will be send to the uiService to update the Settings in the dialog. | |
virtual std::string | deploymentPath (void) const |
Will return the path of the deployment folder Returns an empty string in case of an error. | |
virtual void | modelSelectionChanged (void) |
void | setDataBaseURL (const std::string &_url) |
Will set the database URL of the database this application is using. | |
void | setSiteID (const std::string &_id) |
Will set the site ID this application is running on. | |
void | setWebSocketURL (const std::string &_url) |
Will set the websocket URL that this application is connected to (only required if socket connection is established) | |
void | setDirectoryServiceURL (const std::string &_url) |
Will set the local directory service URL. | |
void | setSessionServiceURL (const std::string &_url) |
Will set the session service URL. | |
void | setSessionID (const std::string &_id) |
Will set the session ID of the application. | |
void | setProjectType (const std::string &_type) |
Set the project type. | |
std::string | dataBaseURL (void) |
Will return the URL of the database. | |
std::string | siteID (void) |
Will return the site ID this application is running on. | |
std::string | webSocketURL (void) |
Will return the websocket URL, it is only set if a websocket was required on startup: startAsRelayService() == true. | |
std::string | sessionServiceURL (void) |
Will return the session service URL. | |
std::string | directoryServiceURL (void) |
Will return the local directory service URL. | |
std::string | sessionID (void) |
Will return the session ID this service is running in. | |
const std::string & | projectType (void) const |
The current project type. | |
const std::string & | getCollectionName () const |
bool | isUiConnected (void) const |
Will return true if a UI is running in the session. | |
bool | isModelConnected (void) const |
Will return true if a model service is running in the session. | |
components::ModelComponent * | modelComponent (void) const |
Will return the model component used in this application The model component only exists when a model service is running in the session. | |
components::UiComponent * | uiComponent (void) const |
Will return the ui component used in this application The UI component only exists when a ui service is running in the session. | |
ServiceBase * | getConnectedServiceByID (serviceID_t _id) |
Will return the service with the specified ID. | |
ServiceBase * | getConnectedServiceByName (const std::string &_name) |
Will return the service with the specified name. | |
AbstractUiNotifier * | uiNotifier (void) |
Will return the uiNotifier attached to this application. | |
AbstractModelNotifier * | modelNotifier (void) |
Will return the modelNotifier attached to this application. | |
ClassFactory & | getClassFactory (void) |
Returns a handle to the global class factory for the service. | |
void | addModalCommand (ModalCommandBase *command) |
void | removeModalCommand (ModalCommandBase *command) |
std::string | processActionWithModalCommands (const std::string &_action, JsonDocument &_doc) |
void | enableMessageQueuing (const std::string &_serviceName, bool _flag) |
Set the message queuing flag If the flag counter reaches 0 the currently queued message will be flushed. | |
void | flushQueuedHttpRequests (const std::string &_serviceName) |
Will flush the currently queued messages for the service with the provided name. | |
bool | sendMessage (bool _queue, const std::string &_serviceName, const JsonDocument &_doc, std::string &_response) |
Will send the message to the service with the specified name. | |
bool | sendMessage (bool _queue, const std::string &_serviceName, const JsonDocument &_doc, std::list< std::pair< UID, UID > > &_prefetchIds, std::string &_response) |
Will send the message to the service with the specified name. | |
bool | broadcastMessage (bool _queue, const std::string &_message) |
Will send the message to all other services in this session. | |
bool | broadcastMessage (bool _queue, const JsonDocument &_doc) |
Will send the message to all other services in this session. | |
void | prefetchDocumentsFromStorage (const std::list< UID > &entities) |
void | prefetchDocumentsFromStorage (const std::list< ot::EntityInformation > &entityInfo) |
UID | getPrefetchedEntityVersion (UID entityID) |
std::string | getLogInUserName () const |
std::string | getLogInUserPsw () const |
Public Member Functions inherited from ot::ServiceBase | |
ServiceBase () | |
Constructor. | |
ServiceBase (const std::string &_name, const std::string &_type) | |
Constructor. | |
ServiceBase (const std::string &_name, const std::string &_type, const std::string &_url, serviceID_t _id, const std::string &_siteId=std::string()) | |
Constructor. | |
ServiceBase (const ServiceBase &_other) | |
Copy constructor. | |
ServiceBase & | operator= (const ServiceBase &_other) |
bool | operator== (const ServiceBase &_other) const |
bool | operator!= (const ServiceBase &_other) const |
virtual | ~ServiceBase () |
Deconstructor. | |
void | setServiceID (serviceID_t _id) |
Set the service ID. | |
void | setServiceURL (const std::string &_url) |
Set the service URL. | |
void | setServiceName (const std::string &_name) |
Set the service name. | |
void | setServiceType (const std::string &_type) |
Set the service type. | |
void | setSiteId (const std::string &_id) |
Set the site ID. | |
void | setSessionCount (int _count) |
Set the session count. | |
serviceID_t | getServiceID (void) const |
Return the service ID. | |
int | getServiceIDAsInt (void) const |
Return the service ID as an Integer (The service ID is an Integer stored as a String) | |
int | getSessionCount (void) const |
Return the session count. | |
const std::string & | getServiceURL (void) const |
Return the service URL. | |
std::string | getServiceName (void) const |
Return the service name. | |
std::string | getServiceType (void) const |
Return the service type. | |
std::string | getSiteId (void) const |
Return the site ID. | |
BasicServiceInformation | getBasicServiceInformation (void) const |
Public Member Functions inherited from ot::ActionHandler | |
ActionHandler () | |
ActionHandler (const ActionHandler &_other)=default | |
ActionHandler (ActionHandler &&_other)=default | |
virtual | ~ActionHandler () |
ActionHandler & | operator= (const ActionHandler &_other)=default |
ActionHandler & | operator= (ActionHandler &&_other)=default |
Protected Member Functions | |
bool | EnsureDataBaseConnection (void) |
bool | storeSettingToDataBase (const PropertyGridCfg &_config, const std::string &_databaseURL, const std::string &_siteID, const std::string &_userName, const std::string &_userPassword, const std::string &_userCollection) |
PropertyGridCfg | getSettingsFromDataBase (const std::string &_databaseURL, const std::string &_siteID, const std::string &_userName, const std::string &_userPassword, const std::string &_userCollection) |
void | __serviceConnected (const std::string &_name, const std::string &_type, const std::string &_url, serviceID_t _id) |
Protected Attributes | |
bool | m_uiMessageQueuingEnabled |
std::map< std::string, structServiceInformation > | m_serviceNameMap |
std::map< serviceID_t, structServiceInformation > | m_serviceIdMap |
structServiceInformation | m_sessionService |
structServiceInformation | m_directoryService |
components::ModelComponent * | m_modelComponent |
components::UiComponent * | m_uiComponent |
AbstractUiNotifier * | m_uiNotifier |
AbstractModelNotifier * | m_modelNotifier |
std::string | m_databaseURL |
std::string | m_siteID |
std::string | m_websocketURL |
std::string | m_sessionID |
std::string | m_projectName |
std::string | m_collectionName |
std::string | m_projectType |
std::list< ot::ModalCommandBase * > | m_modalCommands |
std::list< UID > | m_selectedEntities |
std::map< UID, UID > | m_prefetchedEntityVersions |
Protected Attributes inherited from ot::ServiceBase | |
serviceID_t | m_serviceID |
std::string | m_serviceURL |
Service ID. | |
std::string | m_serviceName |
Service URL. | |
std::string | m_serviceType |
Service name. | |
std::string | m_siteId |
Service type. | |
int | m_sessionCount |
Site ID. | |
Friends | |
class | intern::ExternalServicesComponent |
ot::ApplicationBase::ApplicationBase | ( | const std::string & | _serviceName, |
const std::string & | _serviceType, | ||
AbstractUiNotifier * | _uiNotifier = nullptr, | ||
AbstractModelNotifier * | _modelNotifier = nullptr ) |
|
virtual |
|
protected |
void ot::ApplicationBase::addModalCommand | ( | ot::ModalCommandBase * | command | ) |
bool ot::ApplicationBase::broadcastMessage | ( | bool | _queue, |
const JsonDocument & | _doc ) |
Will send the message to all other services in this session.
_queue | If true, the message will be queued |
_doc | The JSON Document to send |
bool ot::ApplicationBase::broadcastMessage | ( | bool | _queue, |
const std::string & | _message ) |
Will send the message to all other services in this session.
_queue | If true, the message will be queued |
_message | The message to send |
|
pure virtual |
Create settings that your application uses that are editable in the uiService. The created class will be deleted after used for sending or synchronizing with the database. The created settings will be requested upon Service startup to synchronize with the database, aswell as when the uiService is connected.
Implemented in Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, and Application.
|
inline |
Will return the URL of the database.
|
virtual |
Will return the path of the deployment folder Returns an empty string in case of an error.
|
inline |
Will return the local directory service URL.
void ot::ApplicationBase::enableMessageQueuing | ( | const std::string & | _serviceName, |
bool | _flag ) |
Set the message queuing flag If the flag counter reaches 0 the currently queued message will be flushed.
_serviceName | The name of the service |
_flag | The flag |
|
protected |
void ot::ApplicationBase::flushQueuedHttpRequests | ( | const std::string & | _serviceName | ) |
Will flush the currently queued messages for the service with the provided name.
_serviceName | The name of the service |
|
inline |
Returns a handle to the global class factory for the service.
|
inline |
ot::ServiceBase * ot::ApplicationBase::getConnectedServiceByID | ( | serviceID_t | _id | ) |
Will return the service with the specified ID.
_id | The ID of the requested service |
ot::ServiceBase * ot::ApplicationBase::getConnectedServiceByName | ( | const std::string & | _name | ) |
Will return the service with the specified name.
_name | The name of the requested service |
std::string ot::ApplicationBase::getLogInUserName | ( | ) | const |
std::string ot::ApplicationBase::getLogInUserPsw | ( | ) | const |
|
protected |
|
inline |
Will return true if a model service is running in the session.
|
inline |
Will return true if a UI is running in the session.
|
inline |
Will return the model component used in this application The model component only exists when a model service is running in the session.
|
pure virtual |
Will be called when a model service connected to the session and is ready to work.
Implemented in Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, and Application.
|
pure virtual |
Will be called when a mode service disconnected from the session (is already closed)
Implemented in Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, and Application.
|
inline |
Will return the modelNotifier attached to this application.
|
inlinevirtual |
Reimplemented in Application, Application, and Application.
void ot::ApplicationBase::prefetchDocumentsFromStorage | ( | const std::list< ot::EntityInformation > & | entityInfo | ) |
void ot::ApplicationBase::prefetchDocumentsFromStorage | ( | const std::list< UID > & | entities | ) |
|
pure virtual |
Will be called before the whole session starts to shut down (shut down can not be stopped) At this point all services, that are listed as connected, are still reachable.
Implemented in Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, and Application.
|
pure virtual |
Will be called whenever a action should be processed. Core actions will be processed in the base and will not be forwarded to this function (see documentation)
_action | The action that should be processed |
_doc | The document containing all the information |
Implemented in Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, and Application.
std::string ot::ApplicationBase::processActionWithModalCommands | ( | const std::string & | _action, |
JsonDocument & | _doc ) |
|
pure virtual |
Will be called whenever a message should be processed. Core messages will be processed in the base and will not be forwarded to this function (see documentation)
_sender | The service that this message was sent from |
_message | The message that should be processed |
_doc | The document containing all the information |
|
inline |
The current project type.
void ot::ApplicationBase::removeModalCommand | ( | ot::ModalCommandBase * | command | ) |
|
pure virtual |
Will be called when the service was successfully started, the hppt and/or websocket connection is established and the service may start its work.
Implemented in Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, and Application.
bool ot::ApplicationBase::sendMessage | ( | bool | _queue, |
const std::string & | _serviceName, | ||
const JsonDocument & | _doc, | ||
std::list< std::pair< UID, UID > > & | _prefetchIds, | ||
std::string & | _response ) |
Will send the message to the service with the specified name.
_queue | If true, the message will be queued |
_serviceName | The name of the service |
_doc | The document containing the message |
_prefetchIds | A list containing the prefetched IDs |
_response | The reponse will be written here |
bool ot::ApplicationBase::sendMessage | ( | bool | _queue, |
const std::string & | _serviceName, | ||
const JsonDocument & | _doc, | ||
std::string & | _response ) |
Will send the message to the service with the specified name.
_queue | If true, the message will be queued |
_serviceName | The name of the service |
_doc | The document containing the message |
_response | The reponse will be written here |
|
pure virtual |
Will be called when a service is connected to the session (UI and model services will not trigger this function)
_service | The service information |
Implemented in Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, and Application.
|
pure virtual |
Will be called when a service is disconnected from the session (is already closed) (UI and model services will not trigger this function)
_service | The service information |
Implemented in Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, and Application.
|
inline |
Will return the session ID this service is running in.
|
inline |
Will return the session service URL.
|
inline |
Will set the database URL of the database this application is using.
_url | The URL of the database to set |
void ot::ApplicationBase::setDirectoryServiceURL | ( | const std::string & | _url | ) |
Will set the local directory service URL.
_url | The directory service URL |
|
inline |
Set the project type.
void ot::ApplicationBase::setSessionID | ( | const std::string & | _id | ) |
Will set the session ID of the application.
_id | The session ID to set |
void ot::ApplicationBase::setSessionServiceURL | ( | const std::string & | _url | ) |
Will set the session service URL.
_url | The session service URL |
|
inline |
Will set the site ID this application is running on.
_id | The site ID to set |
|
pure virtual |
This function will be called when the settings were changed in the uiService. The value of the provided item should be stored. If the change of the item will change the item visibility of any settings item, this function should return true, otherwise false. When returning true, the function createSettings() will be called and the created dataset will be send to the uiService to update the Settings in the dialog.
The | item that has been changed in the uiService (instance will be deleted after this function call) |
Implemented in Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, and Application.
|
pure virtual |
This function will be called when the settings were synchronized with the database. At this point the values from the dataset should be stored since the dataset will be deleted after this function call.
The | dataset that contains all values |
Implemented in Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, and Application.
|
inline |
Will set the websocket URL that this application is connected to (only required if socket connection is established)
_url | The websocket URL to set |
|
pure virtual |
Will be called when the application is shutting down (shut down can not be stopped) At this point all services, that are listed as connected, might not be reachable anymore. This function will be called after the preShutDown call.
Implemented in Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, and Application.
|
inline |
Will return the site ID this application is running on.
|
pure virtual |
Will return true if this application requires a relay service for a websocket connection.
Implemented in Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, and Application.
|
protected |
|
inline |
Will return the ui component used in this application The UI component only exists when a ui service is running in the session.
|
pure virtual |
Will be called when a UI connected to the session and is ready to work.
Implemented in Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, and Application.
|
pure virtual |
Will be called when a UI disconnected from the session (is already closed)
Implemented in Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, Application, and Application.
|
inline |
Will return the uiNotifier attached to this application.
|
inline |
Will return the websocket URL, it is only set if a websocket was required on startup: startAsRelayService() == true.
|
friend |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |