Subject: Atom Best Practice for directory file listing?

From: [email-masked]
Date: Mon, 10 Sep 2007 19:56:01 -0500

Hi All-

Forgive me if this has been gone over before, but my searches have not
turned up anything useful.

I find myself wanting to use Atom as a messaging protocol within an
application, especially in the cases when those 'messages' might be used
in cases other than the the one it was designed for. I often get stuck,
though, trying to determine the most correct way to form the feed, esp.
when it comes to elements such as 'author', 'category' (is that as wide
open as it seems?), title, updated, etc.

In one particular case, I would like to auto-generate an Atom document
to sit in a web-accessible directory of files, enabling another
application to 'discover' those files and decide whether to grab them.
The particular use case is a University setting in which we have a
centralized digital asset management & sharing tool, but users have no
good way to get their stuff in there (web-based upload forms are only
good for a few items). Users DO have online, web-accessible space that
they can deposit items to by way of a WebDAV interface that most folks
are comfortable with.  I would like to be able to have them deposit
items in a specially-named directory there, have the system generate an
atom document to go with it, then have the asset management tool ingest
those items.  A simple interface to the Atom-creator would even allow
the user to add a bit of their own metadata before the ingest occurs.

I suspect I would use a mapping like:

entry (file):
author = file owner
id = host/filepath
title = filename
updated = last modified time

feed (directory):
title = directory name
updated = most recently updated file

Any thoughts on this or implementations I could 'borrow' (perl, php,
python, ruby ...)

thanks!
Peter Keane

---

From: James M Snell <[email-masked]>
Date: Mon, 10 Sep 2007 22:59:43 -0700

One important thing to keep in mind is that the author element is only
required in an entry if it does not exist at the feed level, so you
really do not need to worry about entry level authors.

This is just off the top of my head, so this might not entirely work,
but if I were building an Atom feed from a directory listing, I'd likely
do something like the following:

<feed xmlns="...">
  <id>file:/path/to/the/folder</id> <!-- or whatever else works -->
  <title>folder name</title>
  <updated>{folder last modified timestamp}</updated>
  <link rel="self" href="..." />
  <link rel="alternate" href="..." />
  <author><name /></author> <!-- the name can be empty-->

  <entry>
    <id>file:/path/to/the/file</id>
    <title>filename</title>
    <updated>{file last modified timestamp}</updated>
    <link rel="alternate" type="..." href="file:/path/to/the/file" />
    <summary>filename, type, last modified, size, etc. Info that would
      typically appear in a directory listing</summary>
  </entry>

</feed>

It really shouldn't need to get anymore complicated than that.

- James