170 likes | 250 Vues
Publishing Repositories with mod_dav. Greg Stein CollabNet, Inc. gstein@lyra.org, http://www.lyra.org/greg/. Agenda. WebDAV introduction mod_dav introduction The mod_dav API for backends Example: mod_dav_fs Example: mod_dav_svn Future. WebDAV Introduction What is it? (1 of 2).
E N D
Publishing Repositories with mod_dav Greg Stein CollabNet, Inc. gstein@lyra.org, http://www.lyra.org/greg/ O'Reilly Open Source Convention
Agenda • WebDAV introduction • mod_dav introduction • The mod_dav API for backends • Example: mod_dav_fs • Example: mod_dav_svn • Future O'Reilly Open Source Convention
WebDAV IntroductionWhat is it? (1 of 2) • Web-based Distributed Authoring and Versioning • “DAV” is the usual short form • Goal: enable interoperability of tools for distributed web authoring • Turns the Web into a writeable medium O'Reilly Open Source Convention
WebDAV Introduction What is it? (2 of 2) • Applies to all kinds of content - not just HTML and images • Based on extensions to HTTP • Uses XML for properties, control, status • RFC 2518 and RFC 3253 O'Reilly Open Source Convention
WebDAV IntroductionScenarios • Collaborative authoring • Network file system • Remote software engineering • Unified repository-access protocol O'Reilly Open Source Convention
WebDAV Introduction Some Tools and Clients • Open source • Joe Orton’s sitecopy and cadaver • Nautilus (gnome-vfs), KDE (kio) • Subversion • Python, Perl, C, Java client APIs • Commercial • MacOS X, most Adobe and Microsoft products • Dreamweaver and other authoring tools • Lots of (commercial) DAV servers O'Reilly Open Source Convention
mod_dav Introduction • mod_dav is an Apache module • Separate module for Apache 1.3 • Integrated into Apache 2.0 • On June 1, securityspace.com reported 171505 sites using mod_dav (6th most popular Apache module) O'Reilly Open Source Convention
mod_dav Introduction • mod_dav has an API for a “pluggable back-end repository” • Default repository uses the native filesystem • Oracle and ClearCase are shipping products using mod_dav with custom back-ends O'Reilly Open Source Convention
mod_dav Back-ends • Sometimes called “providers” • Implemented as Apache modules • Register themselves with mod_dav when they are first loaded • Each has a short name for reference • Used in the DAV directive (e.g. DAV svn) • Associated with a portion of the URL tree O'Reilly Open Source Convention
Apache 2.0 DSO loader mod_dav Back-ends mod_dav mod_dav_fs FS O'Reilly Open Source Convention
mod_dav Hooks • mod_dav does the protocol work and most of the interaction with Apache • Back-ends provide groups of functionality • Each group defines a set of “hooks” • Some groups or individual hooks are optional • The provider fills in the groups and hooks that it understands and can respond to O'Reilly Open Source Convention
Groups of Functionality • Content (“repository”) required • “Dead” properties required • “Live” properties optional, recommended • Locks optional • Versioning optional, very complex • Binding optional, ill-defined • Searching optional, ill-defined O'Reilly Open Source Convention
How to Start • Look at mod_dav_fs • Set up your Apache module • Register your provider with mod_dav • Set up your dav_provider structure • Begin with the repository hooks • Stub out the dead property hooks • Leave the other groups as NULL O'Reilly Open Source Convention
Key Structures • dav_resource - the backend object being operated upon • The “info” field for your private data • dav_error - returning errors • dav_response - returning multistatus info • See mod_dav.h O'Reilly Open Source Convention
dav_hooks_repository • get_resource • open/close/seek/write_stream • set_headers, deliver • copy/move/remove_resource • create_collection • walk • miscellaneous O'Reilly Open Source Convention
get_resource • Identify a resource based on the user request • Four parameters • The Apache request_rec pointer • The root of this DAV-enabled space • Label header and DAV:checked-in property • Remember stuff in resource->info O'Reilly Open Source Convention
Future • Evolve the mod_dav API • Integrate more closely with Apache, apr(-util) • Performance and memory usage changes • Documentation(!) • New Open Source providers • Catacomb (a MySQL backend) • Shims to implement a backend in Perl, Python, or PHP O'Reilly Open Source Convention