Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
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.
15 : : *
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).
21 : : *
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.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef _DAVSESSION_HXX_
30 : : #define _DAVSESSION_HXX_
31 : :
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"
42 : :
43 : : namespace com { namespace sun { namespace star { namespace beans {
44 : : struct NamedValue;
45 : : } } } }
46 : :
47 : : namespace com { namespace sun { namespace star { namespace ucb {
48 : : struct Lock;
49 : : } } } }
50 : :
51 : : namespace webdav_ucp
52 : : {
53 : :
54 : : class DAVSession
55 : : {
56 : : public:
57 : 0 : inline void acquire() SAL_THROW(())
58 : : {
59 : 0 : osl_incrementInterlockedCount( &m_nRefCount );
60 : 0 : }
61 : :
62 : 0 : void release() SAL_THROW(())
63 : : {
64 [ # # ]: 0 : if ( osl_decrementInterlockedCount( &m_nRefCount ) == 0 )
65 : : {
66 : 0 : m_xFactory->releaseElement( this );
67 [ # # ]: 0 : delete this;
68 : : }
69 : 0 : }
70 : :
71 : : virtual sal_Bool CanUse( const ::rtl::OUString & inPath,
72 : : const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& rFlags ) = 0;
73 : :
74 : : virtual sal_Bool UsesProxy() = 0;
75 : :
76 : : // DAV methods
77 : : //
78 : :
79 : : virtual void OPTIONS( const ::rtl::OUString & inPath,
80 : : DAVCapabilities & outCapabilities,
81 : : const DAVRequestEnvironment & rEnv )
82 : : throw( DAVException ) = 0;
83 : :
84 : : // allprop & named
85 : : virtual void PROPFIND( const ::rtl::OUString & inPath,
86 : : const Depth inDepth,
87 : : const std::vector< ::rtl::OUString > & inPropertyNames,
88 : : std::vector< DAVResource > & ioResources,
89 : : const DAVRequestEnvironment & rEnv )
90 : : throw( DAVException ) = 0;
91 : :
92 : : // propnames
93 : : virtual void PROPFIND( const ::rtl::OUString & inPath,
94 : : const Depth inDepth,
95 : : std::vector< DAVResourceInfo > & ioResInfo,
96 : : const DAVRequestEnvironment & rEnv )
97 : : throw( DAVException ) = 0;
98 : :
99 : : virtual void PROPPATCH( const ::rtl::OUString & inPath,
100 : : const std::vector< ProppatchValue > & inValues,
101 : : const DAVRequestEnvironment & rEnv )
102 : : throw( DAVException ) = 0;
103 : :
104 : : virtual void HEAD( const ::rtl::OUString & inPath,
105 : : const std::vector< ::rtl::OUString > & inHeaderNames,
106 : : DAVResource & ioResource,
107 : : const DAVRequestEnvironment & rEnv )
108 : : throw( DAVException ) = 0;
109 : :
110 : : virtual com::sun::star::uno::Reference< com::sun::star::io::XInputStream >
111 : : GET( const ::rtl::OUString & inPath,
112 : : const DAVRequestEnvironment & rEnv )
113 : : throw( DAVException ) = 0;
114 : :
115 : : virtual void GET( const ::rtl::OUString & inPath,
116 : : com::sun::star::uno::Reference<
117 : : com::sun::star::io::XOutputStream >& o,
118 : : const DAVRequestEnvironment & rEnv )
119 : : throw( DAVException ) = 0;
120 : :
121 : : virtual com::sun::star::uno::Reference< com::sun::star::io::XInputStream >
122 : : GET( const ::rtl::OUString & inPath,
123 : : const std::vector< ::rtl::OUString > & inHeaderNames,
124 : : DAVResource & ioResource,
125 : : const DAVRequestEnvironment & rEnv )
126 : : throw( DAVException ) = 0;
127 : :
128 : : virtual void
129 : : GET( const ::rtl::OUString & inPath,
130 : : com::sun::star::uno::Reference< com::sun::star::io::XOutputStream >& o,
131 : : const std::vector< ::rtl::OUString > & inHeaderNames,
132 : : DAVResource & ioResource,
133 : : const DAVRequestEnvironment & rEnv )
134 : : throw( DAVException ) = 0;
135 : :
136 : : virtual void PUT( const ::rtl::OUString & inPath,
137 : : const com::sun::star::uno::Reference<
138 : : com::sun::star::io::XInputStream >& s,
139 : : const DAVRequestEnvironment & rEnv )
140 : : throw( DAVException ) = 0;
141 : :
142 : : virtual com::sun::star::uno::Reference< com::sun::star::io::XInputStream >
143 : : POST( const rtl::OUString & inPath,
144 : : const rtl::OUString & rContentType,
145 : : const rtl::OUString & rReferer,
146 : : const com::sun::star::uno::Reference<
147 : : com::sun::star::io::XInputStream > & inInputStream,
148 : : const DAVRequestEnvironment & rEnv )
149 : : throw ( DAVException ) = 0;
150 : :
151 : : virtual void POST( const rtl::OUString & inPath,
152 : : const rtl::OUString & rContentType,
153 : : const rtl::OUString & rReferer,
154 : : const com::sun::star::uno::Reference<
155 : : com::sun::star::io::XInputStream > & inInputStream,
156 : : com::sun::star::uno::Reference<
157 : : com::sun::star::io::XOutputStream > & oOutputStream,
158 : : const DAVRequestEnvironment & rEnv )
159 : : throw ( DAVException ) = 0;
160 : :
161 : : virtual void MKCOL( const ::rtl::OUString & inPath,
162 : : const DAVRequestEnvironment & rEnv )
163 : : throw( DAVException ) = 0;
164 : :
165 : : virtual void COPY( const ::rtl::OUString & inSource,
166 : : const ::rtl::OUString & inDestination,
167 : : const DAVRequestEnvironment & rEnv,
168 : : sal_Bool inOverwrite = false )
169 : : throw( DAVException ) = 0;
170 : :
171 : : virtual void MOVE( const ::rtl::OUString & inSource,
172 : : const ::rtl::OUString & inDestination,
173 : : const DAVRequestEnvironment & rEnv,
174 : : sal_Bool inOverwrite = false )
175 : : throw( DAVException ) = 0;
176 : :
177 : : virtual void DESTROY( const ::rtl::OUString & inPath,
178 : : const DAVRequestEnvironment & rEnv )
179 : : throw( DAVException ) = 0;
180 : :
181 : : // set new lock.
182 : : virtual void LOCK( const ::rtl::OUString & inPath,
183 : : com::sun::star::ucb::Lock & inLock,
184 : : const DAVRequestEnvironment & rEnv )
185 : : throw ( DAVException ) = 0;
186 : :
187 : : // refresh existing lock.
188 : : virtual sal_Int64 LOCK( const ::rtl::OUString & inPath,
189 : : sal_Int64 nTimeout,
190 : : const DAVRequestEnvironment & rEnv )
191 : : throw ( DAVException ) = 0;
192 : :
193 : : virtual void UNLOCK( const ::rtl::OUString & inPath,
194 : : const DAVRequestEnvironment & rEnv )
195 : : throw ( DAVException ) = 0;
196 : :
197 : : virtual void abort()
198 : : throw( DAVException ) = 0;
199 : :
200 : : protected:
201 : : rtl::Reference< DAVSessionFactory > m_xFactory;
202 : :
203 : 0 : DAVSession( rtl::Reference< DAVSessionFactory > const & rFactory )
204 : 0 : : m_xFactory( rFactory ), m_nRefCount( 0 ) {}
205 : :
206 [ # # ]: 0 : virtual ~DAVSession() {}
207 : :
208 : : private:
209 : : DAVSessionFactory::Map::iterator m_aContainerIt;
210 : : oslInterlockedCount m_nRefCount;
211 : :
212 : : friend class DAVSessionFactory;
213 : : #if defined WNT && _MSC_VER < 1310
214 : : friend struct std::auto_ptr< DAVSession >;
215 : : // work around compiler bug...
216 : : #else // WNT
217 : : friend class std::auto_ptr< DAVSession >;
218 : : #endif // WNT
219 : : };
220 : :
221 : : } // namespace webdav_ucp
222 : :
223 : : #endif // _DAVSESSION_HXX_
224 : :
225 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|