comparison OrthancServer/Plugins/Engine/OrthancPlugins.cpp @ 4607:f75c63aa9de0 db-changes

differentiating between shared and private global properties
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 30 Mar 2021 18:10:27 +0200
parents d01702fb29a9
children 2684544ff03c
comparison
equal deleted inserted replaced
4606:d01702fb29a9 4607:f75c63aa9de0
4210 { 4210 {
4211 return false; 4211 return false;
4212 } 4212 }
4213 else 4213 else
4214 { 4214 {
4215 // TODO - Plugins can only access global properties of their
4216 // own Orthanc server (no access to the shared global properties)
4215 PImpl::ServerContextLock lock(*pimpl_); 4217 PImpl::ServerContextLock lock(*pimpl_);
4216 lock.GetContext().GetIndex().SetGlobalProperty(static_cast<GlobalProperty>(p.property), p.value); 4218 lock.GetContext().GetIndex().SetGlobalProperty(static_cast<GlobalProperty>(p.property),
4219 false /* not shared */, p.value);
4217 return true; 4220 return true;
4218 } 4221 }
4219 } 4222 }
4220 4223
4221 case _OrthancPluginService_GetGlobalProperty: 4224 case _OrthancPluginService_GetGlobalProperty:
4224 *reinterpret_cast<const _OrthancPluginGlobalProperty*>(parameters); 4227 *reinterpret_cast<const _OrthancPluginGlobalProperty*>(parameters);
4225 4228
4226 std::string result; 4229 std::string result;
4227 4230
4228 { 4231 {
4232 // TODO - Plugins can only access global properties of their
4233 // own Orthanc server (no access to the shared global properties)
4229 PImpl::ServerContextLock lock(*pimpl_); 4234 PImpl::ServerContextLock lock(*pimpl_);
4230 result = lock.GetContext().GetIndex().GetGlobalProperty(static_cast<GlobalProperty>(p.property), p.value); 4235 result = lock.GetContext().GetIndex().GetGlobalProperty(static_cast<GlobalProperty>(p.property),
4236 false /* not shared */, p.value);
4231 } 4237 }
4232 4238
4233 *(p.result) = CopyString(result); 4239 *(p.result) = CopyString(result);
4234 return true; 4240 return true;
4235 } 4241 }
5022 } 5028 }
5023 } 5029 }
5024 5030
5025 case _OrthancPluginService_RegisterDatabaseBackend: 5031 case _OrthancPluginService_RegisterDatabaseBackend:
5026 { 5032 {
5027 // TODO - WARN ABOUT PERFORMANCE 5033 LOG(WARNING) << "Performance warning: Plugin has registered a custom database back-end with an old API";
5028
5029 CLOG(INFO, PLUGINS) << "Plugin has registered a custom database back-end";
5030 5034
5031 const _OrthancPluginRegisterDatabaseBackend& p = 5035 const _OrthancPluginRegisterDatabaseBackend& p =
5032 *reinterpret_cast<const _OrthancPluginRegisterDatabaseBackend*>(parameters); 5036 *reinterpret_cast<const _OrthancPluginRegisterDatabaseBackend*>(parameters);
5033 5037
5034 if (pimpl_->database_.get() == NULL && 5038 if (pimpl_->database_.get() == NULL &&
5047 return true; 5051 return true;
5048 } 5052 }
5049 5053
5050 case _OrthancPluginService_RegisterDatabaseBackendV2: 5054 case _OrthancPluginService_RegisterDatabaseBackendV2:
5051 { 5055 {
5052 // TODO - WARN ABOUT PERFORMANCE 5056 LOG(WARNING) << "Performance warning: Plugin has registered a custom database back-end with an old API";
5053
5054 CLOG(INFO, PLUGINS) << "Plugin has registered a custom database back-end";
5055 5057
5056 const _OrthancPluginRegisterDatabaseBackendV2& p = 5058 const _OrthancPluginRegisterDatabaseBackendV2& p =
5057 *reinterpret_cast<const _OrthancPluginRegisterDatabaseBackendV2*>(parameters); 5059 *reinterpret_cast<const _OrthancPluginRegisterDatabaseBackendV2*>(parameters);
5058 5060
5059 if (pimpl_->database_.get() == NULL && 5061 if (pimpl_->database_.get() == NULL &&