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 #pragma once
30 
31 #include <config_lgpl.h>
32 #include <memory>
33 #include <rtl/ustring.hxx>
34 #include <com/sun/star/io/XInputStream.hpp>
35 #include <com/sun/star/io/XOutputStream.hpp>
36 #include "DAVProperties.hxx"
37 #include "DAVResource.hxx"
38 #include "DAVSessionFactory.hxx"
39 #include "DAVTypes.hxx"
41 
42 namespace com::sun::star::beans {
43  struct NamedValue;
44 }
45 
46 namespace com::sun::star::ucb {
47  struct Lock;
48 }
49 
50 namespace webdav_ucp
51 {
52 
54 {
55 public:
56  void acquire()
57  {
58  osl_atomic_increment( &m_nRefCount );
59  }
60 
61  void release()
62  {
63  if ( osl_atomic_decrement( &m_nRefCount ) == 0 )
64  {
65  m_xFactory->releaseElement( this );
66  delete this;
67  }
68  }
69 
70  virtual bool CanUse( const OUString & inPath,
71  const css::uno::Sequence< css::beans::NamedValue >& rFlags ) = 0;
72 
73  virtual bool UsesProxy() = 0;
74 
75  // DAV methods
76 
78  virtual void OPTIONS( const OUString & inPath,
79  DAVOptions& rOptions,
80  const DAVRequestEnvironment & rEnv ) = 0;
81 
82  // allprop & named
84  virtual void PROPFIND( const OUString & inPath,
85  const Depth inDepth,
86  const std::vector< OUString > & inPropertyNames,
87  std::vector< DAVResource > & ioResources,
88  const DAVRequestEnvironment & rEnv ) = 0;
89 
90  // propnames
92  virtual void PROPFIND( const OUString & inPath,
93  const Depth inDepth,
94  std::vector< DAVResourceInfo > & ioResInfo,
95  const DAVRequestEnvironment & rEnv ) = 0;
96 
98  virtual void PROPPATCH( const OUString & inPath,
99  const std::vector< ProppatchValue > & inValues,
100  const DAVRequestEnvironment & rEnv ) = 0;
101 
103  virtual void HEAD( const OUString & inPath,
104  const std::vector< OUString > & inHeaderNames,
105  DAVResource & ioResource,
106  const DAVRequestEnvironment & rEnv ) = 0;
107 
109  virtual css::uno::Reference< css::io::XInputStream >
110  GET( const OUString & inPath,
111  const DAVRequestEnvironment & rEnv ) = 0;
112 
114  virtual void GET( const OUString & inPath,
115  css::uno::Reference< css::io::XOutputStream >& o,
116  const DAVRequestEnvironment & rEnv ) = 0;
117 
119  virtual css::uno::Reference< css::io::XInputStream >
120  GET( const OUString & inPath,
121  const std::vector< OUString > & inHeaderNames,
122  DAVResource & ioResource,
123  const DAVRequestEnvironment & rEnv ) = 0;
124 
125  // used as HEAD substitute when HEAD is not implemented on server
127  virtual void
128  GET0( const OUString & inPath,
129  const std::vector< OUString > & inHeaderNames,
130  DAVResource & ioResource,
131  const DAVRequestEnvironment & rEnv ) = 0;
132 
134  virtual void
135  GET( const OUString & inPath,
136  css::uno::Reference< css::io::XOutputStream >& o,
137  const std::vector< OUString > & inHeaderNames,
138  DAVResource & ioResource,
139  const DAVRequestEnvironment & rEnv ) = 0;
140 
142  virtual void PUT( const OUString & inPath,
143  const css::uno::Reference< css::io::XInputStream >& s,
144  const DAVRequestEnvironment & rEnv ) = 0;
145 
147  virtual css::uno::Reference< css::io::XInputStream >
148  POST( const OUString & inPath,
149  const OUString & rContentType,
150  const OUString & rReferer,
151  const css::uno::Reference< css::io::XInputStream > & inInputStream,
152  const DAVRequestEnvironment & rEnv ) = 0;
153 
155  virtual void POST( const OUString & inPath,
156  const OUString & rContentType,
157  const OUString & rReferer,
158  const css::uno::Reference< css::io::XInputStream > & inInputStream,
159  css::uno::Reference< css::io::XOutputStream > & oOutputStream,
160  const DAVRequestEnvironment & rEnv ) = 0;
161 
163  virtual void MKCOL( const OUString & inPath,
164  const DAVRequestEnvironment & rEnv ) = 0;
165 
167  virtual void COPY( const OUString & inSource,
168  const OUString & inDestination,
169  const DAVRequestEnvironment & rEnv,
170  bool inOverwrite ) = 0;
171 
173  virtual void MOVE( const OUString & inSource,
174  const OUString & inDestination,
175  const DAVRequestEnvironment & rEnv,
176  bool inOverwrite ) = 0;
177 
179  virtual void DESTROY( const OUString & inPath,
180  const DAVRequestEnvironment & rEnv ) = 0;
181 
182  // set new lock.
184  virtual void LOCK( const OUString & inPath,
185  css::ucb::Lock & inLock,
186  const DAVRequestEnvironment & rEnv ) = 0;
187 
189  virtual void UNLOCK( const OUString & inPath,
190  const DAVRequestEnvironment & rEnv ) = 0;
191 
193  virtual void abort() = 0;
194 
195 protected:
197 
198  explicit DAVSession( rtl::Reference< DAVSessionFactory > const & rFactory )
199  : m_xFactory( rFactory ), m_nRefCount( 0 ) {}
200 
201  virtual ~DAVSession() {}
202 
203 private:
204  DAVSessionFactory::Map::iterator m_aContainerIt;
205  oslInterlockedCount m_nRefCount;
206 
207  friend class DAVSessionFactory;
208  friend struct std::default_delete< DAVSession >;
209 };
210 
211 } // namespace webdav_ucp
212 
213 /* 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