annotate OrthancServer/Plugins/Samples/MultitenantDicom/MultitenantDicomServer.cpp @ 5273:7cb1b851f5c8

Added a sample plugin bringing multitenant DICOM support through labels
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 14 Apr 2023 11:49:24 +0200
parents
children a8385880902f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5273
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Orthanc - A Lightweight, RESTful DICOM Store
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 * Department, University Hospital of Liege, Belgium
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5 * Copyright (C) 2017-2023 Osimis S.A., Belgium
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 * Copyright (C) 2021-2023 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 *
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * This program is free software: you can redistribute it and/or
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * modify it under the terms of the GNU Lesser General Public License
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 * as published by the Free Software Foundation, either version 3 of
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 * the License, or (at your option) any later version.
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 *
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * This program is distributed in the hope that it will be useful, but
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 * Lesser General Public License for more details.
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 *
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 * You should have received a copy of the GNU Lesser General Public
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 * License along with this program. If not, see
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20 * <http://www.gnu.org/licenses/>.
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21 **/
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 #include "MultitenantDicomServer.h"
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 #include "FindRequestHandler.h"
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 #include "MoveRequestHandler.h"
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 #include "PluginToolbox.h"
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 #include "StoreRequestHandler.h"
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 #include "../../../../OrthancFramework/Sources/Logging.h"
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32 #include "../../../../OrthancFramework/Sources/SerializationToolbox.h"
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34 #include "../Common/OrthancPluginCppWrapper.h"
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 bool MultitenantDicomServer::IsSameAETitle(const std::string& aet1,
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38 const std::string& aet2)
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39 {
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 boost::mutex::scoped_lock lock(mutex_);
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 return PluginToolbox::IsSameAETitle(isStrictAet_, aet1, aet2);
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 }
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45 bool MultitenantDicomServer::LookupAETitle(Orthanc::RemoteModalityParameters& parameters,
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46 const std::string& aet)
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 {
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 boost::mutex::scoped_lock lock(mutex_);
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50 std::string name;
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51 return PluginToolbox::LookupAETitle(name, parameters, isStrictAet_, server_->GetApplicationEntityTitle());
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52 }
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55 Orthanc::IFindRequestHandler* MultitenantDicomServer::ConstructFindRequestHandler()
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
56 {
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
57 boost::mutex::scoped_lock lock(mutex_);
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58 return new FindRequestHandler(server_->GetApplicationEntityTitle(), labels_, labelsConstraint_);
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59 }
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62 Orthanc::IMoveRequestHandler* MultitenantDicomServer::ConstructMoveRequestHandler()
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63 {
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64 boost::mutex::scoped_lock lock(mutex_);
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65 return new MoveRequestHandler(labels_, labelsConstraint_, isStrictAet_, isSynchronousCMove_);
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66 }
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
67
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69 Orthanc::IStoreRequestHandler* MultitenantDicomServer::ConstructStoreRequestHandler()
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70 {
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
71 boost::mutex::scoped_lock lock(mutex_);
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72 return new StoreRequestHandler(labels_, labelsStoreLevels_);
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
73 }
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
74
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
75
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
76 MultitenantDicomServer::MultitenantDicomServer(const Json::Value& serverConfig)
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
77 {
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
78 PluginToolbox::ParseLabels(labels_, labelsConstraint_, serverConfig);
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
79
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
80 if (serverConfig.isMember(KEY_LABELS_STORE_LEVELS))
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
81 {
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
82 std::set<std::string> levels;
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
83 Orthanc::SerializationToolbox::ReadSetOfStrings(levels, serverConfig, KEY_LABELS_STORE_LEVELS);
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
84 for (std::set<std::string>::const_iterator it = levels.begin(); it != levels.end(); ++it)
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
85 {
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
86 labelsStoreLevels_.insert(Orthanc::StringToResourceType(it->c_str()));
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
87 }
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
88 }
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
89 else
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
90 {
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
91 labelsStoreLevels_.insert(Orthanc::ResourceType_Study);
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
92 labelsStoreLevels_.insert(Orthanc::ResourceType_Series);
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
93 labelsStoreLevels_.insert(Orthanc::ResourceType_Instance);
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
94 }
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
95
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
96 server_.reset(new Orthanc::DicomServer);
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
97
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
98 {
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
99 OrthancPlugins::OrthancConfiguration globalConfig;
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
100 isSynchronousCMove_ = globalConfig.GetBooleanValue(KEY_SYNCHRONOUS_C_MOVE, true);
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
101 isStrictAet_ = globalConfig.GetBooleanValue(KEY_STRICT_AET_COMPARISON, false);
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
102
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
103 server_->SetCalledApplicationEntityTitleCheck(globalConfig.GetBooleanValue("DicomCheckCalledAet", false));
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
104 server_->SetAssociationTimeout(globalConfig.GetUnsignedIntegerValue("DicomScpTimeout", 30));
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
105 server_->SetThreadsCount(globalConfig.GetUnsignedIntegerValue("DicomThreadsCount", 1));
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
106 server_->SetMaximumPduLength(globalConfig.GetUnsignedIntegerValue("MaximumPduLength", 16384));
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
107 }
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
108
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
109 server_->SetRemoteModalities(*this);
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
110 server_->SetApplicationEntityFilter(filter_);
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
111 server_->SetPortNumber(Orthanc::SerializationToolbox::ReadUnsignedInteger(serverConfig, "Port"));
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
112 server_->SetApplicationEntityTitle(Orthanc::SerializationToolbox::ReadString(serverConfig, KEY_AET));
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
113 server_->SetFindRequestHandlerFactory(*this);
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
114 server_->SetMoveRequestHandlerFactory(*this);
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
115 server_->SetStoreRequestHandlerFactory(*this);
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
116 }
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
117
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
118
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
119 void MultitenantDicomServer::Start()
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
120 {
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
121 boost::mutex::scoped_lock lock(mutex_);
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
122
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
123 if (server_->GetPortNumber() < 1024)
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
124 {
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
125 LOG(WARNING) << "The DICOM port is privileged ("
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
126 << server_->GetPortNumber() << " is below 1024), "
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
127 << "make sure you run Orthanc as root/administrator";
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
128 }
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
129
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
130 server_->Start();
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
131 LOG(WARNING) << "Started multitenant DICOM server listening with AET " << server_->GetApplicationEntityTitle()
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
132 << " on port: " << server_->GetPortNumber();
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
133 }
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
134
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
135
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
136 void MultitenantDicomServer::Stop()
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
137 {
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
138 boost::mutex::scoped_lock lock(mutex_);
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
139
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
140 if (server_.get() != NULL)
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
141 {
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
142 LOG(WARNING) << "Stopping multitenant DICOM server listening with AET " << server_->GetApplicationEntityTitle()
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
143 << " on port: " << server_->GetPortNumber();
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
144 server_->Stop();
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
145 }
7cb1b851f5c8 Added a sample plugin bringing multitenant DICOM support through labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
146 }