annotate OrthancFramework/Sources/HttpServer/IWebDavBucket.h @ 4844:55e8fb8e8028

tagging a pre-release of the Orthanc framework for WSI 1.1
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 07 Dec 2021 14:01:17 +0100
parents 7053502fbf97
children 43e613a7756b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4226
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Orthanc - A Lightweight, RESTful DICOM Store
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 * Department, University Hospital of Liege, Belgium
4437
d9473bd5ed43 upgrade to year 2021
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4308
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
4226
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 *
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * This program is free software: you can redistribute it and/or
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * modify it under the terms of the GNU Lesser General Public License
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 * as published by the Free Software Foundation, either version 3 of
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 * the License, or (at your option) any later version.
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 *
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * This program is distributed in the hope that it will be useful, but
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 * Lesser General Public License for more details.
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 *
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 * You should have received a copy of the GNU Lesser General Public
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 * License along with this program. If not, see
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20 * <http://www.gnu.org/licenses/>.
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21 **/
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 #pragma once
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 #if !defined(ORTHANC_ENABLE_PUGIXML)
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 # error The macro ORTHANC_ENABLE_PUGIXML must be defined
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 #endif
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 #if ORTHANC_ENABLE_PUGIXML != 1
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 # error XML support is required to use this file
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32 #endif
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34 #include "../Compatibility.h"
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35 #include "../Enumerations.h"
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 #include <boost/date_time/posix_time/posix_time.hpp>
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38 #include <boost/noncopyable.hpp>
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39 #include <pugixml.hpp>
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 #include <list>
4252
f047e2734655 fix webdav
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4246
diff changeset
42 #include <set>
4308
b873c8e24125 fix for vs2008
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4253
diff changeset
43 #include <stdint.h>
4226
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45 namespace Orthanc
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46 {
4228
c8c0bbaaace3 write access to webdav
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4227
diff changeset
47 class HttpOutput;
c8c0bbaaace3 write access to webdav
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4227
diff changeset
48
4226
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49 class IWebDavBucket : public boost::noncopyable
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50 {
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51 public:
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52 class Resource : public boost::noncopyable
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53 {
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54 private:
4252
f047e2734655 fix webdav
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4246
diff changeset
55 std::string displayName_;
4226
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
56 bool hasModificationTime_;
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
57 boost::posix_time::ptime creationTime_;
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58 boost::posix_time::ptime modificationTime_;
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60 public:
4253
2221051b42df cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4252
diff changeset
61 explicit Resource(const std::string& displayName);
4226
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63 virtual ~Resource()
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64 {
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65 }
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
67 void SetCreationTime(const boost::posix_time::ptime& t);
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69 void SetModificationTime(const boost::posix_time::ptime& t);
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70
4252
f047e2734655 fix webdav
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4246
diff changeset
71 const std::string& GetDisplayName() const
4226
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72 {
4252
f047e2734655 fix webdav
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4246
diff changeset
73 return displayName_;
4226
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
74 }
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
75
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
76 const boost::posix_time::ptime& GetCreationTime() const
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
77 {
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
78 return creationTime_;
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
79 }
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
80
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
81 const boost::posix_time::ptime& GetModificationTime() const
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
82 {
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
83 return modificationTime_;
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
84 }
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
85
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
86 virtual void Format(pugi::xml_node& node,
4246
6c3721ff284c simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4234
diff changeset
87 const std::string& parentPath) const = 0;
4226
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
88 };
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
89
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
90
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
91 class File : public Resource
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
92 {
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
93 private:
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
94 uint64_t contentLength_;
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
95 MimeType mime_;
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
96
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
97 public:
4253
2221051b42df cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4252
diff changeset
98 explicit File(const std::string& displayName);
4226
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
99
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
100 void SetContentLength(uint64_t contentLength)
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
101 {
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
102 contentLength_ = contentLength;
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
103 }
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
104
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
105 void SetMimeType(MimeType mime)
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
106 {
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
107 mime_ = mime;
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
108 }
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
109
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
110 uint64_t GetContentLength() const
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
111 {
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
112 return contentLength_;
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
113 }
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
114
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
115 MimeType GetMimeType() const
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
116 {
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
117 return mime_;
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
118 }
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
119
4228
c8c0bbaaace3 write access to webdav
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4227
diff changeset
120 void SetCreated(bool created);
c8c0bbaaace3 write access to webdav
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4227
diff changeset
121
4226
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
122 virtual void Format(pugi::xml_node& node,
4246
6c3721ff284c simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4234
diff changeset
123 const std::string& parentPath) const ORTHANC_OVERRIDE;
4226
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
124 };
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
125
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
126
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
127 class Folder : public Resource
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
128 {
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
129 public:
4253
2221051b42df cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4252
diff changeset
130 explicit Folder(const std::string& displayName) :
4252
f047e2734655 fix webdav
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4246
diff changeset
131 Resource(displayName)
4226
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
132 {
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
133 }
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
134
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
135 virtual void Format(pugi::xml_node& node,
4246
6c3721ff284c simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4234
diff changeset
136 const std::string& parentPath) const ORTHANC_OVERRIDE;
4226
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
137 };
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
138
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
139
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
140 class Collection : public boost::noncopyable
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
141 {
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
142 private:
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
143 std::list<Resource*> resources_;
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
144
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
145 public:
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
146 ~Collection();
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
147
4234
a38376b80cd1 WebDAV: by-studies and by-patients
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4232
diff changeset
148 size_t GetSize() const
a38376b80cd1 WebDAV: by-studies and by-patients
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4232
diff changeset
149 {
a38376b80cd1 WebDAV: by-studies and by-patients
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4232
diff changeset
150 return resources_.size();
a38376b80cd1 WebDAV: by-studies and by-patients
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4232
diff changeset
151 }
a38376b80cd1 WebDAV: by-studies and by-patients
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4232
diff changeset
152
4252
f047e2734655 fix webdav
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4246
diff changeset
153 void ListDisplayNames(std::set<std::string>& target);
f047e2734655 fix webdav
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4246
diff changeset
154
4226
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
155 void AddResource(Resource* resource); // Takes ownership
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
156
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
157 void Format(std::string& target,
4246
6c3721ff284c simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4234
diff changeset
158 const std::string& parentPath) const;
4226
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
159 };
4228
c8c0bbaaace3 write access to webdav
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4227
diff changeset
160
4226
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
161
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
162 virtual ~IWebDavBucket()
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
163 {
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
164 }
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
165
4227
7fff7e683d65 basic implementation of WebDAV handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4226
diff changeset
166 virtual bool IsExistingFolder(const std::vector<std::string>& path) = 0;
7fff7e683d65 basic implementation of WebDAV handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4226
diff changeset
167
4226
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
168 virtual bool ListCollection(Collection& collection,
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
169 const std::vector<std::string>& path) = 0;
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
170
4228
c8c0bbaaace3 write access to webdav
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4227
diff changeset
171 virtual bool GetFileContent(MimeType& mime,
c8c0bbaaace3 write access to webdav
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4227
diff changeset
172 std::string& content,
c8c0bbaaace3 write access to webdav
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4227
diff changeset
173 boost::posix_time::ptime& modificationTime,
4226
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
174 const std::vector<std::string>& path) = 0;
4228
c8c0bbaaace3 write access to webdav
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4227
diff changeset
175
c8c0bbaaace3 write access to webdav
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4227
diff changeset
176 // "false" returns indicate a read-only target
c8c0bbaaace3 write access to webdav
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4227
diff changeset
177 virtual bool StoreFile(const std::string& content,
c8c0bbaaace3 write access to webdav
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4227
diff changeset
178 const std::vector<std::string>& path) = 0;
c8c0bbaaace3 write access to webdav
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4227
diff changeset
179
c8c0bbaaace3 write access to webdav
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4227
diff changeset
180 virtual bool CreateFolder(const std::vector<std::string>& path) = 0;
c8c0bbaaace3 write access to webdav
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4227
diff changeset
181
4232
688435755466 added DELETE in WebDAV, first working virtual filesystem
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4228
diff changeset
182 virtual bool DeleteItem(const std::vector<std::string>& path) = 0;
688435755466 added DELETE in WebDAV, first working virtual filesystem
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4228
diff changeset
183
4228
c8c0bbaaace3 write access to webdav
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4227
diff changeset
184 virtual void Start() = 0;
c8c0bbaaace3 write access to webdav
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4227
diff changeset
185
c8c0bbaaace3 write access to webdav
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4227
diff changeset
186 // During the shutdown of the Web server, give a chance to the
c8c0bbaaace3 write access to webdav
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4227
diff changeset
187 // bucket to end its pending operations
c8c0bbaaace3 write access to webdav
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4227
diff changeset
188 virtual void Stop() = 0;
c8c0bbaaace3 write access to webdav
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4227
diff changeset
189
c8c0bbaaace3 write access to webdav
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4227
diff changeset
190
c8c0bbaaace3 write access to webdav
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4227
diff changeset
191 static void AnswerFakedProppatch(HttpOutput& output,
c8c0bbaaace3 write access to webdav
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4227
diff changeset
192 const std::string& uri);
c8c0bbaaace3 write access to webdav
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4227
diff changeset
193
c8c0bbaaace3 write access to webdav
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4227
diff changeset
194 static void AnswerFakedLock(HttpOutput& output,
c8c0bbaaace3 write access to webdav
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4227
diff changeset
195 const std::string& uri);
c8c0bbaaace3 write access to webdav
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4227
diff changeset
196
c8c0bbaaace3 write access to webdav
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4227
diff changeset
197 static void AnswerFakedUnlock(HttpOutput& output);
4226
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
198 };
7bd5eab3ba25 prototyping IWebDavBucket
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
199 }