Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / ucb / source / ucp / webdav-curl / DAVSession.hxx
blobb73ceb5613577f51501c24feeb98391e7a737095
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 #pragma once
23 #include <memory>
24 #include <rtl/ustring.hxx>
25 #include <com/sun/star/io/XInputStream.hpp>
26 #include <com/sun/star/io/XOutputStream.hpp>
27 #include <utility>
28 #include "DAVResource.hxx"
29 #include "DAVSessionFactory.hxx"
30 #include "DAVTypes.hxx"
31 #include "DAVRequestEnvironment.hxx"
33 namespace com { namespace sun { namespace star { namespace beans {
34 struct NamedValue;
35 } } } }
37 namespace com::sun::star::ucb {
38 struct Lock;
41 namespace http_dav_ucp
44 class DAVAuthListener;
46 class DAVSession
48 public:
49 void acquire()
51 osl_atomic_increment( &m_nRefCount );
54 void release()
56 if ( osl_atomic_decrement( &m_nRefCount ) == 0 )
58 m_xFactory->releaseElement( this );
59 delete this;
63 virtual bool CanUse( const OUString & rURI,
64 const ::com::sun::star::uno::Sequence<::com::sun::star::beans::NamedValue>& rFlags ) = 0;
66 virtual bool UsesProxy() = 0;
68 // DAV methods
70 virtual void OPTIONS( const OUString & inPath,
71 DAVOptions & rOptions,
72 const DAVRequestEnvironment & rEnv ) = 0;
74 // allprop & named
75 /// @throws DAVException
76 virtual void PROPFIND( const OUString & inPath,
77 const Depth inDepth,
78 const std::vector< OUString > & inPropertyNames,
79 std::vector< DAVResource > & ioResources,
80 const DAVRequestEnvironment & rEnv ) = 0;
82 // propnames
83 /// @throws DAVException
84 virtual void PROPFIND( const OUString & inPath,
85 const Depth inDepth,
86 std::vector< DAVResourceInfo > & ioResInfo,
87 const DAVRequestEnvironment & rEnv ) = 0;
89 /// @throws DAVException
90 virtual void PROPPATCH( const OUString & inPath,
91 const std::vector< ProppatchValue > & inValues,
92 const DAVRequestEnvironment & rEnv ) = 0;
94 /// @throws DAVException
95 virtual void HEAD( const OUString & inPath,
96 const std::vector< OUString > & inHeaderNames,
97 DAVResource & ioResource,
98 const DAVRequestEnvironment & rEnv ) = 0;
100 /// @throws DAVException
101 virtual css::uno::Reference< css::io::XInputStream >
102 GET( const OUString & inPath,
103 const DAVRequestEnvironment & rEnv ) = 0;
105 /// @throws DAVException
106 virtual void GET( const OUString & inPath,
107 css::uno::Reference< css::io::XOutputStream >& o,
108 const DAVRequestEnvironment & rEnv ) = 0;
110 /// @throws DAVException
111 virtual css::uno::Reference< css::io::XInputStream >
112 GET( const OUString & inPath,
113 const std::vector< OUString > & inHeaderNames,
114 DAVResource & ioResource,
115 const DAVRequestEnvironment & rEnv ) = 0;
117 /// @throws DAVException
118 virtual void
119 GET( const OUString & inPath,
120 css::uno::Reference< css::io::XOutputStream >& o,
121 const std::vector< OUString > & inHeaderNames,
122 DAVResource & ioResource,
123 const DAVRequestEnvironment & rEnv ) = 0;
125 /// @throws DAVException
126 virtual void PUT( const OUString & inPath,
127 const css::uno::Reference< css::io::XInputStream >& s,
128 const DAVRequestEnvironment & rEnv ) = 0;
130 /// @throws DAVException
131 virtual css::uno::Reference< css::io::XInputStream >
132 POST( const OUString & inPath,
133 const OUString & rContentType,
134 const OUString & rReferer,
135 const css::uno::Reference< css::io::XInputStream > & inInputStream,
136 const DAVRequestEnvironment & rEnv ) = 0;
138 /// @throws DAVException
139 virtual void POST( const OUString & inPath,
140 const OUString & rContentType,
141 const OUString & rReferer,
142 const css::uno::Reference< css::io::XInputStream > & inInputStream,
143 css::uno::Reference< css::io::XOutputStream > & oOutputStream,
144 const DAVRequestEnvironment & rEnv ) = 0;
146 /// @throws DAVException
147 virtual void MKCOL( const OUString & inPath,
148 const DAVRequestEnvironment & rEnv ) = 0;
150 /// @throws DAVException
151 virtual void COPY( const OUString & inSource,
152 const OUString & inDestination,
153 const DAVRequestEnvironment & rEnv,
154 bool inOverwrite = false ) = 0;
156 /// @throws DAVException
157 virtual void MOVE( const OUString & inSource,
158 const OUString & inDestination,
159 const DAVRequestEnvironment & rEnv,
160 bool inOverwrite = false ) = 0;
162 /// @throws DAVException
163 virtual void DESTROY( const OUString & inPath,
164 const DAVRequestEnvironment & rEnv ) = 0;
166 // set new lock.
167 /// @throws DAVException
168 virtual void LOCK( const OUString & inPath,
169 css::ucb::Lock & inLock,
170 const DAVRequestEnvironment & rEnv ) = 0;
172 /// @throws DAVException
173 virtual void UNLOCK( const OUString & inPath,
174 const DAVRequestEnvironment & rEnv ) = 0;
176 /// @throws DAVException
177 virtual void abort() = 0;
179 protected:
180 explicit DAVSession( rtl::Reference< DAVSessionFactory > xFactory )
181 : m_xFactory(std::move( xFactory )), m_nRefCount( 0 ) {}
183 virtual ~DAVSession() {}
185 private:
186 rtl::Reference< DAVSessionFactory > m_xFactory;
187 DAVSessionFactory::Map::iterator m_aContainerIt;
188 oslInterlockedCount m_nRefCount;
190 friend class DAVSessionFactory;
191 friend struct std::default_delete< DAVSession >;
194 } // namespace http_dav_ucp
196 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */