mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-23 07:15:35 +08:00
refactor: Start WebServices and CoreFacade separately
This commit is contained in:
@@ -808,12 +808,12 @@ namespace BlackCore
|
||||
|
||||
// now we can use settings
|
||||
// if not yet initialized, init web data services
|
||||
if (!m_useWebData)
|
||||
if (!m_webDataServices)
|
||||
{
|
||||
const CStatusMessageList msgs = this->useWebDataServices(CWebReaderFlags::AllReaders, CDatabaseReaderConfigList::forPilotClient());
|
||||
if (msgs.hasErrorMessages()) { return msgs; }
|
||||
}
|
||||
return this->startCoreFacadeAndWebDataServices(); // will do nothing if setup is not yet loaded
|
||||
return this->startCoreFacade(); // will do nothing if setup is not yet loaded
|
||||
}
|
||||
|
||||
CStatusMessageList CApplication::useFacadeNoContexts()
|
||||
@@ -825,7 +825,7 @@ namespace BlackCore
|
||||
const CStatusMessage msg = this->initLocalSettings();
|
||||
if (msg.isFailure()) { return msg; }
|
||||
|
||||
return this->startCoreFacadeAndWebDataServices(); // will do nothing if setup is not yet loaded
|
||||
return this->startCoreFacade(); // will do nothing if setup is not yet loaded
|
||||
}
|
||||
|
||||
CStatusMessageList CApplication::useWebDataServices(const CWebReaderFlags::WebReader webReaders, const CDatabaseReaderConfigList &dbReaderConfig)
|
||||
@@ -839,7 +839,6 @@ namespace BlackCore
|
||||
|
||||
m_webReadersUsed = webReaders;
|
||||
m_dbReaderConfig = dbReaderConfig;
|
||||
m_useWebData = true;
|
||||
return this->startWebDataServices();
|
||||
}
|
||||
|
||||
@@ -853,7 +852,7 @@ namespace BlackCore
|
||||
return this->getIContextApplication() && !this->getIContextApplication()->isUsingImplementingObject() && !this->getIContextApplication()->isEmptyObject();
|
||||
}
|
||||
|
||||
CStatusMessageList CApplication::startCoreFacadeAndWebDataServices()
|
||||
CStatusMessageList CApplication::startCoreFacade()
|
||||
{
|
||||
Q_ASSERT_X(m_parsed, Q_FUNC_INFO, "Call this function after parsing");
|
||||
|
||||
@@ -862,9 +861,7 @@ namespace BlackCore
|
||||
|
||||
Q_ASSERT_X(m_coreFacade.isNull(), Q_FUNC_INFO, "Cannot alter facade");
|
||||
Q_ASSERT_X(m_setupReader, Q_FUNC_INFO, "No facade without setup possible");
|
||||
Q_ASSERT_X(m_useWebData, Q_FUNC_INFO, "Need web data services");
|
||||
|
||||
this->startWebDataServices();
|
||||
Q_ASSERT_X(m_webDataServices, Q_FUNC_INFO, "Need running web data services");
|
||||
|
||||
const CStatusMessageList msgs(CStatusMessage(this).info(u"Will start core facade now"));
|
||||
m_coreFacade.reset(new CCoreFacade(m_coreFacadeConfig));
|
||||
@@ -876,7 +873,6 @@ namespace BlackCore
|
||||
{
|
||||
Q_ASSERT_X(m_parsed, Q_FUNC_INFO, "Call this function after parsing");
|
||||
|
||||
if (!m_useWebData) { return CStatusMessage(this).warning(u"No need to start web data services"); }
|
||||
if (!m_setupReader || !m_setupReader->isSetupAvailable()) { return CStatusMessage(this).error(u"No setup reader or setup available"); }
|
||||
|
||||
Q_ASSERT_X(m_setupReader, Q_FUNC_INFO, "No web data services without setup possible");
|
||||
@@ -1062,16 +1058,6 @@ namespace BlackCore
|
||||
disconnect(this);
|
||||
}
|
||||
|
||||
void CApplication::onSetupHandlingCompleted(bool available)
|
||||
{
|
||||
if (available)
|
||||
{
|
||||
// start follow ups when setup is avaialable
|
||||
const CStatusMessageList msgs = this->asyncWebAndContextStart();
|
||||
m_started = msgs.isSuccess();
|
||||
}
|
||||
}
|
||||
|
||||
void CApplication::onStartUpCompleted()
|
||||
{
|
||||
// void
|
||||
@@ -1219,17 +1205,6 @@ namespace BlackCore
|
||||
});
|
||||
}
|
||||
|
||||
CStatusMessageList CApplication::asyncWebAndContextStart()
|
||||
{
|
||||
if (m_started) { return CStatusMessage(this).info(u"Already started "); }
|
||||
|
||||
// follow up startups
|
||||
CStatusMessageList msgs = this->startWebDataServices();
|
||||
if (msgs.isFailure()) return msgs;
|
||||
msgs.push_back(this->startCoreFacadeAndWebDataServices());
|
||||
return msgs;
|
||||
}
|
||||
|
||||
void CApplication::severeStartupProblem(const CStatusMessage &message)
|
||||
{
|
||||
CLogMessage::preformatted(message);
|
||||
@@ -1617,7 +1592,6 @@ namespace BlackCore
|
||||
if (!m_setupReader) { return CStatusMessage(this).error(u"No reader for setup/version"); }
|
||||
Q_ASSERT_X(m_parsed, Q_FUNC_INFO, "Not yet parsed");
|
||||
const CStatusMessageList requestMsgs = m_setupReader->loadSetup();
|
||||
onSetupHandlingCompleted(requestMsgs.isSuccess());
|
||||
return requestMsgs;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user