bump product version to 5.0.4.1
[LibreOffice.git] / ucb / source / ucp / webdav-neon / DAVSession.hxx
blobc75ce7ecf98ad2207f3fa0aba841620d6c0c631a
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
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.
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).
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.
27 ************************************************************************/
29 #ifndef INCLUDED_UCB_SOURCE_UCP_WEBDAV_NEON_DAVSESSION_HXX
30 #define INCLUDED_UCB_SOURCE_UCP_WEBDAV_NEON_DAVSESSION_HXX
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"
43 namespace com { namespace sun { namespace star { namespace beans {
44 struct NamedValue;
45 } } } }
47 namespace com { namespace sun { namespace star { namespace ucb {
48 struct Lock;
49 } } } }
51 namespace webdav_ucp
54 class DAVSession
56 public:
57 inline void acquire()
59 osl_atomic_increment( &m_nRefCount );
62 void release()
64 if ( osl_atomic_decrement( &m_nRefCount ) == 0 )
66 m_xFactory->releaseElement( this );
67 delete this;
71 virtual bool CanUse( const OUString & inPath,
72 const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& rFlags ) = 0;
74 virtual bool UsesProxy() = 0;
76 // DAV methods
79 virtual void OPTIONS( const OUString & inPath,
80 DAVCapabilities & outCapabilities,
81 const DAVRequestEnvironment & rEnv )
82 throw( std::exception ) = 0;
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;
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;
99 virtual void PROPPATCH( const OUString & inPath,
100 const std::vector< ProppatchValue > & inValues,
101 const DAVRequestEnvironment & rEnv )
102 throw( std::exception ) = 0;
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;
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;
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;
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;
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;
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;
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;
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;
161 virtual void MKCOL( const OUString & inPath,
162 const DAVRequestEnvironment & rEnv )
163 throw( std::exception ) = 0;
165 virtual void COPY( const OUString & inSource,
166 const OUString & inDestination,
167 const DAVRequestEnvironment & rEnv,
168 bool inOverwrite = false )
169 throw( std::exception ) = 0;
171 virtual void MOVE( const OUString & inSource,
172 const OUString & inDestination,
173 const DAVRequestEnvironment & rEnv,
174 bool inOverwrite = false )
175 throw( std::exception ) = 0;
177 virtual void DESTROY( const OUString & inPath,
178 const DAVRequestEnvironment & rEnv )
179 throw( std::exception ) = 0;
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;
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;
193 virtual void UNLOCK( const OUString & inPath,
194 const DAVRequestEnvironment & rEnv )
195 throw ( std::exception ) = 0;
197 virtual void abort()
198 throw( std::exception ) = 0;
200 protected:
201 rtl::Reference< DAVSessionFactory > m_xFactory;
203 DAVSession( rtl::Reference< DAVSessionFactory > const & rFactory )
204 : m_xFactory( rFactory ), m_nRefCount( 0 ) {}
206 virtual ~DAVSession() {}
208 private:
209 DAVSessionFactory::Map::iterator m_aContainerIt;
210 oslInterlockedCount m_nRefCount;
212 friend class DAVSessionFactory;
213 friend struct std::default_delete< DAVSession >;
216 } // namespace webdav_ucp
218 #endif // INCLUDED_UCB_SOURCE_UCP_WEBDAV_NEON_DAVSESSION_HXX
220 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */