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: DAVSession.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 _DAVSESSION_HXX_
32 #define _DAVSESSION_HXX_
35 #include <rtl/ustring.hxx>
36 #include <com/sun/star/io/XStream.hpp>
37 #include <com/sun/star/io/XInputStream.hpp>
38 #include <com/sun/star/io/XOutputStream.hpp>
39 #include <com/sun/star/ucb/Lock.hpp>
41 #include "DAVException.hxx"
42 #include "DAVProperties.hxx"
43 #include "DAVResource.hxx"
44 #include "DAVSessionFactory.hxx"
45 #include "DAVTypes.hxx"
46 #include "DAVRequestEnvironment.hxx"
51 class DAVAuthListener
;
56 inline void acquire() SAL_THROW(())
58 osl_incrementInterlockedCount( &m_nRefCount
);
61 void release() SAL_THROW(())
63 if ( osl_decrementInterlockedCount( &m_nRefCount
) == 0 )
65 m_xFactory
->releaseElement( this );
70 virtual sal_Bool
CanUse( const ::rtl::OUString
& inPath
) = 0;
72 virtual sal_Bool
UsesProxy() = 0;
77 virtual void OPTIONS( const ::rtl::OUString
& inPath
,
78 DAVCapabilities
& outCapabilities
,
79 const DAVRequestEnvironment
& rEnv
)
80 throw( DAVException
) = 0;
83 virtual void PROPFIND( const ::rtl::OUString
& inPath
,
85 const std::vector
< ::rtl::OUString
> & inPropertyNames
,
86 std::vector
< DAVResource
> & ioResources
,
87 const DAVRequestEnvironment
& rEnv
)
88 throw( DAVException
) = 0;
91 virtual void PROPFIND( const ::rtl::OUString
& inPath
,
93 std::vector
< DAVResourceInfo
> & ioResInfo
,
94 const DAVRequestEnvironment
& rEnv
)
95 throw( DAVException
) = 0;
97 virtual void PROPPATCH( const ::rtl::OUString
& inPath
,
98 const std::vector
< ProppatchValue
> & inValues
,
99 const DAVRequestEnvironment
& rEnv
)
100 throw( DAVException
) = 0;
102 virtual void HEAD( const ::rtl::OUString
& inPath
,
103 const std::vector
< ::rtl::OUString
> & inHeaderNames
,
104 DAVResource
& ioResource
,
105 const DAVRequestEnvironment
& rEnv
)
106 throw( DAVException
) = 0;
108 virtual com::sun::star::uno::Reference
< com::sun::star::io::XInputStream
>
109 GET( const ::rtl::OUString
& inPath
,
110 const DAVRequestEnvironment
& rEnv
)
111 throw( DAVException
) = 0;
113 virtual void GET( const ::rtl::OUString
& inPath
,
114 com::sun::star::uno::Reference
< com::sun::star::io::XOutputStream
>& o
,
115 const DAVRequestEnvironment
& rEnv
)
116 throw( DAVException
) = 0;
118 virtual com::sun::star::uno::Reference
< com::sun::star::io::XStream
>
119 GET( const ::rtl::OUString
& inPath
,
120 const std::vector
< ::rtl::OUString
> & inHeaderNames
,
121 DAVResource
& ioResource
,
122 const DAVRequestEnvironment
& rEnv
,
123 sal_Bool bAllowEmpty
)
124 throw( DAVException
) = 0;
126 virtual void GET( const ::rtl::OUString
& inPath
,
127 com::sun::star::uno::Reference
< com::sun::star::io::XOutputStream
>& o
,
128 const std::vector
< ::rtl::OUString
> & inHeaderNames
,
129 DAVResource
& ioResource
,
130 const DAVRequestEnvironment
& rEnv
)
131 throw( DAVException
) = 0;
133 virtual void PUT( const ::rtl::OUString
& inPath
,
134 const com::sun::star::uno::Reference
<
135 com::sun::star::io::XInputStream
>& s
,
136 const DAVRequestEnvironment
& rEnv
)
137 throw( DAVException
) = 0;
140 throw( DAVException
) = 0;
142 virtual void PUT( const ::rtl::OUString
& inPath
,
145 const DAVRequestEnvironment
& rEnv
)
146 throw ( DAVException
) = 0;
148 virtual com::sun::star::uno::Reference
< com::sun::star::io::XInputStream
>
149 POST( const rtl::OUString
& inPath
,
150 const rtl::OUString
& rContentType
,
151 const rtl::OUString
& rReferer
,
152 const com::sun::star::uno::Reference
<
153 com::sun::star::io::XInputStream
> & inInputStream
,
154 const DAVRequestEnvironment
& rEnv
)
155 throw ( DAVException
) = 0;
157 virtual void POST( const rtl::OUString
& inPath
,
158 const rtl::OUString
& rContentType
,
159 const rtl::OUString
& rReferer
,
160 const com::sun::star::uno::Reference
<
161 com::sun::star::io::XInputStream
> & inInputStream
,
162 com::sun::star::uno::Reference
<
163 com::sun::star::io::XOutputStream
> & oOutputStream
,
164 const DAVRequestEnvironment
& rEnv
)
165 throw ( DAVException
) = 0;
167 virtual void MKCOL( const ::rtl::OUString
& inPath
,
168 const DAVRequestEnvironment
& rEnv
)
169 throw( DAVException
) = 0;
171 virtual void COPY( const ::rtl::OUString
& inSource
,
172 const ::rtl::OUString
& inDestination
,
173 const DAVRequestEnvironment
& rEnv
,
174 sal_Bool inOverwrite
= false )
175 throw( DAVException
) = 0;
177 virtual void MOVE( const ::rtl::OUString
& inSource
,
178 const ::rtl::OUString
& inDestination
,
179 const DAVRequestEnvironment
& rEnv
,
180 sal_Bool inOverwrite
= false )
181 throw( DAVException
) = 0;
183 virtual void DESTROY( const ::rtl::OUString
& inPath
,
184 const DAVRequestEnvironment
& rEnv
)
185 throw( DAVException
) = 0;
187 virtual void LOCK ( com::sun::star::ucb::Lock
& rLock
,
188 const DAVRequestEnvironment
& rEnv
)
189 throw( DAVException
) = 0;
191 virtual void UNLOCK ( com::sun::star::ucb::Lock
& rLock
,
192 const DAVRequestEnvironment
& rEnv
)
193 throw( DAVException
) = 0;
196 rtl::Reference
< DAVSessionFactory
> m_xFactory
;
198 DAVSession( rtl::Reference
< DAVSessionFactory
> const & rFactory
)
199 : m_xFactory( rFactory
), m_nRefCount( 0 ) {}
201 virtual ~DAVSession() {}
204 DAVSessionFactory::Map::iterator m_aContainerIt
;
205 oslInterlockedCount m_nRefCount
;
207 friend class DAVSessionFactory
;
208 #if defined WNT && _MSC_VER < 1310
209 friend struct std::auto_ptr
< DAVSession
>;
210 // work around compiler bug...
212 friend class std::auto_ptr
< DAVSession
>;
216 } // namespace webdav_ucp
218 #endif // _DAVSESSION_HXX_