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 INCLUDED_UCB_SOURCE_UCP_WEBDAV_NEON_DAVSESSION_HXX
30 : #define INCLUDED_UCB_SOURCE_UCP_WEBDAV_NEON_DAVSESSION_HXX
31 :
32 : #include <config_lgpl.h>
33 : #include <memory>
34 : #include <rtl/ustring.hxx>
35 : #include <com/sun/star/io/XInputStream.hpp>
36 : #include <com/sun/star/io/XOutputStream.hpp>
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()
58 : {
59 0 : osl_atomic_increment( &m_nRefCount );
60 0 : }
61 :
62 0 : void release()
63 : {
64 0 : if ( osl_atomic_decrement( &m_nRefCount ) == 0 )
65 : {
66 0 : m_xFactory->releaseElement( this );
67 0 : delete this;
68 : }
69 0 : }
70 :
71 : virtual bool CanUse( const OUString & inPath,
72 : const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& rFlags ) = 0;
73 :
74 : virtual bool UsesProxy() = 0;
75 :
76 : // DAV methods
77 :
78 :
79 : virtual void OPTIONS( const OUString & inPath,
80 : DAVCapabilities & outCapabilities,
81 : const DAVRequestEnvironment & rEnv )
82 : throw( std::exception ) = 0;
83 :
84 : // allprop & named
85 : virtual void PROPFIND( const OUString & inPath,
86 : const Depth inDepth,
87 : const std::vector< OUString > & inPropertyNames,
88 : std::vector< DAVResource > & ioResources,
89 : const DAVRequestEnvironment & rEnv )
90 : throw( std::exception ) = 0;
91 :
92 : // propnames
93 : virtual void PROPFIND( const OUString & inPath,
94 : const Depth inDepth,
95 : std::vector< DAVResourceInfo > & ioResInfo,
96 : const DAVRequestEnvironment & rEnv )
97 : throw( std::exception ) = 0;
98 :
99 : virtual void PROPPATCH( const OUString & inPath,
100 : const std::vector< ProppatchValue > & inValues,
101 : const DAVRequestEnvironment & rEnv )
102 : throw( std::exception ) = 0;
103 :
104 : virtual void HEAD( const OUString & inPath,
105 : const std::vector< OUString > & inHeaderNames,
106 : DAVResource & ioResource,
107 : const DAVRequestEnvironment & rEnv )
108 : throw( std::exception ) = 0;
109 :
110 : virtual com::sun::star::uno::Reference< com::sun::star::io::XInputStream >
111 : GET( const OUString & inPath,
112 : const DAVRequestEnvironment & rEnv )
113 : throw( std::exception ) = 0;
114 :
115 : virtual void GET( const OUString & inPath,
116 : com::sun::star::uno::Reference<
117 : com::sun::star::io::XOutputStream >& o,
118 : const DAVRequestEnvironment & rEnv )
119 : throw( std::exception ) = 0;
120 :
121 : virtual com::sun::star::uno::Reference< com::sun::star::io::XInputStream >
122 : GET( const OUString & inPath,
123 : const std::vector< OUString > & inHeaderNames,
124 : DAVResource & ioResource,
125 : const DAVRequestEnvironment & rEnv )
126 : throw( std::exception ) = 0;
127 :
128 : virtual void
129 : GET( const OUString & inPath,
130 : com::sun::star::uno::Reference< com::sun::star::io::XOutputStream >& o,
131 : const std::vector< OUString > & inHeaderNames,
132 : DAVResource & ioResource,
133 : const DAVRequestEnvironment & rEnv )
134 : throw( std::exception ) = 0;
135 :
136 : virtual void PUT( const OUString & inPath,
137 : const com::sun::star::uno::Reference<
138 : com::sun::star::io::XInputStream >& s,
139 : const DAVRequestEnvironment & rEnv )
140 : throw( std::exception ) = 0;
141 :
142 : virtual com::sun::star::uno::Reference< com::sun::star::io::XInputStream >
143 : POST( const OUString & inPath,
144 : const OUString & rContentType,
145 : const OUString & rReferer,
146 : const com::sun::star::uno::Reference<
147 : com::sun::star::io::XInputStream > & inInputStream,
148 : const DAVRequestEnvironment & rEnv )
149 : throw ( std::exception ) = 0;
150 :
151 : virtual void POST( const OUString & inPath,
152 : const OUString & rContentType,
153 : const 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 ( std::exception ) = 0;
160 :
161 : virtual void MKCOL( const OUString & inPath,
162 : const DAVRequestEnvironment & rEnv )
163 : throw( std::exception ) = 0;
164 :
165 : virtual void COPY( const OUString & inSource,
166 : const OUString & inDestination,
167 : const DAVRequestEnvironment & rEnv,
168 : bool inOverwrite = false )
169 : throw( std::exception ) = 0;
170 :
171 : virtual void MOVE( const OUString & inSource,
172 : const OUString & inDestination,
173 : const DAVRequestEnvironment & rEnv,
174 : bool inOverwrite = false )
175 : throw( std::exception ) = 0;
176 :
177 : virtual void DESTROY( const OUString & inPath,
178 : const DAVRequestEnvironment & rEnv )
179 : throw( std::exception ) = 0;
180 :
181 : // set new lock.
182 : virtual void LOCK( const OUString & inPath,
183 : com::sun::star::ucb::Lock & inLock,
184 : const DAVRequestEnvironment & rEnv )
185 : throw ( std::exception ) = 0;
186 :
187 : // refresh existing lock.
188 : virtual sal_Int64 LOCK( const OUString & inPath,
189 : sal_Int64 nTimeout,
190 : const DAVRequestEnvironment & rEnv )
191 : throw ( std::exception ) = 0;
192 :
193 : virtual void UNLOCK( const OUString & inPath,
194 : const DAVRequestEnvironment & rEnv )
195 : throw ( std::exception ) = 0;
196 :
197 : virtual void abort()
198 : throw( std::exception ) = 0;
199 :
200 : protected:
201 : rtl::Reference< DAVSessionFactory > m_xFactory;
202 :
203 0 : explicit 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 : friend struct std::default_delete< DAVSession >;
214 : };
215 :
216 : } // namespace webdav_ucp
217 :
218 : #endif // INCLUDED_UCB_SOURCE_UCP_WEBDAV_NEON_DAVSESSION_HXX
219 :
220 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|