summaryrefslogtreecommitdiff
path: root/ucb
diff options
context:
space:
mode:
authorGiuseppe Castagno <giuseppe.castagno@acca-esse.eu>2016-01-10 17:32:53 +0100
committerGiuseppe Castagno <giuseppe.castagno@acca-esse.eu>2016-07-29 13:36:30 +0000
commit2c0b4ff238f39b5fcce09c7d36e80ac1e7cb713e (patch)
tree7e9ebdcbb1b9f034ca9205dd48cc1c6967a08f0e /ucb
parentee79a2dd7ea60e902cab3a9203e307b8a78fee23 (diff)
tdf#101094 (11): Add WebDAV options cache configuration param.
Added in officecfg five new properties to be able to set cache lifetime if needed. The new properties are available in advanced, expert configuration only, in org.openoffice.Inet.Settings. Default values are as follows (value is in seconds): OptsCacheLifeImplWeb = 300 when the web resource is Web only, implementing OPTIONS. Min. 0 sec (no caching) max. 3600 sec (1h). OptsCacheLifeDAV = 60 when the web resource is WebDAV. Min. 0 sec (no caching) max. 3600 sec (1h). OptsCacheLifeDAVLocked = 600 when the web resource is WebDAV and it's locked by this LO instance (e.g. lock store has a lock to it). Min. 0 sec (no caching) max. 3600 sec (1h). OptsCacheLifeNotImpl = 3600 when the web resource does not implement OPTIONS method. Min. 0 sec (no caching) max. 43200 sec (12h). OptsCacheLifeNotFound = 15 when the requested web resource is not found on server. Min. 0 sec (no caching) max. 30 sec. Change-Id: I719b97645e1d91a29134820b77678fd88fcb9ac2 Reviewed-on: https://gerrit.libreoffice.org/27684 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Giuseppe Castagno <giuseppe.castagno@acca-esse.eu>
Diffstat (limited to 'ucb')
-rw-r--r--ucb/source/ucp/webdav-neon/webdavcontent.cxx37
-rw-r--r--ucb/source/ucp/webdav-neon/webdavcontent.hxx17
2 files changed, 54 insertions, 0 deletions
diff --git a/ucb/source/ucp/webdav-neon/webdavcontent.cxx b/ucb/source/ucp/webdav-neon/webdavcontent.cxx
index 3c40ad856656..8c84f5d8063c 100644
--- a/ucb/source/ucp/webdav-neon/webdavcontent.cxx
+++ b/ucb/source/ucp/webdav-neon/webdavcontent.cxx
@@ -38,6 +38,7 @@
#include "osl/doublecheckedlocking.h"
#include <rtl/uri.hxx>
#include <rtl/ustrbuf.hxx>
+#include <officecfg/Inet.hxx>
#include <ucbhelper/contentidentifier.hxx>
#include <ucbhelper/propertyvalueset.hxx>
#include <ucbhelper/simpleinteractionrequest.hxx>
@@ -92,6 +93,12 @@
using namespace com::sun::star;
using namespace webdav_ucp;
+// Static value, to manage a simple OPTIONS cache
+// Key is the URL, element is the DAVOptions resulting from an OPTIONS call.
+// Cached DAVOptions have a lifetime that depends on the errors received or not received
+// and on the value of received options.
+static DAVOptionsCache aStaticDAVOptionsCache;
+
// Content Implementation.
@@ -114,6 +121,7 @@ Content::Content(
{
try
{
+ initOptsCacheLifeTime();
m_xResAccess.reset( new DAVResourceAccess(
rxContext,
rSessionFactory,
@@ -147,6 +155,7 @@ Content::Content(
{
try
{
+ initOptsCacheLifeTime();
m_xResAccess.reset( new DAVResourceAccess(
rxContext, rSessionFactory, Identifier->getContentIdentifier() ) );
}
@@ -165,6 +174,34 @@ Content::~Content()
}
+void Content::initOptsCacheLifeTime()
+{
+ // see description in
+ // officecfg/registry/schema/org/openoffice/Inet.xcs
+ // for use of these filed values.
+ sal_uInt32 nAtime;
+ nAtime = officecfg::Inet::Settings::OptsCacheLifeImplWeb::get( m_xContext );
+ m_nOptsCacheLifeImplWeb = std::max( sal_uInt32( 0 ),
+ std::min( nAtime, sal_uInt32( 3600 ) ) );
+
+ nAtime = officecfg::Inet::Settings::OptsCacheLifeDAV::get( m_xContext );
+ m_nOptsCacheLifeDAV = std::max( sal_uInt32( 0 ),
+ std::min( nAtime, sal_uInt32( 3600 ) ) );
+
+ nAtime = officecfg::Inet::Settings::OptsCacheLifeDAVLocked::get( m_xContext );
+ m_nOptsCacheLifeDAVLocked = std::max( sal_uInt32( 0 ),
+ std::min( nAtime, sal_uInt32( 3600 ) ) );
+
+ nAtime = officecfg::Inet::Settings::OptsCacheLifeNotImpl::get( m_xContext );
+ m_nOptsCacheLifeNotImpl = std::max( sal_uInt32( 0 ),
+ std::min( nAtime, sal_uInt32( 43200 ) ) );
+
+ nAtime = officecfg::Inet::Settings::OptsCacheLifeNotFound::get( m_xContext );
+ m_nOptsCacheLifeNotFound = std::max( sal_uInt32( 0 ),
+ std::min( nAtime, sal_uInt32( 30 ) ) );
+}
+
+
// XInterface methods.
diff --git a/ucb/source/ucp/webdav-neon/webdavcontent.hxx b/ucb/source/ucp/webdav-neon/webdavcontent.hxx
index a6cb37805a43..bda8566ae26e 100644
--- a/ucb/source/ucp/webdav-neon/webdavcontent.hxx
+++ b/ucb/source/ucp/webdav-neon/webdavcontent.hxx
@@ -98,6 +98,23 @@ class Content : public ::ucbhelper::ContentImplHelper,
bool m_bCollection;
bool m_bDidGetOrHead;
std::vector< OUString > m_aFailedPropNames;
+ // Options Cache lifetime
+ // for web site implementing OPTIONS, but not dav
+ sal_uInt32 m_nOptsCacheLifeImplWeb;
+ // for WebDAV site where OPTIONS is mandatory
+ sal_uInt32 m_nOptsCacheLifeDAV;
+ // same as above, but when the resource is locked by us
+ sal_uInt32 m_nOptsCacheLifeDAVLocked;
+// For web site not implementing OPTIONS
+ // during this time we assume the site doesn't turn to WebDAV
+ // but remains a simple Web
+ sal_uInt32 m_nOptsCacheLifeNotImpl;
+ // When resource is not found
+ // may be the resource is unavailable only briefly?
+ // so better have this small
+ sal_uInt32 m_nOptsCacheLifeNotFound;
+
+ void initOptsCacheLifeTime();
private:
virtual css::uno::Sequence< css::beans::Property >