Mercurial > hg > orthanc
annotate OrthancServer/Sources/OrthancWebDav.h @ 4834:bec432ee1094
download of numpy arrays from the REST API
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 26 Nov 2021 19:03:32 +0100 |
parents | 7053502fbf97 |
children | 2e71a08eea15 43e613a7756b |
rev | line source |
---|---|
4240 | 1 /** |
2 * Orthanc - A Lightweight, RESTful DICOM Store | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
4437
d9473bd5ed43
upgrade to year 2021
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4243
diff
changeset
|
5 * Copyright (C) 2017-2021 Osimis S.A., Belgium |
4831
7053502fbf97
added copyright UCLouvain
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
6 * Copyright (C) 2021-2021 Sebastien Jodogne, ICTEAM UCLouvain, Belgium |
4240 | 7 * |
8 * This program is free software: you can redistribute it and/or | |
9 * modify it under the terms of the GNU General Public License as | |
10 * published by the Free Software Foundation, either version 3 of the | |
11 * License, or (at your option) any later version. | |
12 * | |
13 * In addition, as a special exception, the copyright holders of this | |
14 * program give permission to link the code of its release with the | |
15 * OpenSSL project's "OpenSSL" library (or with modified versions of it | |
16 * that use the same license as the "OpenSSL" library), and distribute | |
17 * the linked executables. You must obey the GNU General Public License | |
18 * in all respects for all of the code used other than "OpenSSL". If you | |
19 * modify file(s) with this exception, you may extend this exception to | |
20 * your version of the file(s), but you are not obligated to do so. If | |
21 * you do not wish to do so, delete this exception statement from your | |
22 * version. If you delete this exception statement from all source files | |
23 * in the program, then also delete it here. | |
24 * | |
25 * This program is distributed in the hope that it will be useful, but | |
26 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
27 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
28 * General Public License for more details. | |
29 * | |
30 * You should have received a copy of the GNU General Public License | |
31 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
32 **/ | |
33 | |
34 | |
35 #pragma once | |
36 | |
37 #include "../../OrthancFramework/Sources/HttpServer/WebDavStorage.h" | |
38 #include "../../OrthancFramework/Sources/MultiThreading/SharedMessageQueue.h" | |
39 #include "../../OrthancFramework/Sources/Toolbox.h" | |
40 | |
41 | |
42 namespace Orthanc | |
43 { | |
44 class ServerContext; | |
45 | |
46 class OrthancWebDav : public IWebDavBucket | |
47 { | |
48 private: | |
49 typedef std::map<ResourceType, std::string> Templates; | |
50 | |
4242
5cfa6ba75dfc
deleting resources from Orthanc WebDAV
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4240
diff
changeset
|
51 class DicomDeleteVisitor; |
4240 | 52 class DicomFileVisitor; |
4242
5cfa6ba75dfc
deleting resources from Orthanc WebDAV
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4240
diff
changeset
|
53 class DicomIdentifiersVisitor; |
4240 | 54 class InstancesOfSeries; |
55 class InternalNode; | |
56 class ListOfResources; | |
57 class ListOfStudiesByDate; | |
58 class ListOfStudiesByMonth; | |
59 class ListOfStudiesByYear; | |
4242
5cfa6ba75dfc
deleting resources from Orthanc WebDAV
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4240
diff
changeset
|
60 class OrthancJsonVisitor; |
4240 | 61 class ResourcesIndex; |
62 class RootNode; | |
63 class SingleDicomResource; | |
4242
5cfa6ba75dfc
deleting resources from Orthanc WebDAV
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4240
diff
changeset
|
64 |
4240 | 65 class INode : public boost::noncopyable |
66 { | |
67 public: | |
68 virtual ~INode() | |
69 { | |
70 } | |
71 | |
72 virtual bool ListCollection(IWebDavBucket::Collection& target, | |
73 const UriComponents& path) = 0; | |
74 | |
75 virtual bool GetFileContent(MimeType& mime, | |
76 std::string& content, | |
77 boost::posix_time::ptime& time, | |
78 const UriComponents& path) = 0; | |
4242
5cfa6ba75dfc
deleting resources from Orthanc WebDAV
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4240
diff
changeset
|
79 |
5cfa6ba75dfc
deleting resources from Orthanc WebDAV
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4240
diff
changeset
|
80 virtual bool DeleteItem(const UriComponents& path) = 0; |
4240 | 81 }; |
82 | |
83 | |
84 void AddVirtualFile(Collection& collection, | |
85 const UriComponents& path, | |
86 const std::string& filename); | |
87 | |
88 static void UploadWorker(OrthancWebDav* that); | |
89 | |
90 void Upload(const std::string& path); | |
4242
5cfa6ba75dfc
deleting resources from Orthanc WebDAV
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4240
diff
changeset
|
91 |
5cfa6ba75dfc
deleting resources from Orthanc WebDAV
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4240
diff
changeset
|
92 INode& GetRootNode(const std::string& rootPath); |
4240 | 93 |
94 ServerContext& context_; | |
4242
5cfa6ba75dfc
deleting resources from Orthanc WebDAV
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4240
diff
changeset
|
95 bool allowDicomDelete_; |
4243
64f57c9d5f79
configuration options for webdav
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4242
diff
changeset
|
96 bool allowUpload_; |
4240 | 97 std::unique_ptr<INode> patients_; |
98 std::unique_ptr<INode> studies_; | |
99 std::unique_ptr<INode> dates_; | |
100 Templates patientsTemplates_; | |
101 Templates studiesTemplates_; | |
102 WebDavStorage uploads_; | |
103 SharedMessageQueue uploadQueue_; | |
104 boost::thread uploadThread_; | |
4243
64f57c9d5f79
configuration options for webdav
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4242
diff
changeset
|
105 bool uploadRunning_; |
4240 | 106 |
107 public: | |
4242
5cfa6ba75dfc
deleting resources from Orthanc WebDAV
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4240
diff
changeset
|
108 OrthancWebDav(ServerContext& context, |
4243
64f57c9d5f79
configuration options for webdav
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4242
diff
changeset
|
109 bool allowDicomDelete, |
64f57c9d5f79
configuration options for webdav
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4242
diff
changeset
|
110 bool allowUpload); |
4240 | 111 |
112 virtual ~OrthancWebDav() | |
113 { | |
114 Stop(); | |
115 } | |
116 | |
117 virtual bool IsExistingFolder(const UriComponents& path) ORTHANC_OVERRIDE; | |
118 | |
119 virtual bool ListCollection(Collection& collection, | |
120 const UriComponents& path) ORTHANC_OVERRIDE; | |
121 | |
122 virtual bool GetFileContent(MimeType& mime, | |
123 std::string& content, | |
124 boost::posix_time::ptime& modificationTime, | |
125 const UriComponents& path) ORTHANC_OVERRIDE; | |
126 | |
127 virtual bool StoreFile(const std::string& content, | |
128 const UriComponents& path) ORTHANC_OVERRIDE; | |
129 | |
130 virtual bool CreateFolder(const UriComponents& path) ORTHANC_OVERRIDE; | |
131 | |
132 virtual bool DeleteItem(const std::vector<std::string>& path) ORTHANC_OVERRIDE; | |
133 | |
134 virtual void Start() ORTHANC_OVERRIDE; | |
135 | |
136 virtual void Stop() ORTHANC_OVERRIDE; | |
137 }; | |
138 } |