LibreOffice Module ucb (master)  1
neon/DAVSession.hxx
Go to the documentation of this file.
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"
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 
55 {
56 public:
57  void acquire()
58  {
59  osl_atomic_increment( &m_nRefCount );
60  }
61 
62  void release()
63  {
64  if ( osl_atomic_decrement( &m_nRefCount ) == 0 )
65  {
66  m_xFactory->releaseElement( this );
67  delete this;
68  }
69  }
70 
71  virtual bool CanUse( const OUString & inPath,
72  const css::uno::Sequence< css::beans::NamedValue >& rFlags ) = 0;
73 
74  virtual bool UsesProxy() = 0;
75 
76  // DAV methods
77 
79  virtual void OPTIONS( const OUString & inPath,
80  DAVOptions& rOptions,
81  const DAVRequestEnvironment & rEnv ) = 0;
82 
83  // 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 ) = 0;
90 
91  // propnames
93  virtual void PROPFIND( const OUString & inPath,
94  const Depth inDepth,
95  std::vector< DAVResourceInfo > & ioResInfo,
96  const DAVRequestEnvironment & rEnv ) = 0;
97 
99  virtual void PROPPATCH( const OUString & inPath,
100  const std::vector< ProppatchValue > & inValues,
101  const DAVRequestEnvironment & rEnv ) = 0;
102 
104  virtual void HEAD( const OUString & inPath,
105  const std::vector< OUString > & inHeaderNames,
106  DAVResource & ioResource,
107  const DAVRequestEnvironment & rEnv ) = 0;
108 
110  virtual css::uno::Reference< css::io::XInputStream >
111  GET( const OUString & inPath,
112  const DAVRequestEnvironment & rEnv ) = 0;
113 
115  virtual void GET( const OUString & inPath,
116  css::uno::Reference< css::io::XOutputStream >& o,
117  const DAVRequestEnvironment & rEnv ) = 0;
118 
120  virtual css::uno::Reference< css::io::XInputStream >
121  GET( const OUString & inPath,
122  const std::vector< OUString > & inHeaderNames,
123  DAVResource & ioResource,
124  const DAVRequestEnvironment & rEnv ) = 0;
125 
126  // used as HEAD substitute when HEAD is not implemented on server
128  virtual void
129  GET0( const OUString & inPath,
130  const std::vector< OUString > & inHeaderNames,
131  DAVResource & ioResource,
132  const DAVRequestEnvironment & rEnv ) = 0;
133 
135  virtual void
136  GET( const OUString & inPath,
137  css::uno::Reference< css::io::XOutputStream >& o,
138  const std::vector< OUString > & inHeaderNames,
139  DAVResource & ioResource,
140  const DAVRequestEnvironment & rEnv ) = 0;
141 
143  virtual void PUT( const OUString & inPath,
144  const css::uno::Reference< css::io::XInputStream >& s,
145  const DAVRequestEnvironment & rEnv ) = 0;
146 
148  virtual css::uno::Reference< css::io::XInputStream >
149  POST( const OUString & inPath,
150  const OUString & rContentType,
151  const OUString & rReferer,
152  const css::uno::Reference< css::io::XInputStream > & inInputStream,
153  const DAVRequestEnvironment & rEnv ) = 0;
154 
156  virtual void POST( const OUString & inPath,
157  const OUString & rContentType,
158  const OUString & rReferer,
159  const css::uno::Reference< css::io::XInputStream > & inInputStream,
160  css::uno::Reference< css::io::XOutputStream > & oOutputStream,
161  const DAVRequestEnvironment & rEnv ) = 0;
162 
164  virtual void MKCOL( const OUString & inPath,
165  const DAVRequestEnvironment & rEnv ) = 0;
166 
168  virtual void COPY( const OUString & inSource,
169  const OUString & inDestination,
170  const DAVRequestEnvironment & rEnv,
171  bool inOverwrite ) = 0;
172 
174  virtual void MOVE( const OUString & inSource,
175  const OUString & inDestination,
176  const DAVRequestEnvironment & rEnv,
177  bool inOverwrite ) = 0;
178 
180  virtual void DESTROY( const OUString & inPath,
181  const DAVRequestEnvironment & rEnv ) = 0;
182 
183  // set new lock.
185  virtual void LOCK( const OUString & inPath,
186  css::ucb::Lock & inLock,
187  const DAVRequestEnvironment & rEnv ) = 0;
188 
190  virtual void UNLOCK( const OUString & inPath,
191  const DAVRequestEnvironment & rEnv ) = 0;
192 
194  virtual void abort() = 0;
195 
196 protected:
198 
199  explicit DAVSession( rtl::Reference< DAVSessionFactory > const & rFactory )
200  : m_xFactory( rFactory ), m_nRefCount( 0 ) {}
201 
202  virtual ~DAVSession() {}
203 
204 private:
205  DAVSessionFactory::Map::iterator m_aContainerIt;
206  oslInterlockedCount m_nRefCount;
207 
208  friend class DAVSessionFactory;
209  friend struct std::default_delete< DAVSession >;
210 };
211 
212 } // namespace webdav_ucp
213 
214 #endif // INCLUDED_UCB_SOURCE_UCP_WEBDAV_NEON_DAVSESSION_HXX
215 
216 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void DESTROY(const OUString &inPath, const DAVRequestEnvironment &rEnv)=0
virtual void PROPFIND(const OUString &inPath, const Depth inDepth, const std::vector< OUString > &inPropertyNames, std::vector< DAVResource > &ioResources, const DAVRequestEnvironment &rEnv)=0
virtual void HEAD(const OUString &inPath, const std::vector< OUString > &inHeaderNames, DAVResource &ioResource, const DAVRequestEnvironment &rEnv)=0
oslInterlockedCount m_nRefCount
virtual void PUT(const OUString &inPath, const css::uno::Reference< css::io::XInputStream > &s, const DAVRequestEnvironment &rEnv)=0
virtual void OPTIONS(const OUString &inPath, DAVOptions &rOptions, const DAVRequestEnvironment &rEnv)=0
DAVSessionFactory::Map::iterator m_aContainerIt
virtual void UNLOCK(const OUString &inPath, const DAVRequestEnvironment &rEnv)=0
virtual void MKCOL(const OUString &inPath, const DAVRequestEnvironment &rEnv)=0
virtual void PROPPATCH(const OUString &inPath, const std::vector< ProppatchValue > &inValues, const DAVRequestEnvironment &rEnv)=0
virtual void COPY(const OUString &inSource, const OUString &inDestination, const DAVRequestEnvironment &rEnv, bool inOverwrite)=0
virtual css::uno::Reference< css::io::XInputStream > GET(const OUString &inPath, const DAVRequestEnvironment &rEnv)=0
virtual void abort()=0
virtual void LOCK(const OUString &inPath, css::ucb::Lock &inLock, const DAVRequestEnvironment &rEnv)=0
virtual css::uno::Reference< css::io::XInputStream > POST(const OUString &inPath, const OUString &rContentType, const OUString &rReferer, const css::uno::Reference< css::io::XInputStream > &inInputStream, const DAVRequestEnvironment &rEnv)=0
DAVSession(rtl::Reference< DAVSessionFactory > const &rFactory)
virtual void MOVE(const OUString &inSource, const OUString &inDestination, const DAVRequestEnvironment &rEnv, bool inOverwrite)=0
virtual bool CanUse(const OUString &inPath, const css::uno::Sequence< css::beans::NamedValue > &rFlags)=0
virtual bool UsesProxy()=0
rtl::Reference< DAVSessionFactory > m_xFactory
virtual void GET0(const OUString &inPath, const std::vector< OUString > &inHeaderNames, DAVResource &ioResource, const DAVRequestEnvironment &rEnv)=0