| 1 |
/* |
| 2 |
* Copyright (C) 2013-2015, 2019 by the Konclude Developer Team. |
| 3 |
* |
| 4 |
* This file is part of the reasoning system Konclude. |
| 5 |
* For details and support, see <http://konclude.com/>. |
| 6 |
* |
| 7 |
* Konclude is free software: you can redistribute it and/or modify |
| 8 |
* it under the terms of version 3 of the GNU Lesser General Public |
| 9 |
* License (LGPLv3) as published by the Free Software Foundation. |
| 10 |
* |
| 11 |
* Konclude is distributed in the hope that it will be useful, |
| 12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 |
* GNU (Lesser) General Public License for more details. |
| 15 |
* |
| 16 |
* You should have received a copy of the GNU (Lesser) General Public |
| 17 |
* License along with Konclude. If not, see <http://www.gnu.org/licenses/>. |
| 18 |
* |
| 19 |
*/ |
| 20 |
|
| 21 |
#ifndef KONCLUDE_TEST_EVALUATION_CREASONEREVALUATIONREQUESTCLIENTBASETHREAD_H |
| 22 |
#define KONCLUDE_TEST_EVALUATION_CREASONEREVALUATIONREQUESTCLIENTBASETHREAD_H |
| 23 |
|
| 24 |
// Libraries includes |
| 25 |
#include <QDir> |
| 26 |
|
| 27 |
// Namespace includes |
| 28 |
#include "EvaluationSettings.h" |
| 29 |
#include "CReasonerEvaluationRequestClient.h" |
| 30 |
#include "CReasonerEvaluationRequestResult.h" |
| 31 |
#include "CReasonerEvaluationExecutionCallbackContextData.h" |
| 32 |
|
| 33 |
// Other includes |
| 34 |
#include "Config/CConfiguration.h" |
| 35 |
#include "Config/CConfigDataReader.h" |
| 36 |
|
| 37 |
#include "Test/Evaluation/Events/CReasonerEvaluationStartEvent.h" |
| 38 |
#include "Test/Evaluation/Events/CReasonerEvaluationNextEvent.h" |
| 39 |
|
| 40 |
#include "Concurrent/CIntervalThread.h" |
| 41 |
|
| 42 |
#include "Network/HTTP/CQtHttpTransactionManager.h" |
| 43 |
|
| 44 |
// Logger includes |
| 45 |
#include "Logger/CLogger.h" |
| 46 |
#include "Logger/CLogIdentifier.h" |
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
namespace Konclude { |
| 51 |
|
| 52 |
using namespace Config; |
| 53 |
using namespace Concurrent; |
| 54 |
using namespace Network::HTTP; |
| 55 |
|
| 56 |
namespace Test { |
| 57 |
|
| 58 |
namespace Evaluation { |
| 59 |
|
| 60 |
using namespace Events; |
| 61 |
|
| 62 |
|
| 63 |
/*! |
| 64 |
* |
| 65 |
* \class CReasonerEvaluationRequestClientThread |
| 66 |
* \author Andreas Steigmiller |
| 67 |
* \version 0.1 |
| 68 |
* \brief TODO |
| 69 |
* |
| 70 |
*/ |
| 71 |
class CReasonerEvaluationRequestClientBaseThread : public CIntervalThread, public CReasonerEvaluationRequestClient, public CLogIdentifier { |
| 72 |
// public methods |
| 73 |
public: |
| 74 |
//! Constructor |
| 75 |
CReasonerEvaluationRequestClientBaseThread(const QString& threadName, const QString& logIdentifier); |
| 76 |
|
| 77 |
//! Destructor |
| 78 |
virtual ~CReasonerEvaluationRequestClientBaseThread(); |
| 79 |
|
| 80 |
|
| 81 |
bool evaluateReasoner(const QString& initFileString, const QString& testFileString, CReasonerEvaluationProvider* reasonerProvider, CConfiguration* configuration, CCallbackData* callback); |
| 82 |
CReasonerEvaluationRequestResult* getReasonerEvaluationResult(); |
| 83 |
virtual bool canHandleRequestFile(const QString& testFileString) = 0; |
| 84 |
|
| 85 |
// protected methods |
| 86 |
protected: |
| 87 |
virtual bool processTimer(qint64 timerID); |
| 88 |
|
| 89 |
virtual bool processCustomsEvents(QEvent::Type type, CCustomEvent *event); |
| 90 |
|
| 91 |
virtual void threadStarted(); |
| 92 |
virtual void threadStopped(); |
| 93 |
|
| 94 |
|
| 95 |
virtual bool hasNextRequest(); |
| 96 |
|
| 97 |
virtual bool closeNextRequest(); |
| 98 |
virtual bool closeAllRequestTimeout(); |
| 99 |
|
| 100 |
virtual bool finishReasonerRequests(); |
| 101 |
|
| 102 |
virtual bool loadReasonerRequests(const QString& initFileString, const QString& testFileString) = 0; |
| 103 |
virtual bool loadReasonerRequest(const QString& requestFileString) = 0; |
| 104 |
|
| 105 |
virtual bool sendNextRequest() = 0; |
| 106 |
virtual bool parseResponse(QIODevice* device) = 0; |
| 107 |
|
| 108 |
virtual CReasonerEvaluationRequestClientBaseThread* readConfig(CConfiguration* config); |
| 109 |
|
| 110 |
|
| 111 |
// protected variables |
| 112 |
protected: |
| 113 |
CQtHttpTransactionManager* mTransManager; |
| 114 |
CConfiguration* mConfig; |
| 115 |
|
| 116 |
CReasonerEvaluationRequestResult* mResponse; |
| 117 |
|
| 118 |
QString mInitFileString; |
| 119 |
QString mTestFileString; |
| 120 |
QString mAddressString; |
| 121 |
CReasonerEvaluationProvider* mReasonerProvider; |
| 122 |
CCallbackData* mRequestFinishedCallback; |
| 123 |
|
| 124 |
cint64 mRequestTimeout; |
| 125 |
cint64 mTotalTimeout; |
| 126 |
|
| 127 |
QList<CReasonerEvaluationRequestResponse*> mRemainingRequestList; |
| 128 |
|
| 129 |
cint64 mNumberInitRequests; |
| 130 |
CReasonerEvaluationRequestResponse* mNextReqRes; |
| 131 |
CHttpResponse* mWebResponse; |
| 132 |
CHttpRequest* mWebRequest; |
| 133 |
cint64 mCurrentRequestCount; |
| 134 |
cint64 mTotalRequestCount; |
| 135 |
QTime mNextRequestTiming; |
| 136 |
QTime mTotalTiming; |
| 137 |
QTime mTestingTiming; |
| 138 |
cint64 mCurrentOperationNumber; |
| 139 |
cint64 mDownloadSizeLimit; |
| 140 |
bool mDownloadSizeLimitCancel; |
| 141 |
|
| 142 |
bool mModifyRequestAbsolutePaths; |
| 143 |
bool mReplaceLoadOntologiesWithTells; |
| 144 |
bool mResolveAppreviatedIRIsForReplacedTells; |
| 145 |
|
| 146 |
bool mConfQueryTimeoutRestartRepeatPreparation; |
| 147 |
|
| 148 |
|
| 149 |
const static cint64 TIMERIDREQUESTTIMEOUT = 1; |
| 150 |
const static cint64 TIMERIDTOTALTIMEOUT = 2; |
| 151 |
|
| 152 |
// private methods |
| 153 |
private: |
| 154 |
|
| 155 |
// private variables |
| 156 |
private: |
| 157 |
|
| 158 |
}; |
| 159 |
|
| 160 |
}; // end namespace Evaluation |
| 161 |
|
| 162 |
}; // end namespace Test |
| 163 |
|
| 164 |
}; // end namespace Konclude |
| 165 |
|
| 166 |
#endif // KONCLUDE_TEST_EVALUATION_CREASONEREVALUATIONREQUESTCLIENTBASETHREAD_H |