Mercurial > hg > orthanc
comparison Plugins/Engine/OrthancPluginDatabase.cpp @ 3101:b2b6db5ad9a5 db-changes
warn about missing extensions
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 07 Jan 2019 17:23:04 +0100 |
parents | 9c71abbff70f |
children | 2e1711f80f74 |
comparison
equal
deleted
inserted
replaced
3100:f6de9d25b20d | 3101:b2b6db5ad9a5 |
---|---|
228 errorDictionary_(errorDictionary), | 228 errorDictionary_(errorDictionary), |
229 backend_(backend), | 229 backend_(backend), |
230 payload_(payload), | 230 payload_(payload), |
231 listener_(NULL) | 231 listener_(NULL) |
232 { | 232 { |
233 static const char* const MISSING = " Missing extension in database index plugin: "; | |
234 | |
233 ResetAnswers(); | 235 ResetAnswers(); |
234 | 236 |
235 memset(&extensions_, 0, sizeof(extensions_)); | 237 memset(&extensions_, 0, sizeof(extensions_)); |
236 | 238 |
237 size_t size = sizeof(extensions_); | 239 size_t size = sizeof(extensions_); |
240 size = extensionsSize; // Not all the extensions are available | 242 size = extensionsSize; // Not all the extensions are available |
241 } | 243 } |
242 | 244 |
243 memcpy(&extensions_, extensions, size); | 245 memcpy(&extensions_, extensions, size); |
244 | 246 |
247 bool isOptimal = true; | |
248 | |
245 if (extensions_.lookupResources == NULL) | 249 if (extensions_.lookupResources == NULL) |
246 { | 250 { |
247 LOG(WARNING) << "Performance warning in index plugin: Fast lookup is not available"; | 251 LOG(INFO) << MISSING << "LookupIdentifierRange()"; |
252 isOptimal = false; | |
253 } | |
254 | |
255 if (extensions_.createInstance == NULL) | |
256 { | |
257 LOG(INFO) << MISSING << "CreateInstance()"; | |
258 isOptimal = false; | |
259 } | |
260 | |
261 if (extensions_.setResourcesContent == NULL) | |
262 { | |
263 LOG(INFO) << MISSING << "SetResourcesContent()"; | |
264 isOptimal = false; | |
265 } | |
266 | |
267 if (extensions_.getChildrenMetadata == NULL) | |
268 { | |
269 LOG(INFO) << MISSING << "GetChildrenMetadata()"; | |
270 isOptimal = false; | |
271 } | |
272 | |
273 if (isOptimal) | |
274 { | |
275 LOG(INFO) << "The performance of the database index plugin is optimal for this version of Orthanc"; | |
276 } | |
277 else | |
278 { | |
279 LOG(WARNING) << "Performance warning in the database index: Some extensions are missing in the plugin"; | |
248 } | 280 } |
249 } | 281 } |
250 | 282 |
251 | 283 |
252 void OrthancPluginDatabase::Open() | 284 void OrthancPluginDatabase::Open() |
368 ResourceType resourceType) | 400 ResourceType resourceType) |
369 { | 401 { |
370 if (extensions_.getAllInternalIds == NULL) | 402 if (extensions_.getAllInternalIds == NULL) |
371 { | 403 { |
372 throw OrthancException(ErrorCode_DatabasePlugin, | 404 throw OrthancException(ErrorCode_DatabasePlugin, |
373 "The database plugin does not implement the GetAllInternalIds primitive"); | 405 "The database plugin does not implement the mandatory GetAllInternalIds() extension"); |
374 } | 406 } |
375 | 407 |
376 ResetAnswers(); | 408 ResetAnswers(); |
377 CheckSuccess(extensions_.getAllInternalIds(GetContext(), payload_, Plugins::Convert(resourceType))); | 409 CheckSuccess(extensions_.getAllInternalIds(GetContext(), payload_, Plugins::Convert(resourceType))); |
378 ForwardAnswers(target); | 410 ForwardAnswers(target); |
772 void OrthancPluginDatabase::ClearMainDicomTags(int64_t id) | 804 void OrthancPluginDatabase::ClearMainDicomTags(int64_t id) |
773 { | 805 { |
774 if (extensions_.clearMainDicomTags == NULL) | 806 if (extensions_.clearMainDicomTags == NULL) |
775 { | 807 { |
776 throw OrthancException(ErrorCode_DatabasePlugin, | 808 throw OrthancException(ErrorCode_DatabasePlugin, |
777 "Your custom index plugin does not implement the ClearMainDicomTags() extension"); | 809 "Your custom index plugin does not implement the mandatory ClearMainDicomTags() extension"); |
778 } | 810 } |
779 | 811 |
780 CheckSuccess(extensions_.clearMainDicomTags(payload_, id)); | 812 CheckSuccess(extensions_.clearMainDicomTags(payload_, id)); |
781 } | 813 } |
782 | 814 |
1238 const std::string& value) | 1270 const std::string& value) |
1239 { | 1271 { |
1240 if (extensions_.lookupIdentifier3 == NULL) | 1272 if (extensions_.lookupIdentifier3 == NULL) |
1241 { | 1273 { |
1242 throw OrthancException(ErrorCode_DatabasePlugin, | 1274 throw OrthancException(ErrorCode_DatabasePlugin, |
1243 "The database plugin does not implement the LookupIdentifier3 primitive"); | 1275 "The database plugin does not implement the mandatory LookupIdentifier3() extension"); |
1244 } | 1276 } |
1245 | 1277 |
1246 OrthancPluginDicomTag tmp; | 1278 OrthancPluginDicomTag tmp; |
1247 tmp.group = tag.GetGroup(); | 1279 tmp.group = tag.GetGroup(); |
1248 tmp.element = tag.GetElement(); | 1280 tmp.element = tag.GetElement(); |