Mercurial > hg > orthanc-object-storage
comparison Common/StoragePlugin.cpp @ 151:00cd1f01dd5d
fix initialization and finalization
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 21 Jun 2024 10:29:52 +0200 |
parents | 3c7e0374f28e |
children | d62f52be1943 |
comparison
equal
deleted
inserted
replaced
150:938aee2b5f69 | 151:00cd1f01dd5d |
---|---|
528 { | 528 { |
529 ORTHANC_PLUGINS_API int32_t OrthancPluginInitialize(OrthancPluginContext* context) | 529 ORTHANC_PLUGINS_API int32_t OrthancPluginInitialize(OrthancPluginContext* context) |
530 { | 530 { |
531 OrthancPlugins::SetGlobalContext(context); | 531 OrthancPlugins::SetGlobalContext(context); |
532 | 532 |
533 Orthanc::InitializeFramework("", false); | 533 #if ORTHANC_FRAMEWORK_VERSION_IS_ABOVE(1, 12, 4) |
534 Orthanc::Logging::InitializePluginContext(context, StoragePluginFactory::GetStoragePluginName()); | |
535 #elif ORTHANC_FRAMEWORK_VERSION_IS_ABOVE(1, 7, 2) | |
534 Orthanc::Logging::InitializePluginContext(context); | 536 Orthanc::Logging::InitializePluginContext(context); |
535 | 537 #else |
536 OrthancPlugins::OrthancConfiguration orthancConfig; | 538 Orthanc::Logging::Initialize(context); |
537 | 539 #endif |
538 OrthancPlugins::LogWarning(std::string(StoragePluginFactory::GetStoragePluginName()) + " plugin is initializing"); | |
539 OrthancPlugins::SetDescription(StoragePluginFactory::GetStoragePluginName(), StoragePluginFactory::GetStorageDescription()); | |
540 | 540 |
541 /* Check the version of the Orthanc core */ | 541 /* Check the version of the Orthanc core */ |
542 if (OrthancPluginCheckVersion(context) == 0) | 542 if (OrthancPluginCheckVersion(context) == 0) |
543 { | 543 { |
544 char info[1024]; | 544 char info[1024]; |
548 ORTHANC_PLUGINS_MINIMAL_MINOR_NUMBER, | 548 ORTHANC_PLUGINS_MINIMAL_MINOR_NUMBER, |
549 ORTHANC_PLUGINS_MINIMAL_REVISION_NUMBER); | 549 ORTHANC_PLUGINS_MINIMAL_REVISION_NUMBER); |
550 OrthancPlugins::LogError(info); | 550 OrthancPlugins::LogError(info); |
551 return -1; | 551 return -1; |
552 } | 552 } |
553 | |
554 Orthanc::InitializeFramework("", false); | |
555 | |
556 OrthancPlugins::OrthancConfiguration orthancConfig; | |
557 | |
558 OrthancPlugins::LogWarning(std::string(StoragePluginFactory::GetStoragePluginName()) + " plugin is initializing"); | |
559 OrthancPlugins::SetDescription(StoragePluginFactory::GetStoragePluginName(), StoragePluginFactory::GetStorageDescription()); | |
553 | 560 |
554 try | 561 try |
555 { | 562 { |
556 const char* pluginSectionName = StoragePluginFactory::GetConfigurationSectionName(); | 563 const char* pluginSectionName = StoragePluginFactory::GetConfigurationSectionName(); |
557 static const char* const ENCRYPTION_SECTION = "StorageEncryption"; | 564 static const char* const ENCRYPTION_SECTION = "StorageEncryption"; |