LibreOffice Module ucb (master)  1
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  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 
21 #pragma once
22 
23 #include <memory>
24 #include <rtl/ustring.hxx>
25 #include <com/sun/star/io/XInputStream.hpp>
26 #include <com/sun/star/io/XOutputStream.hpp>
27 #include "DAVResource.hxx"
28 #include "DAVSessionFactory.hxx"
29 #include "DAVTypes.hxx"
31 
32 namespace com::sun::star::ucb {
33  struct Lock;
34 }
35 
36 namespace http_dav_ucp
37 {
38 
39 class DAVAuthListener;
40 
42 {
43 public:
44  void acquire()
45  {
46  osl_atomic_increment( &m_nRefCount );
47  }
48 
49  void release()
50  {
51  if ( osl_atomic_decrement( &m_nRefCount ) == 0 )
52  {
53  m_xFactory->releaseElement( this );
54  delete this;
55  }
56  }
57 
58  virtual bool CanUse( const OUString & inPath ) = 0;
59 
60  virtual bool UsesProxy() = 0;
61 
62  // DAV methods
63 
64 
65  // NOT USED
66  /*
67  virtual void OPTIONS( const OUString & inPath,
68  DAVCapabilities & outCapabilities,
69  const DAVRequestEnvironment & rEnv )
70  throw( DAVException ) = 0;
71  */
72 
73  // allprop & named
75  virtual void PROPFIND( const OUString & inPath,
76  const Depth inDepth,
77  const std::vector< OUString > & inPropertyNames,
78  std::vector< DAVResource > & ioResources,
79  const DAVRequestEnvironment & rEnv ) = 0;
80 
81  // propnames
83  virtual void PROPFIND( const OUString & inPath,
84  const Depth inDepth,
85  std::vector< DAVResourceInfo > & ioResInfo,
86  const DAVRequestEnvironment & rEnv ) = 0;
87 
89  virtual void PROPPATCH( const OUString & inPath,
90  const std::vector< ProppatchValue > & inValues,
91  const DAVRequestEnvironment & rEnv ) = 0;
92 
94  virtual void HEAD( const OUString & inPath,
95  const std::vector< OUString > & inHeaderNames,
96  DAVResource & ioResource,
97  const DAVRequestEnvironment & rEnv ) = 0;
98 
100  virtual css::uno::Reference< css::io::XInputStream >
101  GET( const OUString & inPath,
102  const DAVRequestEnvironment & rEnv ) = 0;
103 
105  virtual void GET( const OUString & inPath,
106  css::uno::Reference< css::io::XOutputStream >& o,
107  const DAVRequestEnvironment & rEnv ) = 0;
108 
110  virtual css::uno::Reference< css::io::XInputStream >
111  GET( const OUString & inPath,
112  const std::vector< OUString > & inHeaderNames,
113  DAVResource & ioResource,
114  const DAVRequestEnvironment & rEnv ) = 0;
115 
117  virtual void
118  GET( const OUString & inPath,
119  css::uno::Reference< css::io::XOutputStream >& o,
120  const std::vector< OUString > & inHeaderNames,
121  DAVResource & ioResource,
122  const DAVRequestEnvironment & rEnv ) = 0;
123 
125  virtual void PUT( const OUString & inPath,
126  const css::uno::Reference< css::io::XInputStream >& s,
127  const DAVRequestEnvironment & rEnv ) = 0;
128 
130  virtual css::uno::Reference< css::io::XInputStream >
131  POST( const OUString & inPath,
132  const OUString & rContentType,
133  const OUString & rReferer,
134  const css::uno::Reference< css::io::XInputStream > & inInputStream,
135  const DAVRequestEnvironment & rEnv ) = 0;
136 
138  virtual void POST( const OUString & inPath,
139  const OUString & rContentType,
140  const OUString & rReferer,
141  const css::uno::Reference< css::io::XInputStream > & inInputStream,
142  css::uno::Reference< css::io::XOutputStream > & oOutputStream,
143  const DAVRequestEnvironment & rEnv ) = 0;
144 
146  virtual void MKCOL( const OUString & inPath,
147  const DAVRequestEnvironment & rEnv ) = 0;
148 
150  virtual void COPY( const OUString & inSource,
151  const OUString & inDestination,
152  const DAVRequestEnvironment & rEnv,
153  bool inOverwrite = false ) = 0;
154 
156  virtual void MOVE( const OUString & inSource,
157  const OUString & inDestination,
158  const DAVRequestEnvironment & rEnv,
159  bool inOverwrite = false ) = 0;
160 
162  virtual void DESTROY( const OUString & inPath,
163  const DAVRequestEnvironment & rEnv ) = 0;
164 
165  // set new lock.
167  virtual void LOCK( const OUString & inPath,
168  css::ucb::Lock & inLock,
169  const DAVRequestEnvironment & rEnv ) = 0;
170 
171  // refresh existing lock.
173  virtual sal_Int64 LOCK( const OUString & inPath,
174  sal_Int64 nTimeout,
175  const DAVRequestEnvironment & rEnv ) = 0;
176 
178  virtual void UNLOCK( const OUString & inPath,
179  const DAVRequestEnvironment & rEnv ) = 0;
180 
182  virtual void abort() = 0;
183 
184 protected:
186 
187  explicit DAVSession( rtl::Reference< DAVSessionFactory > const & rFactory )
188  : m_xFactory( rFactory ), m_nRefCount( 0 ) {}
189 
190  virtual ~DAVSession() {}
191 
192 private:
193  DAVSessionFactory::Map::iterator m_aContainerIt;
194  oslInterlockedCount m_nRefCount;
195 
196  friend class DAVSessionFactory;
197  friend struct std::default_delete< DAVSession >;
198 };
199 
200 } // namespace http_dav_ucp
201 
202 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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)
Definition: DAVSession.hxx:187
virtual void MOVE(const OUString &inSource, const OUString &inDestination, const DAVRequestEnvironment &rEnv, bool inOverwrite=false)=0
virtual css::uno::Reference< css::io::XInputStream > GET(const OUString &inPath, const DAVRequestEnvironment &rEnv)=0
virtual void COPY(const OUString &inSource, const OUString &inDestination, const DAVRequestEnvironment &rEnv, bool inOverwrite=false)=0
virtual void PROPPATCH(const OUString &inPath, const std::vector< ProppatchValue > &inValues, const DAVRequestEnvironment &rEnv)=0
virtual void HEAD(const OUString &inPath, const std::vector< OUString > &inHeaderNames, DAVResource &ioResource, const DAVRequestEnvironment &rEnv)=0
oslInterlockedCount m_nRefCount
Definition: DAVSession.hxx:194
virtual void PUT(const OUString &inPath, const css::uno::Reference< css::io::XInputStream > &s, const DAVRequestEnvironment &rEnv)=0
virtual void abort()=0
virtual void DESTROY(const OUString &inPath, const DAVRequestEnvironment &rEnv)=0
rtl::Reference< DAVSessionFactory > m_xFactory
Definition: DAVSession.hxx:185
DAVSessionFactory::Map::iterator m_aContainerIt
Definition: DAVSession.hxx:193
virtual bool CanUse(const OUString &inPath)=0
virtual bool UsesProxy()=0
virtual void MKCOL(const OUString &inPath, const DAVRequestEnvironment &rEnv)=0
virtual void LOCK(const OUString &inPath, css::ucb::Lock &inLock, 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 UNLOCK(const OUString &inPath, const DAVRequestEnvironment &rEnv)=0