Bump for 3.6-28
[LibreOffice.git] / ucb / source / ucp / webdav / DAVSession.hxx
blobb353d33e644e1a36026575a3cf291d9262553731
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 _DAVSESSION_HXX_
30 #define _DAVSESSION_HXX_
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 "DAVException.hxx"
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 DAVAuthListener;
56 class DAVSession
58 public:
59 inline void acquire() SAL_THROW(())
61 osl_incrementInterlockedCount( &m_nRefCount );
64 void release() SAL_THROW(())
66 if ( osl_decrementInterlockedCount( &m_nRefCount ) == 0 )
68 m_xFactory->releaseElement( this );
69 delete this;
73 virtual sal_Bool CanUse( const ::rtl::OUString & inPath,
74 const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& rFlags ) = 0;
76 virtual sal_Bool UsesProxy() = 0;
78 // DAV methods
81 virtual void OPTIONS( const ::rtl::OUString & inPath,
82 DAVCapabilities & outCapabilities,
83 const DAVRequestEnvironment & rEnv )
84 throw( DAVException ) = 0;
86 // allprop & named
87 virtual void PROPFIND( const ::rtl::OUString & inPath,
88 const Depth inDepth,
89 const std::vector< ::rtl::OUString > & inPropertyNames,
90 std::vector< DAVResource > & ioResources,
91 const DAVRequestEnvironment & rEnv )
92 throw( DAVException ) = 0;
94 // propnames
95 virtual void PROPFIND( const ::rtl::OUString & inPath,
96 const Depth inDepth,
97 std::vector< DAVResourceInfo > & ioResInfo,
98 const DAVRequestEnvironment & rEnv )
99 throw( DAVException ) = 0;
101 virtual void PROPPATCH( const ::rtl::OUString & inPath,
102 const std::vector< ProppatchValue > & inValues,
103 const DAVRequestEnvironment & rEnv )
104 throw( DAVException ) = 0;
106 virtual void HEAD( const ::rtl::OUString & inPath,
107 const std::vector< ::rtl::OUString > & inHeaderNames,
108 DAVResource & ioResource,
109 const DAVRequestEnvironment & rEnv )
110 throw( DAVException ) = 0;
112 virtual com::sun::star::uno::Reference< com::sun::star::io::XInputStream >
113 GET( const ::rtl::OUString & inPath,
114 const DAVRequestEnvironment & rEnv )
115 throw( DAVException ) = 0;
117 virtual void GET( const ::rtl::OUString & inPath,
118 com::sun::star::uno::Reference<
119 com::sun::star::io::XOutputStream >& o,
120 const DAVRequestEnvironment & rEnv )
121 throw( DAVException ) = 0;
123 virtual com::sun::star::uno::Reference< com::sun::star::io::XInputStream >
124 GET( const ::rtl::OUString & inPath,
125 const std::vector< ::rtl::OUString > & inHeaderNames,
126 DAVResource & ioResource,
127 const DAVRequestEnvironment & rEnv )
128 throw( DAVException ) = 0;
130 virtual void
131 GET( const ::rtl::OUString & inPath,
132 com::sun::star::uno::Reference< com::sun::star::io::XOutputStream >& o,
133 const std::vector< ::rtl::OUString > & inHeaderNames,
134 DAVResource & ioResource,
135 const DAVRequestEnvironment & rEnv )
136 throw( DAVException ) = 0;
138 virtual void PUT( const ::rtl::OUString & inPath,
139 const com::sun::star::uno::Reference<
140 com::sun::star::io::XInputStream >& s,
141 const DAVRequestEnvironment & rEnv )
142 throw( DAVException ) = 0;
144 virtual com::sun::star::uno::Reference< com::sun::star::io::XInputStream >
145 POST( const rtl::OUString & inPath,
146 const rtl::OUString & rContentType,
147 const rtl::OUString & rReferer,
148 const com::sun::star::uno::Reference<
149 com::sun::star::io::XInputStream > & inInputStream,
150 const DAVRequestEnvironment & rEnv )
151 throw ( DAVException ) = 0;
153 virtual void POST( const rtl::OUString & inPath,
154 const rtl::OUString & rContentType,
155 const rtl::OUString & rReferer,
156 const com::sun::star::uno::Reference<
157 com::sun::star::io::XInputStream > & inInputStream,
158 com::sun::star::uno::Reference<
159 com::sun::star::io::XOutputStream > & oOutputStream,
160 const DAVRequestEnvironment & rEnv )
161 throw ( DAVException ) = 0;
163 virtual void MKCOL( const ::rtl::OUString & inPath,
164 const DAVRequestEnvironment & rEnv )
165 throw( DAVException ) = 0;
167 virtual void COPY( const ::rtl::OUString & inSource,
168 const ::rtl::OUString & inDestination,
169 const DAVRequestEnvironment & rEnv,
170 sal_Bool inOverwrite = false )
171 throw( DAVException ) = 0;
173 virtual void MOVE( const ::rtl::OUString & inSource,
174 const ::rtl::OUString & inDestination,
175 const DAVRequestEnvironment & rEnv,
176 sal_Bool inOverwrite = false )
177 throw( DAVException ) = 0;
179 virtual void DESTROY( const ::rtl::OUString & inPath,
180 const DAVRequestEnvironment & rEnv )
181 throw( DAVException ) = 0;
183 // set new lock.
184 virtual void LOCK( const ::rtl::OUString & inPath,
185 com::sun::star::ucb::Lock & inLock,
186 const DAVRequestEnvironment & rEnv )
187 throw ( DAVException ) = 0;
189 // refresh existing lock.
190 virtual sal_Int64 LOCK( const ::rtl::OUString & inPath,
191 sal_Int64 nTimeout,
192 const DAVRequestEnvironment & rEnv )
193 throw ( DAVException ) = 0;
195 virtual void UNLOCK( const ::rtl::OUString & inPath,
196 const DAVRequestEnvironment & rEnv )
197 throw ( DAVException ) = 0;
199 virtual void abort()
200 throw( DAVException ) = 0;
202 protected:
203 rtl::Reference< DAVSessionFactory > m_xFactory;
205 DAVSession( rtl::Reference< DAVSessionFactory > const & rFactory )
206 : m_xFactory( rFactory ), m_nRefCount( 0 ) {}
208 virtual ~DAVSession() {}
210 private:
211 DAVSessionFactory::Map::iterator m_aContainerIt;
212 oslInterlockedCount m_nRefCount;
214 friend class DAVSessionFactory;
215 #if defined WNT && _MSC_VER < 1310
216 friend struct std::auto_ptr< DAVSession >;
217 // work around compiler bug...
218 #else // WNT
219 friend class std::auto_ptr< DAVSession >;
220 #endif // WNT
223 } // namespace webdav_ucp
225 #endif // _DAVSESSION_HXX_
227 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */