changeset 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 f6de9d25b20d
children 2e1711f80f74
files Plugins/Engine/OrthancPluginDatabase.cpp Plugins/Include/orthanc/OrthancCDatabasePlugin.h
diffstat 2 files changed, 37 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/Plugins/Engine/OrthancPluginDatabase.cpp	Mon Jan 07 16:21:57 2019 +0100
+++ b/Plugins/Engine/OrthancPluginDatabase.cpp	Mon Jan 07 17:23:04 2019 +0100
@@ -230,6 +230,8 @@
     payload_(payload),
     listener_(NULL)
   {
+    static const char* const MISSING = "  Missing extension in database index plugin: ";
+    
     ResetAnswers();
 
     memset(&extensions_, 0, sizeof(extensions_));
@@ -242,9 +244,39 @@
 
     memcpy(&extensions_, extensions, size);
 
+    bool isOptimal = true;
+
     if (extensions_.lookupResources == NULL)
     {
-      LOG(WARNING) << "Performance warning in index plugin: Fast lookup is not available";
+      LOG(INFO) << MISSING << "LookupIdentifierRange()";
+      isOptimal = false;
+    }
+
+    if (extensions_.createInstance == NULL)
+    {
+      LOG(INFO) << MISSING << "CreateInstance()";
+      isOptimal = false;
+    }
+
+    if (extensions_.setResourcesContent == NULL)
+    {
+      LOG(INFO) << MISSING << "SetResourcesContent()";
+      isOptimal = false;
+    }
+
+    if (extensions_.getChildrenMetadata == NULL)
+    {
+      LOG(INFO) << MISSING << "GetChildrenMetadata()";
+      isOptimal = false;
+    }
+
+    if (isOptimal)
+    {
+      LOG(INFO) << "The performance of the database index plugin is optimal for this version of Orthanc";
+    }
+    else
+    {
+      LOG(WARNING) << "Performance warning in the database index: Some extensions are missing in the plugin";
     }
   }
 
@@ -370,7 +402,7 @@
     if (extensions_.getAllInternalIds == NULL)
     {
       throw OrthancException(ErrorCode_DatabasePlugin,
-                             "The database plugin does not implement the GetAllInternalIds primitive");
+                             "The database plugin does not implement the mandatory GetAllInternalIds() extension");
     }
 
     ResetAnswers();
@@ -774,7 +806,7 @@
     if (extensions_.clearMainDicomTags == NULL)
     {
       throw OrthancException(ErrorCode_DatabasePlugin,
-                             "Your custom index plugin does not implement the ClearMainDicomTags() extension");
+                             "Your custom index plugin does not implement the mandatory ClearMainDicomTags() extension");
     }
 
     CheckSuccess(extensions_.clearMainDicomTags(payload_, id));
@@ -1240,7 +1272,7 @@
     if (extensions_.lookupIdentifier3 == NULL)
     {
       throw OrthancException(ErrorCode_DatabasePlugin,
-                             "The database plugin does not implement the LookupIdentifier3 primitive");
+                             "The database plugin does not implement the mandatory LookupIdentifier3() extension");
     }
 
     OrthancPluginDicomTag tmp;
--- a/Plugins/Include/orthanc/OrthancCDatabasePlugin.h	Mon Jan 07 16:21:57 2019 +0100
+++ b/Plugins/Include/orthanc/OrthancCDatabasePlugin.h	Mon Jan 07 17:23:04 2019 +0100
@@ -702,7 +702,7 @@
   typedef struct
   {
     /**
-     * Extensions since Orthanc 0.9.5
+     * Base extensions since Orthanc 1.0.0
      **/
     
     /* Output: Use OrthancPluginDatabaseAnswerString() */