[Libreoffice-commits] core.git: officecfg/registry ucb/source

Giuseppe Castagno giuseppe.castagno at acca-esse.eu
Fri Jul 29 13:37:09 UTC 2016


 officecfg/registry/schema/org/openoffice/Inet.xcs |   32 +++++++++++++++++++
 ucb/source/ucp/webdav-neon/webdavcontent.cxx      |   37 ++++++++++++++++++++++
 ucb/source/ucp/webdav-neon/webdavcontent.hxx      |   17 ++++++++++
 3 files changed, 86 insertions(+)

New commits:
commit 2c0b4ff238f39b5fcce09c7d36e80ac1e7cb713e
Author: Giuseppe Castagno <giuseppe.castagno at acca-esse.eu>
Date:   Sun Jan 10 17:32:53 2016 +0100

    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 at libreoffice.org>
    Reviewed-by: Giuseppe Castagno <giuseppe.castagno at acca-esse.eu>

diff --git a/officecfg/registry/schema/org/openoffice/Inet.xcs b/officecfg/registry/schema/org/openoffice/Inet.xcs
index f5dcc6a..76d5d2e 100644
--- a/officecfg/registry/schema/org/openoffice/Inet.xcs
+++ b/officecfg/registry/schema/org/openoffice/Inet.xcs
@@ -163,6 +163,38 @@
         </info>
 	<value>60</value>
       </prop>
+      <!-- WebDAV OPTIONS cache lifetime time values -->
+      <prop oor:name="OptsCacheLifeImplWeb" oor:type="xs:int" oor:nillable="false">
+        <info>
+          <desc>Specifies the Web/DAV resource OPTIONS cache lifetime, when the web resource is Web only, implementing OPTIONS. Time in seconds. Min. 0 sec (no caching) max. 3600 sec (1h), default to 300 (5m).</desc>
+        </info>
+	<value>300</value>
+      </prop>
+      <prop oor:name="OptsCacheLifeDAV" oor:type="xs:int" oor:nillable="false">
+        <info>
+          <desc>Specifies the Web/DAV resource OPTIONS cache lifetime, when the web resource is WebDAV. Time in seconds. Min. 0 sec (no caching) max. 3600 sec (1h), default to 60 (1m).</desc>
+        </info>
+	<value>60</value>
+      </prop>
+      <prop oor:name="OptsCacheLifeDAVLocked" oor:type="xs:int" oor:nillable="false">
+        <info>
+          <desc>Specifies the Web/DAV resource OPTIONS cache lifetime, when the web resource is WebDAV and the resource is locked. Time in seconds. Min. 0 sec (no caching) max. 3600 sec (1h), default to 600 (10m).</desc>
+        </info>
+	<value>600</value>
+      </prop>
+      <prop oor:name="OptsCacheLifeNotImpl" oor:type="xs:int" oor:nillable="false">
+        <info>
+          <desc>Specifies the Web/DAV resource OPTIONS cache lifetime, when the web resource does not implement OPTIONS method. Time in seconds. Min. 0 sec (no caching) max. 43200 sec (12h), default to 3600 (1h)</desc>
+        </info>
+	<value>3600</value>
+      </prop>
+      <prop oor:name="OptsCacheLifeNotFound" oor:type="xs:int" oor:nillable="false">
+        <info>
+          <desc>Specifies the Web/DAV resource OPTIONS cache lifetime, when the web resource is not found on server. Time in seconds. Min. 0 sec (no caching) max. 30 sec, default to 15 (15 sec).</desc>
+        </info>
+	<value>15</value>
+      </prop>
+      <!-- End of WebDAV OPTIONS cache lifetime time values -->
     </group>
   </component>
 </oor:component-schema>
diff --git a/ucb/source/ucp/webdav-neon/webdavcontent.cxx b/ucb/source/ucp/webdav-neon/webdavcontent.cxx
index 3c40ad8..8c84f5d 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 a6cb378..bda8566 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 >


More information about the Libreoffice-commits mailing list