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