Mercurial > hg > orthanc
annotate OrthancServer/Sources/OrthancWebDav.h @ 5633:5db4ed395d81
merge
author | Alain Mazy <am@orthanc.team> |
---|---|
date | Tue, 21 May 2024 12:28:21 +0200 |
parents | 48b8dae6dc77 |
children | f7adfb22e20e |
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 | |
5485
48b8dae6dc77
upgrade to year 2024
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5185
diff
changeset
|
5 * Copyright (C) 2017-2024 Osimis S.A., Belgium |
48b8dae6dc77
upgrade to year 2024
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5185
diff
changeset
|
6 * Copyright (C) 2021-2024 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 * This program is distributed in the hope that it will be useful, but | |
14 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
16 * General Public License for more details. | |
17 * | |
18 * You should have received a copy of the GNU General Public License | |
19 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
20 **/ | |
21 | |
22 | |
23 #pragma once | |
24 | |
25 #include "../../OrthancFramework/Sources/HttpServer/WebDavStorage.h" | |
26 #include "../../OrthancFramework/Sources/MultiThreading/SharedMessageQueue.h" | |
27 #include "../../OrthancFramework/Sources/Toolbox.h" | |
28 | |
29 | |
30 namespace Orthanc | |
31 { | |
32 class ServerContext; | |
33 | |
34 class OrthancWebDav : public IWebDavBucket | |
35 { | |
36 private: | |
37 typedef std::map<ResourceType, std::string> Templates; | |
38 | |
4242
5cfa6ba75dfc
deleting resources from Orthanc WebDAV
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4240
diff
changeset
|
39 class DicomDeleteVisitor; |
4240 | 40 class DicomFileVisitor; |
4242
5cfa6ba75dfc
deleting resources from Orthanc WebDAV
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4240
diff
changeset
|
41 class DicomIdentifiersVisitor; |
4240 | 42 class InstancesOfSeries; |
43 class InternalNode; | |
44 class ListOfResources; | |
45 class ListOfStudiesByDate; | |
46 class ListOfStudiesByMonth; | |
47 class ListOfStudiesByYear; | |
4242
5cfa6ba75dfc
deleting resources from Orthanc WebDAV
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4240
diff
changeset
|
48 class OrthancJsonVisitor; |
4240 | 49 class ResourcesIndex; |
50 class RootNode; | |
51 class SingleDicomResource; | |
4242
5cfa6ba75dfc
deleting resources from Orthanc WebDAV
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4240
diff
changeset
|
52 |
4240 | 53 class INode : public boost::noncopyable |
54 { | |
55 public: | |
56 virtual ~INode() | |
57 { | |
58 } | |
59 | |
60 virtual bool ListCollection(IWebDavBucket::Collection& target, | |
61 const UriComponents& path) = 0; | |
62 | |
63 virtual bool GetFileContent(MimeType& mime, | |
64 std::string& content, | |
65 boost::posix_time::ptime& time, | |
66 const UriComponents& path) = 0; | |
4242
5cfa6ba75dfc
deleting resources from Orthanc WebDAV
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4240
diff
changeset
|
67 |
5cfa6ba75dfc
deleting resources from Orthanc WebDAV
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4240
diff
changeset
|
68 virtual bool DeleteItem(const UriComponents& path) = 0; |
4240 | 69 }; |
70 | |
71 | |
72 void AddVirtualFile(Collection& collection, | |
73 const UriComponents& path, | |
74 const std::string& filename); | |
75 | |
76 static void UploadWorker(OrthancWebDav* that); | |
77 | |
78 void Upload(const std::string& path); | |
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 INode& GetRootNode(const std::string& rootPath); |
4240 | 81 |
82 ServerContext& context_; | |
4242
5cfa6ba75dfc
deleting resources from Orthanc WebDAV
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4240
diff
changeset
|
83 bool allowDicomDelete_; |
4243
64f57c9d5f79
configuration options for webdav
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4242
diff
changeset
|
84 bool allowUpload_; |
4240 | 85 std::unique_ptr<INode> patients_; |
86 std::unique_ptr<INode> studies_; | |
87 std::unique_ptr<INode> dates_; | |
88 Templates patientsTemplates_; | |
89 Templates studiesTemplates_; | |
90 WebDavStorage uploads_; | |
91 SharedMessageQueue uploadQueue_; | |
92 boost::thread uploadThread_; | |
4243
64f57c9d5f79
configuration options for webdav
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4242
diff
changeset
|
93 bool uploadRunning_; |
4240 | 94 |
95 public: | |
4242
5cfa6ba75dfc
deleting resources from Orthanc WebDAV
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4240
diff
changeset
|
96 OrthancWebDav(ServerContext& context, |
4243
64f57c9d5f79
configuration options for webdav
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4242
diff
changeset
|
97 bool allowDicomDelete, |
64f57c9d5f79
configuration options for webdav
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4242
diff
changeset
|
98 bool allowUpload); |
4240 | 99 |
100 virtual ~OrthancWebDav() | |
101 { | |
102 Stop(); | |
103 } | |
104 | |
105 virtual bool IsExistingFolder(const UriComponents& path) ORTHANC_OVERRIDE; | |
106 | |
107 virtual bool ListCollection(Collection& collection, | |
108 const UriComponents& path) ORTHANC_OVERRIDE; | |
109 | |
110 virtual bool GetFileContent(MimeType& mime, | |
111 std::string& content, | |
112 boost::posix_time::ptime& modificationTime, | |
113 const UriComponents& path) ORTHANC_OVERRIDE; | |
114 | |
115 virtual bool StoreFile(const std::string& content, | |
116 const UriComponents& path) ORTHANC_OVERRIDE; | |
117 | |
118 virtual bool CreateFolder(const UriComponents& path) ORTHANC_OVERRIDE; | |
119 | |
120 virtual bool DeleteItem(const std::vector<std::string>& path) ORTHANC_OVERRIDE; | |
121 | |
122 virtual void Start() ORTHANC_OVERRIDE; | |
123 | |
124 virtual void Stop() ORTHANC_OVERRIDE; | |
125 }; | |
126 } |