Mercurial > hg > orthanc
annotate OrthancServer/Sources/OrthancWebDav.h @ 4320:08e3600dcb1b
fix logging
author | Alain Mazy <alain@mazy.be> |
---|---|
date | Mon, 23 Nov 2020 14:23:10 +0100 |
parents | 64f57c9d5f79 |
children | d9473bd5ed43 |
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 | |
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium | |
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 | |
36 #include "../../OrthancFramework/Sources/HttpServer/WebDavStorage.h" | |
37 #include "../../OrthancFramework/Sources/MultiThreading/SharedMessageQueue.h" | |
38 #include "../../OrthancFramework/Sources/Toolbox.h" | |
39 | |
40 | |
41 namespace Orthanc | |
42 { | |
43 class ServerContext; | |
44 | |
45 class OrthancWebDav : public IWebDavBucket | |
46 { | |
47 private: | |
48 typedef std::map<ResourceType, std::string> Templates; | |
49 | |
4242
5cfa6ba75dfc
deleting resources from Orthanc WebDAV
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4240
diff
changeset
|
50 class DicomDeleteVisitor; |
4240 | 51 class DicomFileVisitor; |
4242
5cfa6ba75dfc
deleting resources from Orthanc WebDAV
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4240
diff
changeset
|
52 class DicomIdentifiersVisitor; |
4240 | 53 class InstancesOfSeries; |
54 class InternalNode; | |
55 class ListOfResources; | |
56 class ListOfStudiesByDate; | |
57 class ListOfStudiesByMonth; | |
58 class ListOfStudiesByYear; | |
4242
5cfa6ba75dfc
deleting resources from Orthanc WebDAV
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4240
diff
changeset
|
59 class OrthancJsonVisitor; |
4240 | 60 class ResourcesIndex; |
61 class RootNode; | |
62 class SingleDicomResource; | |
4242
5cfa6ba75dfc
deleting resources from Orthanc WebDAV
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4240
diff
changeset
|
63 |
4240 | 64 class INode : public boost::noncopyable |
65 { | |
66 public: | |
67 virtual ~INode() | |
68 { | |
69 } | |
70 | |
71 virtual bool ListCollection(IWebDavBucket::Collection& target, | |
72 const UriComponents& path) = 0; | |
73 | |
74 virtual bool GetFileContent(MimeType& mime, | |
75 std::string& content, | |
76 boost::posix_time::ptime& time, | |
77 const UriComponents& path) = 0; | |
4242
5cfa6ba75dfc
deleting resources from Orthanc WebDAV
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4240
diff
changeset
|
78 |
5cfa6ba75dfc
deleting resources from Orthanc WebDAV
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4240
diff
changeset
|
79 virtual bool DeleteItem(const UriComponents& path) = 0; |
4240 | 80 }; |
81 | |
82 | |
83 void AddVirtualFile(Collection& collection, | |
84 const UriComponents& path, | |
85 const std::string& filename); | |
86 | |
87 static void UploadWorker(OrthancWebDav* that); | |
88 | |
89 void Upload(const std::string& path); | |
4242
5cfa6ba75dfc
deleting resources from Orthanc WebDAV
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4240
diff
changeset
|
90 |
5cfa6ba75dfc
deleting resources from Orthanc WebDAV
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4240
diff
changeset
|
91 INode& GetRootNode(const std::string& rootPath); |
4240 | 92 |
93 ServerContext& context_; | |
4242
5cfa6ba75dfc
deleting resources from Orthanc WebDAV
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4240
diff
changeset
|
94 bool allowDicomDelete_; |
4243
64f57c9d5f79
configuration options for webdav
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4242
diff
changeset
|
95 bool allowUpload_; |
4240 | 96 std::unique_ptr<INode> patients_; |
97 std::unique_ptr<INode> studies_; | |
98 std::unique_ptr<INode> dates_; | |
99 Templates patientsTemplates_; | |
100 Templates studiesTemplates_; | |
101 WebDavStorage uploads_; | |
102 SharedMessageQueue uploadQueue_; | |
103 boost::thread uploadThread_; | |
4243
64f57c9d5f79
configuration options for webdav
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4242
diff
changeset
|
104 bool uploadRunning_; |
4240 | 105 |
106 public: | |
4242
5cfa6ba75dfc
deleting resources from Orthanc WebDAV
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4240
diff
changeset
|
107 OrthancWebDav(ServerContext& context, |
4243
64f57c9d5f79
configuration options for webdav
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4242
diff
changeset
|
108 bool allowDicomDelete, |
64f57c9d5f79
configuration options for webdav
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4242
diff
changeset
|
109 bool allowUpload); |
4240 | 110 |
111 virtual ~OrthancWebDav() | |
112 { | |
113 Stop(); | |
114 } | |
115 | |
116 virtual bool IsExistingFolder(const UriComponents& path) ORTHANC_OVERRIDE; | |
117 | |
118 virtual bool ListCollection(Collection& collection, | |
119 const UriComponents& path) ORTHANC_OVERRIDE; | |
120 | |
121 virtual bool GetFileContent(MimeType& mime, | |
122 std::string& content, | |
123 boost::posix_time::ptime& modificationTime, | |
124 const UriComponents& path) ORTHANC_OVERRIDE; | |
125 | |
126 virtual bool StoreFile(const std::string& content, | |
127 const UriComponents& path) ORTHANC_OVERRIDE; | |
128 | |
129 virtual bool CreateFolder(const UriComponents& path) ORTHANC_OVERRIDE; | |
130 | |
131 virtual bool DeleteItem(const std::vector<std::string>& path) ORTHANC_OVERRIDE; | |
132 | |
133 virtual void Start() ORTHANC_OVERRIDE; | |
134 | |
135 virtual void Stop() ORTHANC_OVERRIDE; | |
136 }; | |
137 } |