bump product version to 7.2.5.1
[LibreOffice.git] / ucb / source / ucp / webdav-neon / DAVSession.hxx
blobf61bbdb6ad90928f154f3f42afc1c8b9d1abc16e
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 #pragma once
31 #include <config_lgpl.h>
32 #include <memory>
33 #include <rtl/ustring.hxx>
34 #include <com/sun/star/io/XInputStream.hpp>
35 #include <com/sun/star/io/XOutputStream.hpp>
36 #include "DAVProperties.hxx"
37 #include "DAVResource.hxx"
38 #include "DAVSessionFactory.hxx"
39 #include "DAVTypes.hxx"
40 #include "DAVRequestEnvironment.hxx"
42 namespace com::sun::star::beans {
43 struct NamedValue;
46 namespace com::sun::star::ucb {
47 struct Lock;
50 namespace webdav_ucp
53 class DAVSession
55 public:
56 void acquire()
58 osl_atomic_increment( &m_nRefCount );
61 void release()
63 if ( osl_atomic_decrement( &m_nRefCount ) == 0 )
65 m_xFactory->releaseElement( this );
66 delete this;
70 virtual bool CanUse( const OUString & inPath,
71 const css::uno::Sequence< css::beans::NamedValue >& rFlags ) = 0;
73 virtual bool UsesProxy() = 0;
75 // DAV methods
77 /// @throws std::exception
78 virtual void OPTIONS( const OUString & inPath,
79 DAVOptions& rOptions,
80 const DAVRequestEnvironment & rEnv ) = 0;
82 // allprop & named
83 /// @throws std::exception
84 virtual void PROPFIND( const OUString & inPath,
85 const Depth inDepth,
86 const std::vector< OUString > & inPropertyNames,
87 std::vector< DAVResource > & ioResources,
88 const DAVRequestEnvironment & rEnv ) = 0;
90 // propnames
91 /// @throws std::exception
92 virtual void PROPFIND( const OUString & inPath,
93 const Depth inDepth,
94 std::vector< DAVResourceInfo > & ioResInfo,
95 const DAVRequestEnvironment & rEnv ) = 0;
97 /// @throws std::exception
98 virtual void PROPPATCH( const OUString & inPath,
99 const std::vector< ProppatchValue > & inValues,
100 const DAVRequestEnvironment & rEnv ) = 0;
102 /// @throws std::exception
103 virtual void HEAD( const OUString & inPath,
104 const std::vector< OUString > & inHeaderNames,
105 DAVResource & ioResource,
106 const DAVRequestEnvironment & rEnv ) = 0;
108 /// @throws std::exception
109 virtual css::uno::Reference< css::io::XInputStream >
110 GET( const OUString & inPath,
111 const DAVRequestEnvironment & rEnv ) = 0;
113 /// @throws std::exception
114 virtual void GET( const OUString & inPath,
115 css::uno::Reference< css::io::XOutputStream >& o,
116 const DAVRequestEnvironment & rEnv ) = 0;
118 /// @throws std::exception
119 virtual css::uno::Reference< css::io::XInputStream >
120 GET( const OUString & inPath,
121 const std::vector< OUString > & inHeaderNames,
122 DAVResource & ioResource,
123 const DAVRequestEnvironment & rEnv ) = 0;
125 // used as HEAD substitute when HEAD is not implemented on server
126 /// @throws std::exception
127 virtual void
128 GET0( const OUString & inPath,
129 const std::vector< OUString > & inHeaderNames,
130 DAVResource & ioResource,
131 const DAVRequestEnvironment & rEnv ) = 0;
133 /// @throws std::exception
134 virtual void
135 GET( const OUString & inPath,
136 css::uno::Reference< css::io::XOutputStream >& o,
137 const std::vector< OUString > & inHeaderNames,
138 DAVResource & ioResource,
139 const DAVRequestEnvironment & rEnv ) = 0;
141 /// @throws std::exception
142 virtual void PUT( const OUString & inPath,
143 const css::uno::Reference< css::io::XInputStream >& s,
144 const DAVRequestEnvironment & rEnv ) = 0;
146 /// @throws std::exception
147 virtual css::uno::Reference< css::io::XInputStream >
148 POST( const OUString & inPath,
149 const OUString & rContentType,
150 const OUString & rReferer,
151 const css::uno::Reference< css::io::XInputStream > & inInputStream,
152 const DAVRequestEnvironment & rEnv ) = 0;
154 /// @throws std::exception
155 virtual void POST( const OUString & inPath,
156 const OUString & rContentType,
157 const OUString & rReferer,
158 const css::uno::Reference< css::io::XInputStream > & inInputStream,
159 css::uno::Reference< css::io::XOutputStream > & oOutputStream,
160 const DAVRequestEnvironment & rEnv ) = 0;
162 /// @throws std::exception
163 virtual void MKCOL( const OUString & inPath,
164 const DAVRequestEnvironment & rEnv ) = 0;
166 /// @throws std::exception
167 virtual void COPY( const OUString & inSource,
168 const OUString & inDestination,
169 const DAVRequestEnvironment & rEnv,
170 bool inOverwrite ) = 0;
172 /// @throws std::exception
173 virtual void MOVE( const OUString & inSource,
174 const OUString & inDestination,
175 const DAVRequestEnvironment & rEnv,
176 bool inOverwrite ) = 0;
178 /// @throws std::exception
179 virtual void DESTROY( const OUString & inPath,
180 const DAVRequestEnvironment & rEnv ) = 0;
182 // set new lock.
183 /// @throws std::exception
184 virtual void LOCK( const OUString & inPath,
185 css::ucb::Lock & inLock,
186 const DAVRequestEnvironment & rEnv ) = 0;
188 /// @throws std::exception
189 virtual void UNLOCK( const OUString & inPath,
190 const DAVRequestEnvironment & rEnv ) = 0;
192 /// @throws std::exception
193 virtual void abort() = 0;
195 protected:
196 rtl::Reference< DAVSessionFactory > m_xFactory;
198 explicit DAVSession( rtl::Reference< DAVSessionFactory > const & rFactory )
199 : m_xFactory( rFactory ), m_nRefCount( 0 ) {}
201 virtual ~DAVSession() {}
203 private:
204 DAVSessionFactory::Map::iterator m_aContainerIt;
205 oslInterlockedCount m_nRefCount;
207 friend class DAVSessionFactory;
208 friend struct std::default_delete< DAVSession >;
211 } // namespace webdav_ucp
213 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */