Mercurial > hg > orthanc
comparison OrthancServer/Sources/OrthancWebDav.h @ 4240:799c0c527ced
reorganization
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 09 Oct 2020 12:02:40 +0200 |
parents | |
children | 5cfa6ba75dfc |
comparison
equal
deleted
inserted
replaced
4239:c8754c4c1862 | 4240:799c0c527ced |
---|---|
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 | |
50 class DicomIdentifiersVisitor; | |
51 class DicomFileVisitor; | |
52 class OrthancJsonVisitor; | |
53 class InstancesOfSeries; | |
54 class InternalNode; | |
55 class ListOfResources; | |
56 class ListOfStudiesByDate; | |
57 class ListOfStudiesByMonth; | |
58 class ListOfStudiesByYear; | |
59 class ResourcesIndex; | |
60 class RootNode; | |
61 class SingleDicomResource; | |
62 | |
63 class INode : public boost::noncopyable | |
64 { | |
65 public: | |
66 virtual ~INode() | |
67 { | |
68 } | |
69 | |
70 virtual bool ListCollection(IWebDavBucket::Collection& target, | |
71 const UriComponents& path) = 0; | |
72 | |
73 virtual bool GetFileContent(MimeType& mime, | |
74 std::string& content, | |
75 boost::posix_time::ptime& time, | |
76 const UriComponents& path) = 0; | |
77 }; | |
78 | |
79 | |
80 void AddVirtualFile(Collection& collection, | |
81 const UriComponents& path, | |
82 const std::string& filename); | |
83 | |
84 static void UploadWorker(OrthancWebDav* that); | |
85 | |
86 void Upload(const std::string& path); | |
87 | |
88 ServerContext& context_; | |
89 std::unique_ptr<INode> patients_; | |
90 std::unique_ptr<INode> studies_; | |
91 std::unique_ptr<INode> dates_; | |
92 Templates patientsTemplates_; | |
93 Templates studiesTemplates_; | |
94 WebDavStorage uploads_; | |
95 SharedMessageQueue uploadQueue_; | |
96 boost::thread uploadThread_; | |
97 bool running_; | |
98 | |
99 public: | |
100 OrthancWebDav(ServerContext& context); | |
101 | |
102 virtual ~OrthancWebDav() | |
103 { | |
104 Stop(); | |
105 } | |
106 | |
107 virtual bool IsExistingFolder(const UriComponents& path) ORTHANC_OVERRIDE; | |
108 | |
109 virtual bool ListCollection(Collection& collection, | |
110 const UriComponents& path) ORTHANC_OVERRIDE; | |
111 | |
112 virtual bool GetFileContent(MimeType& mime, | |
113 std::string& content, | |
114 boost::posix_time::ptime& modificationTime, | |
115 const UriComponents& path) ORTHANC_OVERRIDE; | |
116 | |
117 virtual bool StoreFile(const std::string& content, | |
118 const UriComponents& path) ORTHANC_OVERRIDE; | |
119 | |
120 virtual bool CreateFolder(const UriComponents& path) ORTHANC_OVERRIDE; | |
121 | |
122 virtual bool DeleteItem(const std::vector<std::string>& path) ORTHANC_OVERRIDE; | |
123 | |
124 virtual void Start() ORTHANC_OVERRIDE; | |
125 | |
126 virtual void Stop() ORTHANC_OVERRIDE; | |
127 }; | |
128 } |