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