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 _DAVRESOURCEACCESS_HXX_
30 : #define _DAVRESOURCEACCESS_HXX_
31 :
32 : #include <config_lgpl.h>
33 : #include <vector>
34 : #include <rtl/ustring.hxx>
35 : #include <rtl/ref.hxx>
36 : #include <osl/mutex.hxx>
37 : #include <com/sun/star/io/XInputStream.hpp>
38 : #include <com/sun/star/io/XOutputStream.hpp>
39 : #include <com/sun/star/beans/NamedValue.hpp>
40 : #include <com/sun/star/ucb/Lock.hpp>
41 : #include <com/sun/star/ucb/WebDAVHTTPMethod.hpp>
42 : #include <com/sun/star/ucb/XCommandEnvironment.hpp>
43 : #include "DAVAuthListener.hxx"
44 : #include "DAVException.hxx"
45 : #include "DAVSession.hxx"
46 : #include "DAVResource.hxx"
47 : #include "DAVTypes.hxx"
48 : #include "NeonUri.hxx"
49 :
50 : namespace webdav_ucp
51 : {
52 :
53 : class DAVSessionFactory;
54 :
55 0 : class DAVResourceAccess
56 : {
57 : osl::Mutex m_aMutex;
58 : OUString m_aURL;
59 : OUString m_aPath;
60 : ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > m_aFlags;
61 : rtl::Reference< DAVSession > m_xSession;
62 : rtl::Reference< DAVSessionFactory > m_xSessionFactory;
63 : com::sun::star::uno::Reference<
64 : com::sun::star::uno::XComponentContext > m_xContext;
65 : std::vector< NeonUri > m_aRedirectURIs;
66 :
67 : public:
68 : DAVResourceAccess() : m_xSessionFactory( 0 ) {}
69 : DAVResourceAccess( const com::sun::star::uno::Reference<
70 : com::sun::star::uno::XComponentContext > & rxContext,
71 : rtl::Reference<
72 : DAVSessionFactory > const & rSessionFactory,
73 : const OUString & rURL );
74 : DAVResourceAccess( const DAVResourceAccess & rOther );
75 :
76 : DAVResourceAccess & operator=( const DAVResourceAccess & rOther );
77 :
78 : void setFlags( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& rFlags )
79 : throw ( DAVException );
80 :
81 : void setURL( const OUString & rNewURL )
82 : throw ( DAVException );
83 :
84 : void resetUri();
85 :
86 0 : const OUString & getURL() const { return m_aURL; }
87 :
88 0 : rtl::Reference< DAVSessionFactory > getSessionFactory() const
89 0 : { return m_xSessionFactory; }
90 :
91 : // DAV methods
92 :
93 :
94 : #if 0 // currently not used, but please don't remove code
95 : void
96 : OPTIONS( DAVCapabilities & rCapabilities,
97 : const com::sun::star::uno::Reference<
98 : com::sun::star::ucb::XCommandEnvironment > & xEnv )
99 : throw ( DAVException );
100 : #endif
101 :
102 : // allprop & named
103 : void
104 : PROPFIND( const Depth nDepth,
105 : const std::vector< OUString > & rPropertyNames,
106 : std::vector< DAVResource > & rResources,
107 : const com::sun::star::uno::Reference<
108 : com::sun::star::ucb::XCommandEnvironment > & xEnv )
109 : throw ( DAVException );
110 :
111 : // propnames
112 : void
113 : PROPFIND( const Depth nDepth,
114 : std::vector< DAVResourceInfo > & rResInfo,
115 : const com::sun::star::uno::Reference<
116 : com::sun::star::ucb::XCommandEnvironment > & xEnv )
117 : throw ( DAVException );
118 :
119 : void
120 : PROPPATCH( const std::vector< ProppatchValue > & rValues,
121 : const com::sun::star::uno::Reference<
122 : com::sun::star::ucb::XCommandEnvironment >& xEnv )
123 : throw ( DAVException );
124 :
125 : void
126 : HEAD( const std::vector< OUString > & rHeaderNames, // empty == 'all'
127 : DAVResource & rResource,
128 : const com::sun::star::uno::Reference<
129 : com::sun::star::ucb::XCommandEnvironment >& xEnv )
130 : throw ( DAVException );
131 :
132 : com::sun::star::uno::Reference< com::sun::star::io::XInputStream >
133 : GET( const com::sun::star::uno::Reference<
134 : com::sun::star::ucb::XCommandEnvironment > & xEnv )
135 : throw ( DAVException );
136 :
137 : void
138 : GET( com::sun::star::uno::Reference<
139 : com::sun::star::io::XOutputStream > & rStream,
140 : const com::sun::star::uno::Reference<
141 : com::sun::star::ucb::XCommandEnvironment > & xEnv )
142 : throw ( DAVException );
143 :
144 : com::sun::star::uno::Reference< com::sun::star::io::XInputStream >
145 : GET( const std::vector< OUString > & rHeaderNames, // empty == 'all'
146 : DAVResource & rResource,
147 : const com::sun::star::uno::Reference<
148 : com::sun::star::ucb::XCommandEnvironment > & xEnv )
149 : throw ( DAVException );
150 :
151 : void
152 : GET( com::sun::star::uno::Reference<
153 : com::sun::star::io::XOutputStream > & rStream,
154 : const std::vector< OUString > & rHeaderNames, // empty == 'all'
155 : DAVResource & rResource,
156 : const com::sun::star::uno::Reference<
157 : com::sun::star::ucb::XCommandEnvironment > & xEnv )
158 : throw ( DAVException );
159 :
160 : void
161 : PUT( const com::sun::star::uno::Reference<
162 : com::sun::star::io::XInputStream > & rStream,
163 : const com::sun::star::uno::Reference<
164 : com::sun::star::ucb::XCommandEnvironment > & xEnv )
165 : throw ( DAVException );
166 :
167 : com::sun::star::uno::Reference< com::sun::star::io::XInputStream >
168 : POST( const OUString & rContentType,
169 : const OUString & rReferer,
170 : const com::sun::star::uno::Reference<
171 : com::sun::star::io::XInputStream > & rInputStream,
172 : const com::sun::star::uno::Reference<
173 : com::sun::star::ucb::XCommandEnvironment >& xEnv )
174 : throw ( DAVException );
175 :
176 : void
177 : POST( const OUString & rContentType,
178 : const OUString & rReferer,
179 : const com::sun::star::uno::Reference<
180 : com::sun::star::io::XInputStream > & rInputStream,
181 : com::sun::star::uno::Reference<
182 : com::sun::star::io::XOutputStream > & rOutputStream,
183 : const com::sun::star::uno::Reference<
184 : com::sun::star::ucb::XCommandEnvironment >& xEnv )
185 : throw ( DAVException );
186 :
187 : void
188 : MKCOL( const com::sun::star::uno::Reference<
189 : com::sun::star::ucb::XCommandEnvironment > & xEnv )
190 : throw ( DAVException );
191 :
192 : void
193 : COPY( const OUString & rSourcePath,
194 : const OUString & rDestinationURI,
195 : sal_Bool bOverwrite,
196 : const com::sun::star::uno::Reference<
197 : com::sun::star::ucb::XCommandEnvironment > & xEnv )
198 : throw ( DAVException );
199 :
200 : void
201 : MOVE( const OUString & rSourcePath,
202 : const OUString & rDestinationURI,
203 : sal_Bool bOverwrite,
204 : const com::sun::star::uno::Reference<
205 : com::sun::star::ucb::XCommandEnvironment > & xEnv )
206 : throw ( DAVException );
207 :
208 : void
209 : DESTROY( const com::sun::star::uno::Reference<
210 : com::sun::star::ucb::XCommandEnvironment > & xEnv )
211 : throw ( DAVException );
212 :
213 : // set new lock.
214 : void
215 : LOCK( com::sun::star::ucb::Lock & inLock,
216 : const com::sun::star::uno::Reference<
217 : com::sun::star::ucb::XCommandEnvironment > & xEnv )
218 : throw( DAVException );
219 :
220 : #if 0 // currently not used, but please don't remove code
221 : // refresh existing lock.
222 : sal_Int64
223 : LOCK( sal_Int64 nTimeout,
224 : const com::sun::star::uno::Reference<
225 : com::sun::star::ucb::XCommandEnvironment > & xEnv )
226 : throw ( DAVException );
227 : #endif
228 :
229 : void
230 : UNLOCK( const com::sun::star::uno::Reference<
231 : com::sun::star::ucb::XCommandEnvironment > & xEnv )
232 : throw ( DAVException );
233 :
234 : void
235 : abort()
236 : throw ( DAVException );
237 :
238 : // helper
239 : static void
240 : getUserRequestHeaders(
241 : const com::sun::star::uno::Reference<
242 : com::sun::star::ucb::XCommandEnvironment > & xEnv,
243 : const OUString & rURI,
244 : com::sun::star::ucb::WebDAVHTTPMethod eMethod,
245 : DAVRequestHeaders & rRequestHeaders );
246 :
247 : private:
248 : const OUString & getRequestURI() const;
249 : sal_Bool detectRedirectCycle( const OUString& rRedirectURL )
250 : throw ( DAVException );
251 : sal_Bool handleException( const DAVException & e, int errorCount )
252 : throw ( DAVException );
253 : void initialize()
254 : throw ( DAVException );
255 : };
256 :
257 : } // namespace webdav_ucp
258 :
259 : #endif // _DAVRESOURCEACCESS_HXX_
260 :
261 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|