Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
+156
@@ -0,0 +1,156 @@
|
||||
/**
|
||||
* MainHandler for AssetManagement
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*/
|
||||
|
||||
#include "initialization.h"
|
||||
#include "handler_aes_data.h"
|
||||
#include "handler_ppm_data.h"
|
||||
#include "handler_pdm_data.h"
|
||||
#include "handler_mdm_data.h"
|
||||
#include "handler_tab_data.h"
|
||||
#include "handler_effect_show.h"
|
||||
#include "handler_effect_show_actor_relocation.h"
|
||||
#include "handler_effect_show_vehicle_status.h"
|
||||
#include "settings.h"
|
||||
|
||||
#include <ngldb/db_service_handler.h>
|
||||
|
||||
namespace EffectShowManagement
|
||||
{
|
||||
|
||||
Initialization::Initialization()
|
||||
: m_logger(getLogger("MainHandler"))
|
||||
{}
|
||||
|
||||
Initialization::~Initialization()
|
||||
{
|
||||
m_handlerAesData = nullptr;
|
||||
m_handlerPpmData = nullptr;
|
||||
m_handlerTabData = nullptr;
|
||||
m_handlerMdmData = nullptr;
|
||||
m_handlerEffectShow = nullptr;
|
||||
m_handlerEffectShowActorRelocation = nullptr;
|
||||
m_handlerEffectShowVehicleStatus = nullptr;
|
||||
|
||||
m_ddsHandler = nullptr;
|
||||
m_dbHandler = nullptr;
|
||||
}
|
||||
|
||||
bool Initialization::initialize(const std::shared_ptr<DDSConnector::DdsConnector> &ddsConnector, const QSqlDatabase &sqlDb)
|
||||
{
|
||||
INFO_LOG(m_logger) << "Start EffectShowManagement Initialization.";
|
||||
|
||||
// initialize DDS
|
||||
m_ddsHandler = std::make_shared<DdsHandler>(ddsConnector);
|
||||
if (!m_ddsHandler->init())
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Initialisation DdsHandler failed.";
|
||||
return false;
|
||||
}
|
||||
|
||||
// initialize database
|
||||
m_dbHandler = std::make_shared<DbHandler>();
|
||||
if (!m_dbHandler->init(ddsConnector->getPartitionId(), sqlDb))
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Initialisation DbHandler failed.";
|
||||
return false;
|
||||
}
|
||||
|
||||
// initialize handlerEffectShow
|
||||
m_handlerEffectShow = std::make_shared<HandlerEffectShow>(this);
|
||||
// initialize handler EffectShowActorRelocation
|
||||
m_handlerEffectShowActorRelocation = std::make_shared<HandlerEffectShowActorRelocation>(this);
|
||||
// initialize handler VehicleStatus
|
||||
m_handlerEffectShowVehicleStatus = std::make_shared<HandlerEffectShowVehicleStatus>(this);
|
||||
// initialize handlerPpmData
|
||||
m_handlerPpmData = std::make_shared<HandlerPpmData>(this);
|
||||
// initialize handlerPdmData
|
||||
m_handlerPdmData = std::make_shared<HandlerPdmData>(m_ddsHandler);
|
||||
// initialize handlerMdmData
|
||||
m_handlerMdmData = std::make_shared<HandlerMdmData>(m_ddsHandler);
|
||||
// initialize handlerTabData
|
||||
m_handlerTabData = std::make_shared<HandlerTabData>(this);
|
||||
// initialize handlerAesData
|
||||
m_handlerAesData = std::make_shared<HandlerAesData>(this);
|
||||
|
||||
INFO_LOG(m_logger) << "EffectShowManagement initialized.";
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
bool Initialization::loadFromDatabase()
|
||||
{
|
||||
if (!m_ddsHandler ||
|
||||
!m_dbHandler ||
|
||||
!m_handlerAesData ||
|
||||
!m_handlerPpmData ||
|
||||
!m_handlerPdmData ||
|
||||
!m_handlerMdmData ||
|
||||
!m_handlerTabData ||
|
||||
!m_handlerEffectShow ||
|
||||
!m_handlerEffectShowActorRelocation ||
|
||||
!m_handlerEffectShowVehicleStatus)
|
||||
return false;
|
||||
|
||||
if (!m_handlerEffectShow->init())
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Initialisation handlerEffectShow failed.";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!m_handlerEffectShowActorRelocation->init())
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Initialisation handlerEffectShowActorRelocation failed.";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!m_handlerEffectShowVehicleStatus->init())
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Initialisation HandlerEffectShowVehicleStatus failed.";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!m_handlerPpmData->init())
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Initialisation HandlerPpmData failed.";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!m_handlerMdmData->init())
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Initialisation HandlerMdmData failed.";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!m_handlerTabData->init())
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Initialisation HandlerTabData failed.";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!m_handlerAesData->init())
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Initialisation HandlerAesData failed.";
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
std::shared_ptr<DatabaseInterface> Initialization::db() const
|
||||
{
|
||||
return m_dbHandler->db();
|
||||
}
|
||||
|
||||
int Initialization::exerciseId() const
|
||||
{
|
||||
if (dds() && dds()->ddsConnector())
|
||||
return dds()->ddsConnector()->getPartitionId();
|
||||
return -1;
|
||||
}
|
||||
|
||||
} // namespace EffectShowManagement
|
||||
Reference in new issue
Block a user