Mercurial > hg > orthanc
annotate OrthancServer/ServerContext.h @ 2886:c799d057aa0d Barnerd/fix-build-with-libressl-libressl-comp-1488028354841
closing branch
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 12 Oct 2018 15:20:02 +0200 |
parents | a3a65de1840f |
children | 563bf878407a |
rev | line source |
---|---|
224 | 1 /** |
2 * Orthanc - A Lightweight, RESTful DICOM Store | |
1900 | 3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
1288
6e7e5ed91c2d
upgrade to year 2015
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1285
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
2244
a3a65de1840f
shared copyright with osimis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2136
diff
changeset
|
5 * Copyright (C) 2017 Osimis, Belgium |
224 | 6 * |
7 * This program is free software: you can redistribute it and/or | |
8 * modify it under the terms of the GNU General Public License as | |
9 * published by the Free Software Foundation, either version 3 of the | |
10 * License, or (at your option) any later version. | |
11 * | |
12 * In addition, as a special exception, the copyright holders of this | |
13 * program give permission to link the code of its release with the | |
14 * OpenSSL project's "OpenSSL" library (or with modified versions of it | |
15 * that use the same license as the "OpenSSL" library), and distribute | |
16 * the linked executables. You must obey the GNU General Public License | |
17 * in all respects for all of the code used other than "OpenSSL". If you | |
18 * modify file(s) with this exception, you may extend this exception to | |
19 * your version of the file(s), but you are not obligated to do so. If | |
20 * you do not wish to do so, delete this exception statement from your | |
21 * version. If you delete this exception statement from all source files | |
22 * in the program, then also delete it here. | |
23 * | |
24 * This program is distributed in the hope that it will be useful, but | |
25 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
27 * General Public License for more details. | |
28 * | |
29 * You should have received a copy of the GNU General Public License | |
30 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
31 **/ | |
32 | |
33 | |
34 #pragma once | |
35 | |
1436
0a3e3be59094
uncoupling of SignalChange for Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1434
diff
changeset
|
36 #include "../Core/MultiThreading/SharedMessageQueue.h" |
285
4031f73fe0e4
access to the raw dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
236
diff
changeset
|
37 #include "../Core/Cache/MemoryCache.h" |
1433
461e7554bff7
refactoring: LuaScripting
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
38 #include "../Core/Cache/SharedArchive.h" |
1124
790ff7a5b3bf
IStorageArea abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1123
diff
changeset
|
39 #include "../Core/FileStorage/IStorageArea.h" |
1433
461e7554bff7
refactoring: LuaScripting
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
40 #include "../Core/Lua/LuaContext.h" |
226
8a26a8e85edf
refactoring to read files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
224
diff
changeset
|
41 #include "../Core/RestApi/RestApiOutput.h" |
1433
461e7554bff7
refactoring: LuaScripting
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
42 #include "../Plugins/Engine/OrthancPlugins.h" |
461e7554bff7
refactoring: LuaScripting
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
43 #include "DicomInstanceToStore.h" |
771 | 44 #include "DicomProtocol/ReusableDicomUserConnection.h" |
1433
461e7554bff7
refactoring: LuaScripting
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
45 #include "IServerListener.h" |
461e7554bff7
refactoring: LuaScripting
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
46 #include "LuaScripting.h" |
461e7554bff7
refactoring: LuaScripting
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
47 #include "ParsedDicomFile.h" |
783
c9cdd53a6b31
main scheduler added to the server context
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
771
diff
changeset
|
48 #include "Scheduler/ServerScheduler.h" |
1433
461e7554bff7
refactoring: LuaScripting
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
49 #include "ServerIndex.h" |
1444
b2b09a3dbd8e
refactoring: OrthancHttpHandler inside OrthancServer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1436
diff
changeset
|
50 #include "OrthancHttpHandler.h" |
224 | 51 |
1124
790ff7a5b3bf
IStorageArea abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1123
diff
changeset
|
52 #include <boost/filesystem.hpp> |
1436
0a3e3be59094
uncoupling of SignalChange for Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1434
diff
changeset
|
53 #include <boost/thread.hpp> |
0a3e3be59094
uncoupling of SignalChange for Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1434
diff
changeset
|
54 |
1124
790ff7a5b3bf
IStorageArea abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1123
diff
changeset
|
55 |
224 | 56 namespace Orthanc |
57 { | |
227
209ca3f6db62
dicom-scu from rest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
58 /** |
209ca3f6db62
dicom-scu from rest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
59 * This class is responsible for maintaining the storage area on the |
209ca3f6db62
dicom-scu from rest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
60 * filesystem (including compression), as well as the index of the |
209ca3f6db62
dicom-scu from rest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
61 * DICOM store. It implements the required locking mechanisms. |
209ca3f6db62
dicom-scu from rest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
62 **/ |
224 | 63 class ServerContext |
64 { | |
65 private: | |
285
4031f73fe0e4
access to the raw dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
236
diff
changeset
|
66 class DicomCacheProvider : public ICachePageProvider |
4031f73fe0e4
access to the raw dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
236
diff
changeset
|
67 { |
4031f73fe0e4
access to the raw dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
236
diff
changeset
|
68 private: |
4031f73fe0e4
access to the raw dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
236
diff
changeset
|
69 ServerContext& context_; |
4031f73fe0e4
access to the raw dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
236
diff
changeset
|
70 |
4031f73fe0e4
access to the raw dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
236
diff
changeset
|
71 public: |
4031f73fe0e4
access to the raw dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
236
diff
changeset
|
72 DicomCacheProvider(ServerContext& context) : context_(context) |
4031f73fe0e4
access to the raw dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
236
diff
changeset
|
73 { |
4031f73fe0e4
access to the raw dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
236
diff
changeset
|
74 } |
4031f73fe0e4
access to the raw dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
236
diff
changeset
|
75 |
4031f73fe0e4
access to the raw dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
236
diff
changeset
|
76 virtual IDynamicObject* Provide(const std::string& id); |
4031f73fe0e4
access to the raw dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
236
diff
changeset
|
77 }; |
4031f73fe0e4
access to the raw dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
236
diff
changeset
|
78 |
1433
461e7554bff7
refactoring: LuaScripting
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
79 class ServerListener |
461e7554bff7
refactoring: LuaScripting
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
80 { |
461e7554bff7
refactoring: LuaScripting
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
81 private: |
461e7554bff7
refactoring: LuaScripting
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
82 IServerListener *listener_; |
461e7554bff7
refactoring: LuaScripting
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
83 std::string description_; |
461e7554bff7
refactoring: LuaScripting
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
84 |
461e7554bff7
refactoring: LuaScripting
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
85 public: |
461e7554bff7
refactoring: LuaScripting
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
86 ServerListener(IServerListener& listener, |
461e7554bff7
refactoring: LuaScripting
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
87 const std::string& description) : |
461e7554bff7
refactoring: LuaScripting
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
88 listener_(&listener), |
461e7554bff7
refactoring: LuaScripting
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
89 description_(description) |
461e7554bff7
refactoring: LuaScripting
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
90 { |
461e7554bff7
refactoring: LuaScripting
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
91 } |
996
cf52f3bcb2b3
clarification of Lua classes wrt multithreading
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
946
diff
changeset
|
92 |
1433
461e7554bff7
refactoring: LuaScripting
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
93 IServerListener& GetListener() |
461e7554bff7
refactoring: LuaScripting
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
94 { |
461e7554bff7
refactoring: LuaScripting
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
95 return *listener_; |
461e7554bff7
refactoring: LuaScripting
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
96 } |
461e7554bff7
refactoring: LuaScripting
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
97 |
461e7554bff7
refactoring: LuaScripting
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
98 const std::string& GetDescription() |
461e7554bff7
refactoring: LuaScripting
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
99 { |
461e7554bff7
refactoring: LuaScripting
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
100 return description_; |
461e7554bff7
refactoring: LuaScripting
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
101 } |
461e7554bff7
refactoring: LuaScripting
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
102 }; |
461e7554bff7
refactoring: LuaScripting
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
103 |
461e7554bff7
refactoring: LuaScripting
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
104 typedef std::list<ServerListener> ServerListeners; |
461e7554bff7
refactoring: LuaScripting
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
105 |
998
4136fab6a639
callback on stored instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
996
diff
changeset
|
106 |
1436
0a3e3be59094
uncoupling of SignalChange for Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1434
diff
changeset
|
107 static void ChangeThread(ServerContext* that); |
0a3e3be59094
uncoupling of SignalChange for Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1434
diff
changeset
|
108 |
0a3e3be59094
uncoupling of SignalChange for Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1434
diff
changeset
|
109 |
224 | 110 ServerIndex index_; |
1549
e5e975e9b738
refactoring and simplification of StorageAccessor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1456
diff
changeset
|
111 IStorageArea& area_; |
e5e975e9b738
refactoring and simplification of StorageAccessor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1456
diff
changeset
|
112 |
236 | 113 bool compressionEnabled_; |
1549
e5e975e9b738
refactoring and simplification of StorageAccessor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1456
diff
changeset
|
114 bool storeMD5_; |
285
4031f73fe0e4
access to the raw dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
236
diff
changeset
|
115 |
4031f73fe0e4
access to the raw dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
236
diff
changeset
|
116 DicomCacheProvider provider_; |
778
aebf0071020e
refactoring of the mutex for the dicom cache
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
771
diff
changeset
|
117 boost::mutex dicomCacheMutex_; |
285
4031f73fe0e4
access to the raw dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
236
diff
changeset
|
118 MemoryCache dicomCache_; |
771 | 119 ReusableDicomUserConnection scu_; |
783
c9cdd53a6b31
main scheduler added to the server context
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
771
diff
changeset
|
120 ServerScheduler scheduler_; |
224 | 121 |
1433
461e7554bff7
refactoring: LuaScripting
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
122 LuaScripting lua_; |
1632
eb8fbcf008b5
fix build with plugins disabled
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1549
diff
changeset
|
123 |
2136
dd609a99d39a
uniformization of the macro naming
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2128
diff
changeset
|
124 #if ORTHANC_ENABLE_PLUGINS == 1 |
1433
461e7554bff7
refactoring: LuaScripting
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
125 OrthancPlugins* plugins_; |
1632
eb8fbcf008b5
fix build with plugins disabled
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1549
diff
changeset
|
126 #endif |
eb8fbcf008b5
fix build with plugins disabled
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1549
diff
changeset
|
127 |
1433
461e7554bff7
refactoring: LuaScripting
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
128 ServerListeners listeners_; |
1456
68827c07e683
fix recursive calls with Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1453
diff
changeset
|
129 boost::recursive_mutex listenersMutex_; |
388
466c992a9a42
testing filters inside orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
376
diff
changeset
|
130 |
1436
0a3e3be59094
uncoupling of SignalChange for Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1434
diff
changeset
|
131 bool done_; |
0a3e3be59094
uncoupling of SignalChange for Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1434
diff
changeset
|
132 SharedMessageQueue pendingChanges_; |
0a3e3be59094
uncoupling of SignalChange for Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1434
diff
changeset
|
133 boost::thread changeThread_; |
0a3e3be59094
uncoupling of SignalChange for Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1434
diff
changeset
|
134 |
1368 | 135 SharedArchive queryRetrieveArchive_; |
1427
d710ea64f0fd
Custom setting of the local AET during C-Store SCU (both in Lua and in the REST API)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
136 std::string defaultLocalAet_; |
1444
b2b09a3dbd8e
refactoring: OrthancHttpHandler inside OrthancServer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1436
diff
changeset
|
137 OrthancHttpHandler httpHandler_; |
1368 | 138 |
224 | 139 public: |
996
cf52f3bcb2b3
clarification of Lua classes wrt multithreading
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
946
diff
changeset
|
140 class DicomCacheLocker : public boost::noncopyable |
778
aebf0071020e
refactoring of the mutex for the dicom cache
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
771
diff
changeset
|
141 { |
aebf0071020e
refactoring of the mutex for the dicom cache
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
771
diff
changeset
|
142 private: |
aebf0071020e
refactoring of the mutex for the dicom cache
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
771
diff
changeset
|
143 ServerContext& that_; |
aebf0071020e
refactoring of the mutex for the dicom cache
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
771
diff
changeset
|
144 ParsedDicomFile *dicom_; |
1129
8dabdc0d3007
fix possible deadlock
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1126
diff
changeset
|
145 boost::mutex::scoped_lock lock_; |
778
aebf0071020e
refactoring of the mutex for the dicom cache
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
771
diff
changeset
|
146 |
aebf0071020e
refactoring of the mutex for the dicom cache
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
771
diff
changeset
|
147 public: |
aebf0071020e
refactoring of the mutex for the dicom cache
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
771
diff
changeset
|
148 DicomCacheLocker(ServerContext& that, |
aebf0071020e
refactoring of the mutex for the dicom cache
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
771
diff
changeset
|
149 const std::string& instancePublicId); |
aebf0071020e
refactoring of the mutex for the dicom cache
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
771
diff
changeset
|
150 |
aebf0071020e
refactoring of the mutex for the dicom cache
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
771
diff
changeset
|
151 ~DicomCacheLocker(); |
aebf0071020e
refactoring of the mutex for the dicom cache
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
771
diff
changeset
|
152 |
aebf0071020e
refactoring of the mutex for the dicom cache
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
771
diff
changeset
|
153 ParsedDicomFile& GetDicom() |
aebf0071020e
refactoring of the mutex for the dicom cache
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
771
diff
changeset
|
154 { |
aebf0071020e
refactoring of the mutex for the dicom cache
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
771
diff
changeset
|
155 return *dicom_; |
aebf0071020e
refactoring of the mutex for the dicom cache
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
771
diff
changeset
|
156 } |
aebf0071020e
refactoring of the mutex for the dicom cache
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
771
diff
changeset
|
157 }; |
aebf0071020e
refactoring of the mutex for the dicom cache
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
771
diff
changeset
|
158 |
1549
e5e975e9b738
refactoring and simplification of StorageAccessor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1456
diff
changeset
|
159 ServerContext(IDatabaseWrapper& database, |
e5e975e9b738
refactoring and simplification of StorageAccessor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1456
diff
changeset
|
160 IStorageArea& area); |
1134
ba9fd42284d0
preparing storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1133
diff
changeset
|
161 |
1436
0a3e3be59094
uncoupling of SignalChange for Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1434
diff
changeset
|
162 ~ServerContext(); |
0a3e3be59094
uncoupling of SignalChange for Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1434
diff
changeset
|
163 |
224 | 164 ServerIndex& GetIndex() |
165 { | |
166 return index_; | |
167 } | |
168 | |
236 | 169 void SetCompressionEnabled(bool enabled); |
170 | |
171 bool IsCompressionEnabled() const | |
172 { | |
173 return compressionEnabled_; | |
174 } | |
175 | |
1126
bf67431a7383
handling of file content type in IStorageArea
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1124
diff
changeset
|
176 void RemoveFile(const std::string& fileUuid, |
bf67431a7383
handling of file content type in IStorageArea
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1124
diff
changeset
|
177 FileContentType type); |
226
8a26a8e85edf
refactoring to read files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
224
diff
changeset
|
178 |
699
2929e17f8447
add attachments to resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
697
diff
changeset
|
179 bool AddAttachment(const std::string& resourceId, |
2929e17f8447
add attachments to resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
697
diff
changeset
|
180 FileContentType attachmentType, |
2929e17f8447
add attachments to resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
697
diff
changeset
|
181 const void* data, |
2929e17f8447
add attachments to resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
697
diff
changeset
|
182 size_t size); |
2929e17f8447
add attachments to resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
697
diff
changeset
|
183 |
1004
a226e0959d8b
DicomInstanceToStore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1003
diff
changeset
|
184 StoreStatus Store(std::string& resultPublicId, |
a226e0959d8b
DicomInstanceToStore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1003
diff
changeset
|
185 DicomInstanceToStore& dicom); |
a226e0959d8b
DicomInstanceToStore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1003
diff
changeset
|
186 |
1146
200fcac0deb4
optimization for access to attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1145
diff
changeset
|
187 void AnswerAttachment(RestApiOutput& output, |
1700
f5ddbd9239dd
New URIs for attachments: ".../compress", ".../uncompress" and ".../is-compressed"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1632
diff
changeset
|
188 const std::string& resourceId, |
1146
200fcac0deb4
optimization for access to attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1145
diff
changeset
|
189 FileContentType content); |
226
8a26a8e85edf
refactoring to read files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
224
diff
changeset
|
190 |
1700
f5ddbd9239dd
New URIs for attachments: ".../compress", ".../uncompress" and ".../is-compressed"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1632
diff
changeset
|
191 void ChangeAttachmentCompression(const std::string& resourceId, |
f5ddbd9239dd
New URIs for attachments: ".../compress", ".../uncompress" and ".../is-compressed"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1632
diff
changeset
|
192 FileContentType attachmentType, |
f5ddbd9239dd
New URIs for attachments: ".../compress", ".../uncompress" and ".../is-compressed"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1632
diff
changeset
|
193 CompressionType compression); |
f5ddbd9239dd
New URIs for attachments: ".../compress", ".../uncompress" and ".../is-compressed"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1632
diff
changeset
|
194 |
2127 | 195 void ReadDicomAsJson(std::string& result, |
196 const std::string& instancePublicId); | |
197 | |
2124 | 198 void ReadDicomAsJson(Json::Value& result, |
199 const std::string& instancePublicId); | |
227
209ca3f6db62
dicom-scu from rest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
200 |
2124 | 201 void ReadDicom(std::string& dicom, |
202 const std::string& instancePublicId) | |
203 { | |
2128
9329ba17a069
Possibility to DELETE "dicom-as-json" attachments to reconstruct them
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2127
diff
changeset
|
204 ReadAttachment(dicom, instancePublicId, FileContentType_Dicom, true); |
2124 | 205 } |
206 | |
227
209ca3f6db62
dicom-scu from rest
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
226
diff
changeset
|
207 // TODO CACHING MECHANISM AT THIS POINT |
2128
9329ba17a069
Possibility to DELETE "dicom-as-json" attachments to reconstruct them
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2127
diff
changeset
|
208 void ReadAttachment(std::string& result, |
9329ba17a069
Possibility to DELETE "dicom-as-json" attachments to reconstruct them
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2127
diff
changeset
|
209 const std::string& instancePublicId, |
9329ba17a069
Possibility to DELETE "dicom-as-json" attachments to reconstruct them
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2127
diff
changeset
|
210 FileContentType content, |
9329ba17a069
Possibility to DELETE "dicom-as-json" attachments to reconstruct them
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2127
diff
changeset
|
211 bool uncompressIfNeeded); |
9329ba17a069
Possibility to DELETE "dicom-as-json" attachments to reconstruct them
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2127
diff
changeset
|
212 |
9329ba17a069
Possibility to DELETE "dicom-as-json" attachments to reconstruct them
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2127
diff
changeset
|
213 void ReadAttachment(std::string& result, |
9329ba17a069
Possibility to DELETE "dicom-as-json" attachments to reconstruct them
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2127
diff
changeset
|
214 const FileInfo& attachment); |
1778
776573e592da
create media refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1758
diff
changeset
|
215 |
695
c59bc408fb10
parameter to disable the computation of the MD5
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
689
diff
changeset
|
216 void SetStoreMD5ForAttachments(bool storeMD5); |
c59bc408fb10
parameter to disable the computation of the MD5
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
689
diff
changeset
|
217 |
c59bc408fb10
parameter to disable the computation of the MD5
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
689
diff
changeset
|
218 bool IsStoreMD5ForAttachments() const |
c59bc408fb10
parameter to disable the computation of the MD5
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
689
diff
changeset
|
219 { |
1549
e5e975e9b738
refactoring and simplification of StorageAccessor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1456
diff
changeset
|
220 return storeMD5_; |
695
c59bc408fb10
parameter to disable the computation of the MD5
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
689
diff
changeset
|
221 } |
771 | 222 |
223 ReusableDicomUserConnection& GetReusableDicomUserConnection() | |
224 { | |
225 return scu_; | |
226 } | |
783
c9cdd53a6b31
main scheduler added to the server context
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
771
diff
changeset
|
227 |
c9cdd53a6b31
main scheduler added to the server context
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
771
diff
changeset
|
228 ServerScheduler& GetScheduler() |
c9cdd53a6b31
main scheduler added to the server context
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
771
diff
changeset
|
229 { |
c9cdd53a6b31
main scheduler added to the server context
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
771
diff
changeset
|
230 return scheduler_; |
c9cdd53a6b31
main scheduler added to the server context
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
771
diff
changeset
|
231 } |
1066
bb82e5e818e9
OnStoredInstance callback in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1005
diff
changeset
|
232 |
1145
0479d02c6778
Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1134
diff
changeset
|
233 bool DeleteResource(Json::Value& target, |
0479d02c6778
Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1134
diff
changeset
|
234 const std::string& uuid, |
0479d02c6778
Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1134
diff
changeset
|
235 ResourceType expectedType); |
1189
6b9b02a16e99
NewChildInstance change type
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1146
diff
changeset
|
236 |
1198 | 237 void SignalChange(const ServerIndexChange& change); |
1232
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1223
diff
changeset
|
238 |
1368 | 239 SharedArchive& GetQueryRetrieveArchive() |
240 { | |
241 return queryRetrieveArchive_; | |
242 } | |
1427
d710ea64f0fd
Custom setting of the local AET during C-Store SCU (both in Lua and in the REST API)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
243 |
d710ea64f0fd
Custom setting of the local AET during C-Store SCU (both in Lua and in the REST API)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
244 const std::string& GetDefaultLocalApplicationEntityTitle() const |
d710ea64f0fd
Custom setting of the local AET during C-Store SCU (both in Lua and in the REST API)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
245 { |
d710ea64f0fd
Custom setting of the local AET during C-Store SCU (both in Lua and in the REST API)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
246 return defaultLocalAet_; |
d710ea64f0fd
Custom setting of the local AET during C-Store SCU (both in Lua and in the REST API)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
247 } |
1433
461e7554bff7
refactoring: LuaScripting
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
248 |
461e7554bff7
refactoring: LuaScripting
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
249 LuaScripting& GetLua() |
461e7554bff7
refactoring: LuaScripting
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
250 { |
461e7554bff7
refactoring: LuaScripting
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
251 return lua_; |
461e7554bff7
refactoring: LuaScripting
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
252 } |
1434
f9cd40166269
refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1433
diff
changeset
|
253 |
1444
b2b09a3dbd8e
refactoring: OrthancHttpHandler inside OrthancServer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1436
diff
changeset
|
254 OrthancHttpHandler& GetHttpHandler() |
b2b09a3dbd8e
refactoring: OrthancHttpHandler inside OrthancServer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1436
diff
changeset
|
255 { |
b2b09a3dbd8e
refactoring: OrthancHttpHandler inside OrthancServer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1436
diff
changeset
|
256 return httpHandler_; |
b2b09a3dbd8e
refactoring: OrthancHttpHandler inside OrthancServer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1436
diff
changeset
|
257 } |
b2b09a3dbd8e
refactoring: OrthancHttpHandler inside OrthancServer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1436
diff
changeset
|
258 |
1447
5ba7471780ae
refactoring: HttpToolbox, DumpJson in Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1444
diff
changeset
|
259 void Stop(); |
5ba7471780ae
refactoring: HttpToolbox, DumpJson in Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1444
diff
changeset
|
260 |
1758 | 261 bool Apply(std::list<std::string>& result, |
1757
98abb8d7f905
ServerContext::Apply lookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1753
diff
changeset
|
262 const ::Orthanc::LookupResource& lookup, |
98abb8d7f905
ServerContext::Apply lookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1753
diff
changeset
|
263 size_t maxResults); |
98abb8d7f905
ServerContext::Apply lookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1753
diff
changeset
|
264 |
1434
f9cd40166269
refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1433
diff
changeset
|
265 |
f9cd40166269
refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1433
diff
changeset
|
266 /** |
f9cd40166269
refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1433
diff
changeset
|
267 * Management of the plugins |
f9cd40166269
refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1433
diff
changeset
|
268 **/ |
f9cd40166269
refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1433
diff
changeset
|
269 |
2136
dd609a99d39a
uniformization of the macro naming
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2128
diff
changeset
|
270 #if ORTHANC_ENABLE_PLUGINS == 1 |
1434
f9cd40166269
refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1433
diff
changeset
|
271 void SetPlugins(OrthancPlugins& plugins); |
f9cd40166269
refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1433
diff
changeset
|
272 |
f9cd40166269
refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1433
diff
changeset
|
273 void ResetPlugins(); |
f9cd40166269
refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1433
diff
changeset
|
274 |
1632
eb8fbcf008b5
fix build with plugins disabled
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1549
diff
changeset
|
275 const OrthancPlugins& GetPlugins() const; |
1741
06addfcd1d4c
OrthancStarted and OrthancStopped events in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1700
diff
changeset
|
276 |
06addfcd1d4c
OrthancStarted and OrthancStopped events in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1700
diff
changeset
|
277 OrthancPlugins& GetPlugins(); |
1632
eb8fbcf008b5
fix build with plugins disabled
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1549
diff
changeset
|
278 #endif |
eb8fbcf008b5
fix build with plugins disabled
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1549
diff
changeset
|
279 |
1434
f9cd40166269
refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1433
diff
changeset
|
280 bool HasPlugins() const; |
224 | 281 }; |
282 } |