Version 6.4.0.3, tag libreoffice-6.4.0.3
[LibreOffice.git] / ucb / source / ucp / webdav-neon / DAVSession.hxx
blob52891f342fed2f1edc5aa39f1c54bd4ed88d19e8
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 #ifndef INCLUDED_UCB_SOURCE_UCP_WEBDAV_NEON_DAVSESSION_HXX
30 #define INCLUDED_UCB_SOURCE_UCP_WEBDAV_NEON_DAVSESSION_HXX
32 #include <config_lgpl.h>
33 #include <memory>
34 #include <rtl/ustring.hxx>
35 #include <com/sun/star/io/XInputStream.hpp>
36 #include <com/sun/star/io/XOutputStream.hpp>
37 #include "DAVProperties.hxx"
38 #include "DAVResource.hxx"
39 #include "DAVSessionFactory.hxx"
40 #include "DAVTypes.hxx"
41 #include "DAVRequestEnvironment.hxx"
43 namespace com { namespace sun { namespace star { namespace beans {
44 struct NamedValue;
45 } } } }
47 namespace com { namespace sun { namespace star { namespace ucb {
48 struct Lock;
49 } } } }
51 namespace webdav_ucp
54 class DAVSession
56 public:
57 void acquire()
59 osl_atomic_increment( &m_nRefCount );
62 void release()
64 if ( osl_atomic_decrement( &m_nRefCount ) == 0 )
66 m_xFactory->releaseElement( this );
67 delete this;
71 virtual bool CanUse( const OUString & inPath,
72 const css::uno::Sequence< css::beans::NamedValue >& rFlags ) = 0;
74 virtual bool UsesProxy() = 0;
76 // DAV methods
78 /// @throws std::exception
79 virtual void OPTIONS( const OUString & inPath,
80 DAVOptions& rOptions,
81 const DAVRequestEnvironment & rEnv ) = 0;
83 // allprop & named
84 /// @throws std::exception
85 virtual void PROPFIND( const OUString & inPath,
86 const Depth inDepth,
87 const std::vector< OUString > & inPropertyNames,
88 std::vector< DAVResource > & ioResources,
89 const DAVRequestEnvironment & rEnv ) = 0;
91 // propnames
92 /// @throws std::exception
93 virtual void PROPFIND( const OUString & inPath,
94 const Depth inDepth,
95 std::vector< DAVResourceInfo > & ioResInfo,
96 const DAVRequestEnvironment & rEnv ) = 0;
98 /// @throws std::exception
99 virtual void PROPPATCH( const OUString & inPath,
100 const std::vector< ProppatchValue > & inValues,
101 const DAVRequestEnvironment & rEnv ) = 0;
103 /// @throws std::exception
104 virtual void HEAD( const OUString & inPath,
105 const std::vector< OUString > & inHeaderNames,
106 DAVResource & ioResource,
107 const DAVRequestEnvironment & rEnv ) = 0;
109 /// @throws std::exception
110 virtual css::uno::Reference< css::io::XInputStream >
111 GET( const OUString & inPath,
112 const DAVRequestEnvironment & rEnv ) = 0;
114 /// @throws std::exception
115 virtual void GET( const OUString & inPath,
116 css::uno::Reference< css::io::XOutputStream >& o,
117 const DAVRequestEnvironment & rEnv ) = 0;
119 /// @throws std::exception
120 virtual css::uno::Reference< css::io::XInputStream >
121 GET( const OUString & inPath,
122 const std::vector< OUString > & inHeaderNames,
123 DAVResource & ioResource,
124 const DAVRequestEnvironment & rEnv ) = 0;
126 // used as HEAD substitute when HEAD is not implemented on server
127 /// @throws std::exception
128 virtual void
129 GET0( const OUString & inPath,
130 const std::vector< OUString > & inHeaderNames,
131 DAVResource & ioResource,
132 const DAVRequestEnvironment & rEnv ) = 0;
134 /// @throws std::exception
135 virtual void
136 GET( const OUString & inPath,
137 css::uno::Reference< css::io::XOutputStream >& o,
138 const std::vector< OUString > & inHeaderNames,
139 DAVResource & ioResource,
140 const DAVRequestEnvironment & rEnv ) = 0;
142 /// @throws std::exception
143 virtual void PUT( const OUString & inPath,
144 const css::uno::Reference< css::io::XInputStream >& s,
145 const DAVRequestEnvironment & rEnv ) = 0;
147 /// @throws std::exception
148 virtual css::uno::Reference< css::io::XInputStream >
149 POST( const OUString & inPath,
150 const OUString & rContentType,
151 const OUString & rReferer,
152 const css::uno::Reference< css::io::XInputStream > & inInputStream,
153 const DAVRequestEnvironment & rEnv ) = 0;
155 /// @throws std::exception
156 virtual void POST( const OUString & inPath,
157 const OUString & rContentType,
158 const OUString & rReferer,
159 const css::uno::Reference< css::io::XInputStream > & inInputStream,
160 css::uno::Reference< css::io::XOutputStream > & oOutputStream,
161 const DAVRequestEnvironment & rEnv ) = 0;
163 /// @throws std::exception
164 virtual void MKCOL( const OUString & inPath,
165 const DAVRequestEnvironment & rEnv ) = 0;
167 /// @throws std::exception
168 virtual void COPY( const OUString & inSource,
169 const OUString & inDestination,
170 const DAVRequestEnvironment & rEnv,
171 bool inOverwrite ) = 0;
173 /// @throws std::exception
174 virtual void MOVE( const OUString & inSource,
175 const OUString & inDestination,
176 const DAVRequestEnvironment & rEnv,
177 bool inOverwrite ) = 0;
179 /// @throws std::exception
180 virtual void DESTROY( const OUString & inPath,
181 const DAVRequestEnvironment & rEnv ) = 0;
183 // set new lock.
184 /// @throws std::exception
185 virtual void LOCK( const OUString & inPath,
186 css::ucb::Lock & inLock,
187 const DAVRequestEnvironment & rEnv ) = 0;
189 /// @throws std::exception
190 virtual void UNLOCK( const OUString & inPath,
191 const DAVRequestEnvironment & rEnv ) = 0;
193 /// @throws std::exception
194 virtual void abort() = 0;
196 protected:
197 rtl::Reference< DAVSessionFactory > m_xFactory;
199 explicit DAVSession( rtl::Reference< DAVSessionFactory > const & rFactory )
200 : m_xFactory( rFactory ), m_nRefCount( 0 ) {}
202 virtual ~DAVSession() {}
204 private:
205 DAVSessionFactory::Map::iterator m_aContainerIt;
206 oslInterlockedCount m_nRefCount;
208 friend class DAVSessionFactory;
209 friend struct std::default_delete< DAVSession >;
212 } // namespace webdav_ucp
214 #endif // INCLUDED_UCB_SOURCE_UCP_WEBDAV_NEON_DAVSESSION_HXX
216 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */