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 #ifndef INCLUDED_UCB_SOURCE_UCP_WEBDAV_DAVSESSION_HXX
22 #define INCLUDED_UCB_SOURCE_UCP_WEBDAV_DAVSESSION_HXX
23 
24 #include <memory>
25 #include <rtl/ustring.hxx>
26 #include <com/sun/star/io/XInputStream.hpp>
27 #include <com/sun/star/io/XOutputStream.hpp>
28 #include "DAVResource.hxx"
29 #include "DAVSessionFactory.hxx"
30 #include "DAVTypes.hxx"
32 
33 namespace com { namespace sun { namespace star { namespace ucb {
34  struct Lock;
35 } } } }
36 
37 namespace http_dav_ucp
38 {
39 
40 class DAVAuthListener;
41 
43 {
44 public:
45  void acquire()
46  {
47  osl_atomic_increment( &m_nRefCount );
48  }
49 
50  void release()
51  {
52  if ( osl_atomic_decrement( &m_nRefCount ) == 0 )
53  {
54  m_xFactory->releaseElement( this );
55  delete this;
56  }
57  }
58 
59  virtual bool CanUse( const OUString & inPath ) = 0;
60 
61  virtual bool UsesProxy() = 0;
62 
63  // DAV methods
64 
65 
66  // NOT USED
67  /*
68  virtual void OPTIONS( const OUString & inPath,
69  DAVCapabilities & outCapabilities,
70  const DAVRequestEnvironment & rEnv )
71  throw( DAVException ) = 0;
72  */
73 
74  // allprop & named
76  virtual void PROPFIND( const OUString & inPath,
77  const Depth inDepth,
78  const std::vector< OUString > & inPropertyNames,
79  std::vector< DAVResource > & ioResources,
80  const DAVRequestEnvironment & rEnv ) = 0;
81 
82  // propnames
84  virtual void PROPFIND( const OUString & inPath,
85  const Depth inDepth,
86  std::vector< DAVResourceInfo > & ioResInfo,
87  const DAVRequestEnvironment & rEnv ) = 0;
88 
90  virtual void PROPPATCH( const OUString & inPath,
91  const std::vector< ProppatchValue > & inValues,
92  const DAVRequestEnvironment & rEnv ) = 0;
93 
95  virtual void HEAD( const OUString & inPath,
96  const std::vector< OUString > & inHeaderNames,
97  DAVResource & ioResource,
98  const DAVRequestEnvironment & rEnv ) = 0;
99 
101  virtual css::uno::Reference< css::io::XInputStream >
102  GET( const OUString & inPath,
103  const DAVRequestEnvironment & rEnv ) = 0;
104 
106  virtual void GET( const OUString & inPath,
107  css::uno::Reference< css::io::XOutputStream >& o,
108  const DAVRequestEnvironment & rEnv ) = 0;
109 
111  virtual css::uno::Reference< css::io::XInputStream >
112  GET( const OUString & inPath,
113  const std::vector< OUString > & inHeaderNames,
114  DAVResource & ioResource,
115  const DAVRequestEnvironment & rEnv ) = 0;
116 
118  virtual void
119  GET( const OUString & inPath,
120  css::uno::Reference< css::io::XOutputStream >& o,
121  const std::vector< OUString > & inHeaderNames,
122  DAVResource & ioResource,
123  const DAVRequestEnvironment & rEnv ) = 0;
124 
126  virtual void PUT( const OUString & inPath,
127  const css::uno::Reference< css::io::XInputStream >& s,
128  const DAVRequestEnvironment & rEnv ) = 0;
129 
131  virtual css::uno::Reference< css::io::XInputStream >
132  POST( const OUString & inPath,
133  const OUString & rContentType,
134  const OUString & rReferer,
135  const css::uno::Reference< css::io::XInputStream > & inInputStream,
136  const DAVRequestEnvironment & rEnv ) = 0;
137 
139  virtual void POST( const OUString & inPath,
140  const OUString & rContentType,
141  const OUString & rReferer,
142  const css::uno::Reference< css::io::XInputStream > & inInputStream,
143  css::uno::Reference< css::io::XOutputStream > & oOutputStream,
144  const DAVRequestEnvironment & rEnv ) = 0;
145 
147  virtual void MKCOL( const OUString & inPath,
148  const DAVRequestEnvironment & rEnv ) = 0;
149 
151  virtual void COPY( const OUString & inSource,
152  const OUString & inDestination,
153  const DAVRequestEnvironment & rEnv,
154  bool inOverwrite = false ) = 0;
155 
157  virtual void MOVE( const OUString & inSource,
158  const OUString & inDestination,
159  const DAVRequestEnvironment & rEnv,
160  bool inOverwrite = false ) = 0;
161 
163  virtual void DESTROY( const OUString & inPath,
164  const DAVRequestEnvironment & rEnv ) = 0;
165 
166  // set new lock.
168  virtual void LOCK( const OUString & inPath,
169  css::ucb::Lock & inLock,
170  const DAVRequestEnvironment & rEnv ) = 0;
171 
172  // refresh existing lock.
174  virtual sal_Int64 LOCK( const OUString & inPath,
175  sal_Int64 nTimeout,
176  const DAVRequestEnvironment & rEnv ) = 0;
177 
179  virtual void UNLOCK( const OUString & inPath,
180  const DAVRequestEnvironment & rEnv ) = 0;
181 
183  virtual void abort() = 0;
184 
185 protected:
187 
188  explicit DAVSession( rtl::Reference< DAVSessionFactory > const & rFactory )
189  : m_xFactory( rFactory ), m_nRefCount( 0 ) {}
190 
191  virtual ~DAVSession() {}
192 
193 private:
194  DAVSessionFactory::Map::iterator m_aContainerIt;
195  oslInterlockedCount m_nRefCount;
196 
197  friend class DAVSessionFactory;
198  friend struct std::default_delete< DAVSession >;
199 };
200 
201 } // namespace http_dav_ucp
202 
203 #endif // INCLUDED_UCB_SOURCE_UCP_WEBDAV_DAVSESSION_HXX
204 
205 /* 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:188
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:195
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:186
DAVSessionFactory::Map::iterator m_aContainerIt
Definition: DAVSession.hxx:194
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