Cédric Bosdonnat - CMIShttps://bosdonnat.fr/2014-07-17T22:07:00+02:00A geek's perspectiveLibreOffice can now reach CMIS servers through HTTPS2014-07-17T22:07:00+02:002014-07-17T22:07:00+02:00Cédric Bosdonnattag:bosdonnat.fr,2014-07-17:/libreoffice-reaches-cmis-https.html<p>LibreOffice CMIS server connection feature suffered a severe disease since the
begining: it was not able to connect to servers using HTTPS. First a workaround
was added for invalid certificates, but the problem also existed for valid ones
as described by <a href="https://bugs.freedesktop.org/show_bug.cgi?id=72277">fdo#72277</a>.</p>
<p>After several months of inactivity, I finally …</p><p>LibreOffice CMIS server connection feature suffered a severe disease since the
begining: it was not able to connect to servers using HTTPS. First a workaround
was added for invalid certificates, but the problem also existed for valid ones
as described by <a href="https://bugs.freedesktop.org/show_bug.cgi?id=72277">fdo#72277</a>.</p>
<p>After several months of inactivity, I finally managed to grab enough courage to
dive into curl and NSS. From 4.3.1, LibreOffice built with internal curl
library, will be able to use the mozilla certificates database to validate CMIS
connections.</p>
<p>For those wanting to know the gore details, LibreOffice internal curl library
is built with NSS support. To read the certificates database, curl needs to
find libnssckbi: so <strong><a href="http://opengrok.libreoffice.org/xref/core/xmlsecurity/source/xmlsec/nss/nssinitializer.cxx#nsscrypto_initialize">NSSInitializer</a></strong> UNO service was here to do that job. But
using that service is not enought: curl doesn't know how to read the PKCS
certificates stored in the database... and needs libnsspem to do that. After
some digging, I uncovered it on <a href="https://git.fedorahosted.org/cgit/nss-pem.git">fedorahosted</a> and added it as a patch to
LibreOffice internal NSS library.</p>
<p>Thanks Caolan and Michael Stahl for pointing me to the right direction to fix
that one.</p>CMIS changes merged in master2013-09-02T13:42:00+02:002013-09-02T13:42:00+02:00Cédric Bosdonnattag:bosdonnat.fr,2013-09-02:/cmis-changes-merged-in-master.html<p>I just rebased the feature/cmis branch hosting <a href="http://anonymousquark.com/">Cuong</a>'s great work and some other
interesting improvements of the existing CMIS feature. Concretely, this means
that with master builds you can now:</p>
<ul>
<li>Connect to Google Drive through the CMIS feature. The UI for the connection
may still need to be …</li></ul><p>I just rebased the feature/cmis branch hosting <a href="http://anonymousquark.com/">Cuong</a>'s great work and some other
interesting improvements of the existing CMIS feature. Concretely, this means
that with master builds you can now:</p>
<ul>
<li>Connect to Google Drive through the CMIS feature. The UI for the connection
may still need to be improved</li>
<li>See and edit the CMIS properties of your documents.</li>
<li>Decide what to do with invalid SSL certificates when initiating a CMIS
connection</li>
</ul>
<p><img alt="branching tree" src="https://bosdonnat.fr/data/photos/branching-tree.jpg"></p>libcmis 0.4.0 released2013-08-07T09:54:00+02:002013-08-07T09:54:00+02:00Cédric Bosdonnattag:bosdonnat.fr,2013-08-07:/libcmis-0-4-0-released.html<p>After quite a long time alternating intensive hacking and inactivity, libcmis
0.4.0 is finally out and brings quite a number of great new features. The
hightlight of this release is of course the introduction of the Google Drive
protocol as a CMIS binding by <strong><a href="http://anonymousquark.com/">Cao Cuong Ngo</a></strong> for …</p><p>After quite a long time alternating intensive hacking and inactivity, libcmis
0.4.0 is finally out and brings quite a number of great new features. The
hightlight of this release is of course the introduction of the Google Drive
protocol as a CMIS binding by <strong><a href="http://anonymousquark.com/">Cao Cuong Ngo</a></strong> for his Google Summer of
Code project with LibreOffice. This allows to connect to
your Google Drive documents in the same way than with any CMIS server.</p>
<p>However there are quite some other important improvements:</p>
<ul>
<li>Support for OAuth2 authentication for the CMIS servers. This allows libcmis to
connect to <a href="http://www.alfresco.com/products/cloud">Alfresco cloud</a>. Most of this feature comes from <strong><a href="http://anonymousquark.com/">Cao Cuong
Ngo</a></strong>'s work.</li>
<li>Allow to provide custom HTTP proxy configuration.</li>
<li>Handle invalid SSL certificates instead of simply failing them. This feature
depends if libcurl was built with OpenSSL or not.</li>
<li>Provide repository capabilities</li>
<li>Implement renditions support</li>
</ul>
<p>And it's not a feature, but a great improvements from libcmis hackers: I removed
the Atom binding unit tests depending on Apache Chemistry InMemory server and
switched them to a unit test framework using a <a href="https://bosdonnat.fr/testing-libcurl-based-http-clients.html">libcurl mockup</a>. It heavily
reduced the unit test execution time, but the WebService binding unit test still
have to be migrated to completely get rid of the InMemory server.</p>
<p>You can download libcmis 0.4.0 on <a href="https://sourceforge.net/projects/libcmis/">SourceForge.net</a> as usual. The package for
openSUSE will shortly available on <a href="http://software.opensuse.org">software.opensuse.org</a></p>Screenshots of CMIS in Nautilus2013-08-01T11:24:00+02:002013-08-01T11:24:00+02:00Cédric Bosdonnattag:bosdonnat.fr,2013-08-01:/screenshots-of-cmis-in-nautilus.html<p>Michael asked me this week to provide some screenshots of my <a href="https://bosdonnat.fr/cmis-for-gnome.html">hackweek work</a> on a GVFS
backend for CMIS. Sadly I had none and switched to <a href="http://software.opensuse.org/developer/en">openSUSE Factory</a> in the mean time so
I had to update my code for gvfs master branch. I also had an annoying bug when …</p><p>Michael asked me this week to provide some screenshots of my <a href="https://bosdonnat.fr/cmis-for-gnome.html">hackweek work</a> on a GVFS
backend for CMIS. Sadly I had none and switched to <a href="http://software.opensuse.org/developer/en">openSUSE Factory</a> in the mean time so
I had to update my code for gvfs master branch. I also had an annoying bug when browsing
a CMIS repository in Nautilus... so I had to fix that.</p>
<p>After quite some hours searching, debugging, adding g_print in nautilus, gtk+ and glib, I
finally found the culprit: <code>g_vfs_encode_uri</code> was leaving the <code>':'</code> unencoded in the hostname.</p>
<p>Now I have screenshots to show here:</p>
<p>One from an Alfresco server:</p>
<p><img alt="Alfresco shown in Nautilus" src="https://bosdonnat.fr/data/ecm/nautilus-alfresco.png"></p>
<p>One showing the SharePoint 2013 repositories:</p>
<p><img alt="SharePoint 2013 repositories" src="https://bosdonnat.fr/data/ecm/nautilus-sharepoint_2013.png"></p>CMIS for GNOME2013-04-22T13:23:00+02:002013-04-22T13:23:00+02:00Cédric Bosdonnattag:bosdonnat.fr,2013-04-22:/cmis-for-gnome.html<p>At <a href="http://suse.com">SUSE</a>, we recently had a <a href="http://hackweek.suse.com">Hackweek</a>. It’s one week for all developers employed
by SUSE to hack on any innovative open source project they want. Last years, I
worked on <a href="http://sourceforge.net/projects/libcmis/">libcmis</a> and libcmis-c. And this year, I started implementing a GVFS
backend for CMIS using libcmis-c. GVFS is …</p><p>At <a href="http://suse.com">SUSE</a>, we recently had a <a href="http://hackweek.suse.com">Hackweek</a>. It’s one week for all developers employed
by SUSE to hack on any innovative open source project they want. Last years, I
worked on <a href="http://sourceforge.net/projects/libcmis/">libcmis</a> and libcmis-c. And this year, I started implementing a GVFS
backend for CMIS using libcmis-c. GVFS is the one of the low-level layers of
<a href="http://www.gnome.org">GNOME</a> to access files. A backend is a set of features like mount, unmount, read
a document, writ a document, navigate in folders, etc. Currently GVFS has
backends for FTP, SSH, WebDAV, Trash, Audio CDs, and quite a lot of other useful
things. Having a CMIS backend would allow any Gnome application to access
documents stored on a CMIS-enabled server.</p>
<p>What I achieved in one week:</p>
<ul>
<li>mount and unmount a CMIS repository</li>
<li>read a document</li>
<li>provide the content of the folders and repositories</li>
<li>provide some of the CMIS properties</li>
</ul>
<p>To have a complete backend to upstream, I will need to implement:</p>
<ul>
<li>creating / writing files</li>
<li>deleting / moving items</li>
<li>creating folders</li>
<li>setting properties</li>
</ul>
<p>The code can be found on a <a href="http://cgit.freedesktop.org/~cbosdo/gvfs-cbosdo/">gvfs git clone in my freedesktop home</a>. I want to
thank the Gnome hackers who kindly answered my beginner questions during this
week.</p>Testing libcurl-based HTTP clients2013-02-14T14:48:00+01:002013-02-14T14:48:00+01:00Cédric Bosdonnattag:bosdonnat.fr,2013-02-14:/testing-libcurl-based-http-clients.html<p>Since the last blog post, quite some nice things happened: I moved to a new
house, we released <a href="http://www.libreoffice.org">LibreOffice 4.0.0</a> fantastic release and <a href="http://mmohrhard.wordpress.com/">Markus</a> helped me
write better unit tests for <a href="http://sourceforge.net/projects/libcmis/">libcmis</a>.In this post, I’ld like to give some
details on these new unit tests. To …</p><p>Since the last blog post, quite some nice things happened: I moved to a new
house, we released <a href="http://www.libreoffice.org">LibreOffice 4.0.0</a> fantastic release and <a href="http://mmohrhard.wordpress.com/">Markus</a> helped me
write better unit tests for <a href="http://sourceforge.net/projects/libcmis/">libcmis</a>.In this post, I’ld like to give some
details on these new unit tests. To understand the need of changing unit tests,
you need to know that libcmis test script was downloading, setting up and
starting an <a href="http://chemistry.apache.org/java/developing/repositories/dev-repositories-inmemory.html">Apache Chemistry InMemory</a> server to interact with. This system had
several drawbacks like slow unit tests and dependency on the test server
features and bugs for inventing new test cases. To work this around, Markus
helped me to setup a <a href="http://curl.haxx.se/libcurl/">libcurl</a> mockup library.</p>
<p>The principle is pretty simple: replace the normal libcurl used to send the
HTTP requests to the server by a mockup library. The mockup can then store the
sent requests and provide the responses we want (either valid ones or invalid
ones). The code of the mockup is still evolving and can be found in the
<a href="http://code.ohloh.net/project?pid=lGlZ5bFEHQc&did=qa%2Fmockup">qa/mockup</a> folder of libcmis source tree. One of the key functions to get it
working is <strong>curl_mockup_addResponse</strong>: it tells the mockup what response to
provide under which circumstances. This function may still need some more
parameters to cover all cases, but it will associate a response (body, headers,
status) with a request (URL, HTTP method). The other important function for
testing is <strong>curl_mockup_getRequest</strong>: it gives back the request content for a URL
and HTTP method. It helps making sure that our code sent the proper request.</p>
<p>As always, a small code snippet helps a lot to understand. Let’s take one
derived from libcmis unit tests.</p>
<div class="highlight"><pre><span></span><code><span class="kt">void</span> <span class="n">AtomTest</span><span class="o">::</span><span class="n">createDocumentTest</span><span class="p">(</span> <span class="p">)</span>
<span class="p">{</span>
<span class="c1">// Reset the mockup configuration to avoid keeping other tests config</span>
<span class="n">curl_mockup_reset</span><span class="p">(</span> <span class="p">);</span>
<span class="c1">// Add a response to match. In this case, a POST request with a URL like</span>
<span class="c1">// http://mockup/mock/children?id=root-folder&amp;somethingelse will fit</span>
<span class="c1">// The response will have:</span>
<span class="c1">// - the body: "Response body up to server"</span>
<span class="c1">// - the HTTP status: 201</span>
<span class="c1">// - the HTTP Headers with Location defined</span>
<span class="n">curl_mockup_addResponse</span><span class="p">(</span> <span class="s">"http://mockup/mock/children"</span><span class="p">,</span> <span class="s">"id=root-folder"</span><span class="p">,</span> <span class="s">"POST"</span><span class="p">,</span>
<span class="s">"Response body up to server"</span><span class="p">,</span> <span class="mi">201</span><span class="p">,</span> <span class="nb">false</span><span class="p">,</span>
<span class="s">"Location: http://mockup/mock/id?id=create-document</span><span class="se">\r\n</span><span class="s">"</span> <span class="p">);</span>
<span class="c1">// Set the authentication credentials needed to fake the server</span>
<span class="n">curl_mockup_setCredentials</span><span class="p">(</span> <span class="n">SERVER_USERNAME</span><span class="p">,</span> <span class="n">SERVER_PASSWORD</span> <span class="p">);</span>
<span class="c1">// Create the CURL handle (in the session for libcmis)</span>
<span class="n">AtomPubSession</span> <span class="n">session</span> <span class="o">=</span> <span class="n">getTestSession</span><span class="p">(</span> <span class="n">SERVER_USERNAME</span><span class="p">,</span> <span class="n">SERVER_PASSWORD</span> <span class="p">);</span>
<span class="c1">// Do something with the CURL handle (the session for libcmis)</span>
<span class="p">...</span>
<span class="c1">// You can check that your code worked fine (thanks to the response you provided)</span>
<span class="p">...</span>
<span class="c1">// You can also check that the request was the expected one</span>
<span class="c1">// or matched some important criteria (beware of timestamps</span>
<span class="c1">// and variable bits in the requests)</span>
<span class="n">string</span> <span class="n">request</span><span class="p">(</span> <span class="n">curl_mockup_getRequest</span><span class="p">(</span> <span class="s">"http://mockup/mock/children"</span><span class="p">,</span>
<span class="s">"id=root-folder"</span><span class="p">,</span> <span class="s">"POST"</span> <span class="p">)</span> <span class="p">);</span>
<span class="n">CPPUNIT_ASSERT_EQUAL_MESSAGE</span><span class="p">(</span> <span class="s">"Wrong request sent"</span><span class="p">,</span> <span class="n">expectedRequest</span><span class="p">,</span> <span class="n">request</span> <span class="p">);</span>
<span class="p">}</span>
</code></pre></div>
<p>I hope this testing experience can help others testing their HTTP client
application based on libcurl. Of course, something similar can be done with
other HTTP client libraries.</p>libcmis 0.3.0 is out2012-09-13T15:16:00+02:002012-09-13T15:16:00+02:00Cédric Bosdonnattag:bosdonnat.fr,2012-09-13:/libcmis-0-3-0-is-out.html<p>Libcmis 0.3.0 just hatched and will bring a whole lot of
change to the way you connect to your ECM. Here is are the cool new
features that were added in this version:</p>
<ul>
<li>WebService binding is implemented at the same level than the Atom
binding</li>
<li>The session factory …</li></ul><p>Libcmis 0.3.0 just hatched and will bring a whole lot of
change to the way you connect to your ECM. Here is are the cool new
features that were added in this version:</p>
<ul>
<li>WebService binding is implemented at the same level than the Atom
binding</li>
<li>The session factory has been improved to auto-guess the binding to
use based on the provided URL</li>
<li>libcmis-c provides a C wrapper API - <em>Thanks to SUSE hackweek</em></li>
<li>Object move method has been implemented - <em>Thanks to <a href="http://www.graudata.com/">Grau Data</a></em></li>
<li>Versions handling has been implemented with the checkOut, checkIn,
cancelCheckout and getAllVersions methods</li>
</ul>
<p>This new version of libcmis also comes with quite some fixes to support
<a href="http://code.google.com/p/xcmis/">XCMIS</a> and <a href="http://www.cloudoku.com/">Cloudoku</a> (thanks to GrauData) and SharePoint.</p>
<p>You can download libcmis 0.3.0 on <a href="https://sourceforge.net/projects/libcmis/">SourceForge.net</a> as usual, or get
it for your beloved openSUSE on
<a href="http://software.opensuse.org">http://software.opensuse.org</a>.</p>LibreOffice integration into your ECM2012-07-12T21:03:00+02:002012-07-12T21:03:00+02:00Cédric Bosdonnattag:bosdonnat.fr,2012-07-12:/libreoffice-integration-into-your-ecm.html<p>Since already a few weeks I am hacking on getting LibreOffice
to integrate as smoothly as possible with ECMs. First Martin Richard and
Julien Levesy - students at <a href="http://if.insa-lyon.fr/">INSA Lyon</a> - reworked the LibreOffice
internal file picker dialog to integrate a places list. After a few more
work on it we had …</p><p>Since already a few weeks I am hacking on getting LibreOffice
to integrate as smoothly as possible with ECMs. First Martin Richard and
Julien Levesy - students at <a href="http://if.insa-lyon.fr/">INSA Lyon</a> - reworked the LibreOffice
internal file picker dialog to integrate a places list. After a few more
work on it we had a useable file picker to access local files, but also
FTP, WebDAV and Windows Shares. Together with that, a big effort on
<a href="http://sourceforge.net/p/libcmis">libcmis</a> and the Universal Content Provider using it made it possible
to connect also to CMIS enabled servers from the file picker.</p>
<p>What works now:</p>
<ul>
<li>Connection to a CMIS server using the internal file picker</li>
<li>Navigating in the CMIS server using the file picker like on a local
file system</li>
<li>Open, Save and Save As files on a CMIS server</li>
</ul>
<p>Even if this work has already nicely progressed it is still not ready
for end users and is thus enabled only with experimental features in
LibreOffice 3.6. Among the main problems:</p>
<ul>
<li>Getting the repository id to paste in the CMIS new place dialog is
not obvious. This is already fixed in the master branch and will be
available for 3.7</li>
<li>Check-in, Check-out and Cancel Check-out still need to be integrated
somehow in the UI in order to handle all cases. For example, saving
on a non-checked out document in SharePoint is not permitted.</li>
<li>Add WebService binding support as this would ease the SharePoint
connection configuration to the user</li>
<li>Get NTLM authentication to work with the curl and libcmis built with
LibreOffice. This is already partly fixed in master branch.</li>
</ul>
<p>Dave Largo, wrote a <a href="http://davelargo.blogspot.fr/2012/07/libreoffice-alfresco-connection.html">nice blog to help users configure the CMIS
connection on 3.6</a>, I won't be copying his work... but if you want to
connect to a SharePoint server using CMIS, you should read <a href="http://technet.microsoft.com/en-us/library/ff934619.aspx">this
documentation</a> first as it shows how to setup and enable CMIS on
SharePoint 2010 and what the binding URLs are.</p>
<p>Brave people can get a daily build or build master, but here are a few
screenshots of what is in the master branch for the inpatients.</p>
<p><img alt="CMIS place edit dialog" src="https://bosdonnat.fr/data/libreoffice/CMIS-place-edit.png"></p>
<p><img alt="CMIS File Picker" src="https://bosdonnat.fr/data/libreoffice/CMIS-fpicker.png"></p>Hackweek 7: CMIS connection for LibreOffice2011-10-03T13:04:00+02:002011-10-03T13:04:00+02:00Cédric Bosdonnattag:bosdonnat.fr,2011-10-03:/hackweek-7-cmis-connection-for-libreoffice.html<p>Last week at <a href="http://www.suse.com/">SUSE</a> we had a <a href="http://en.opensuse.org/Portal:Hackweek">hackweek</a>... For those who
don't know what it is, the idea is to have us developers work during one
work week on any project we want. Earlier in the year the idea has been
raised to implement a LibreOffice connector for <a href="http://alfresco.org">Alfresco</a> as …</p><p>Last week at <a href="http://www.suse.com/">SUSE</a> we had a <a href="http://en.opensuse.org/Portal:Hackweek">hackweek</a>... For those who
don't know what it is, the idea is to have us developers work during one
work week on any project we want. Earlier in the year the idea has been
raised to implement a LibreOffice connector for <a href="http://alfresco.org">Alfresco</a> as our
documentation team uses it. We even had a meeting with Alfresco people,
but the conclusion was obvious: LibreOffice needs to handle the <a href="http://en.wikipedia.org/wiki/Content_Management_Interoperability_Services">CMIS</a>
interface... that's what I started during that hackweek.</p>
<p>Of course I didn't have time to have a feature-complete support of CMIS
in only one week, but at least I managed to read some document on an
<a href="http://chemistry.apache.org/">Apache Chemistry</a> InMemory test server at the end of the week. To
make it easier, I started to write a C++ library to handle CMIS that can
be found on <a href="http://sf.net/p/libcmis/">http://sf.net/p/libcmis/</a>. In order for LibreOffice to
handle CMIS, I started writing a new Universal Content Provider (UCP)
and created a fake URL scheme to access the documents. For example on
master, you can open the content of the node #133 using the AtomPub
CMIS binding with that kind of URL:
<strong>cmis+atom://localhost:8080/inmemory/atom/?repo-id=A1&id=133</strong>.</p>
<p>The only way to get a CMIS document that works for sure at the moment is
to provide the URL to the soffice.bin process... but of course this will
need some more love to get a proper UI for it.</p>