1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: DAVResourceAccess.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _DAVRESOURCEACCESS_HXX_
32 #define _DAVRESOURCEACCESS_HXX_
35 #include <rtl/ustring.hxx>
36 #include <rtl/ref.hxx>
37 #include <osl/mutex.hxx>
38 #include <com/sun/star/io/XInputStream.hpp>
39 #include <com/sun/star/io/XOutputStream.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"
52 class DAVSessionFactory
;
54 class DAVResourceAccess
58 rtl::OUString m_aPath
;
59 rtl::Reference
< DAVSession
> m_xSession
;
60 rtl::Reference
< DAVSessionFactory
> m_xSessionFactory
;
61 com::sun::star::uno::Reference
<
62 com::sun::star::lang::XMultiServiceFactory
> m_xSMgr
;
63 std::vector
< NeonUri
> m_aRedirectURIs
;
66 DAVResourceAccess() : m_xSessionFactory( 0 ) {}
67 DAVResourceAccess( const com::sun::star::uno::Reference
<
68 com::sun::star::lang::XMultiServiceFactory
> & rSMgr
,
70 DAVSessionFactory
> const & rSessionFactory
,
71 const rtl::OUString
& rURL
);
72 DAVResourceAccess( const DAVResourceAccess
& rOther
);
74 DAVResourceAccess
& operator=( const DAVResourceAccess
& rOther
);
76 void setURL( const rtl::OUString
& rNewURL
)
77 throw( DAVException
);
81 const rtl::OUString
& getURL() const { return m_aURL
; }
83 rtl::Reference
< DAVSessionFactory
> getSessionFactory() const
84 { return m_xSessionFactory
; }
90 OPTIONS( DAVCapabilities
& rCapabilities
,
91 const com::sun::star::uno::Reference
<
92 com::sun::star::ucb::XCommandEnvironment
> & xEnv
)
93 throw( DAVException
);
97 PROPFIND( const Depth nDepth
,
98 const std::vector
< rtl::OUString
> & rPropertyNames
,
99 std::vector
< DAVResource
> & rResources
,
100 const com::sun::star::uno::Reference
<
101 com::sun::star::ucb::XCommandEnvironment
> & xEnv
)
102 throw( DAVException
);
106 PROPFIND( const Depth nDepth
,
107 std::vector
< DAVResourceInfo
> & rResInfo
,
108 const com::sun::star::uno::Reference
<
109 com::sun::star::ucb::XCommandEnvironment
> & xEnv
)
110 throw( DAVException
);
113 PROPPATCH( const std::vector
< ProppatchValue
> & rValues
,
114 const com::sun::star::uno::Reference
<
115 com::sun::star::ucb::XCommandEnvironment
>& xEnv
)
116 throw( DAVException
);
119 HEAD( const std::vector
< rtl::OUString
> & rHeaderNames
, // empty == 'all'
120 DAVResource
& rResource
,
121 const com::sun::star::uno::Reference
<
122 com::sun::star::ucb::XCommandEnvironment
>& xEnv
)
123 throw( DAVException
);
125 com::sun::star::uno::Reference
< com::sun::star::io::XInputStream
>
126 GET( const com::sun::star::uno::Reference
<
127 com::sun::star::ucb::XCommandEnvironment
> & xEnv
)
128 throw( DAVException
);
131 GET( com::sun::star::uno::Reference
<
132 com::sun::star::io::XOutputStream
> & rStream
,
133 const com::sun::star::uno::Reference
<
134 com::sun::star::ucb::XCommandEnvironment
> & xEnv
)
135 throw( DAVException
);
137 com::sun::star::uno::Reference
< com::sun::star::io::XStream
>
138 GET( const std::vector
< rtl::OUString
> & rHeaderNames
, // empty == 'all'
139 DAVResource
& rResource
,
140 const com::sun::star::uno::Reference
<
141 com::sun::star::ucb::XCommandEnvironment
> & xEnv
,
142 sal_Bool bAllowEmpty
= sal_False
)
143 throw( DAVException
);
146 GET( com::sun::star::uno::Reference
<
147 com::sun::star::io::XOutputStream
> & rStream
,
148 const std::vector
< rtl::OUString
> & rHeaderNames
, // empty == 'all'
149 DAVResource
& rResource
,
150 const com::sun::star::uno::Reference
<
151 com::sun::star::ucb::XCommandEnvironment
> & xEnv
)
152 throw( DAVException
);
155 PUT( const com::sun::star::uno::Reference
<
156 com::sun::star::io::XInputStream
> & rStream
,
157 const com::sun::star::uno::Reference
<
158 com::sun::star::ucb::XCommandEnvironment
> & xEnv
)
159 throw( DAVException
);
162 PUT( const char * buffer
, size_t size
,
163 const com::sun::star::uno::Reference
< com::sun::star::ucb::XCommandEnvironment
> & xEnv
)
164 throw( DAVException
);
166 com::sun::star::uno::Reference
< com::sun::star::io::XInputStream
>
167 POST( const rtl::OUString
& rContentType
,
168 const rtl::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
);
176 POST( const rtl::OUString
& rContentType
,
177 const rtl::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
);
187 MKCOL( const com::sun::star::uno::Reference
<
188 com::sun::star::ucb::XCommandEnvironment
> & xEnv
)
189 throw( DAVException
);
192 COPY( const ::rtl::OUString
& rSourcePath
,
193 const ::rtl::OUString
& rDestinationURI
,
195 const com::sun::star::uno::Reference
<
196 com::sun::star::ucb::XCommandEnvironment
> & xEnv
)
197 throw( DAVException
);
200 MOVE( const ::rtl::OUString
& rSourcePath
,
201 const ::rtl::OUString
& rDestinationURI
,
203 const com::sun::star::uno::Reference
<
204 com::sun::star::ucb::XCommandEnvironment
> & xEnv
)
205 throw( DAVException
);
208 DESTROY( const com::sun::star::uno::Reference
<
209 com::sun::star::ucb::XCommandEnvironment
> & xEnv
)
210 throw( DAVException
);
213 LOCK( com::sun::star::ucb::Lock
& rLock
,
214 const com::sun::star::uno::Reference
<
215 com::sun::star::ucb::XCommandEnvironment
> & xEnv
)
216 throw( DAVException
);
219 UNLOCK( com::sun::star::ucb::Lock
& rLock
,
220 const com::sun::star::uno::Reference
<
221 com::sun::star::ucb::XCommandEnvironment
> & xEnv
)
222 throw( DAVException
);
226 throw( DAVException
);
229 static void getUserRequestHeaders(
230 const com::sun::star::uno::Reference
<
231 com::sun::star::ucb::XCommandEnvironment
> & xEnv
,
232 const rtl::OUString
& rURI
,
233 const rtl::OUString
& rMethod
,
234 DAVRequestHeaders
& rRequestHeaders
);
236 static com::sun::star::uno::Reference
< com::sun::star::ucb::XCommandEnvironment
> createCommandEnvironment( void );
239 const rtl::OUString
& getRequestURI() const;
240 sal_Bool
detectRedirectCycle( const rtl::OUString
& rRedirectURL
)
241 throw ( DAVException
);
242 sal_Bool
handleException( DAVException
& e
, int errorCount
)
243 throw ( DAVException
);
245 throw ( DAVException
);
248 } // namespace webdav_ucp
250 #endif // _DAVRESOURCEACCESS_HXX_