On 6/26/07, Jerome Louvel <[EMAIL PROTECTED]> wrote:

Hi Alex,

The extension is part of the latest 1.1 current.zip. I encourage you to have
a look at its API and give us feed-back.

There is also an Atom server implementation available via the Atomojo
project.

In theory, you can use my atomojo classes to embed the Atom Publishing
Protocol (APP) into any restlet instance.  It does require an embedded
database but the configuration is rather simple as it is an Application-based
class:

  Application app = new AtomApplication(getContext(),atomDB,storage);

The 'atomDB' instance is a functional class that encapsulates the information
stored in the Derby database.  It can be created by a few simple calls:

 Map<String,DB> dbList = DB.getDatabases(new File("whatever-you-want"));

which gets the database set from an existing or new database directory.  Then
you get a specific database:

 DB atomDB  = dbList.get("mydata");

or create a new database:

 DB atomDB = DB.createDB(new File("whatever-you-want"),"mydata");

Either way, this sets up the derby and eXist databases.

You then need an Storage instance to handle policies for storing information
into the XML DB.  There is currently only implementation but there will be
more in the future that will handle storing certain resources external to the
XML DB (e.g. video files).

So, you create one with:

  Storage storage = new XMLDBStorage(Logger.getLogger("exist"),new
Reference("exist://mydata"/feeds"));

While it could be encapsulated a bit more, the whole thing looks like:

 File dbdir = new File("whatever-you-want");
 String dbname = "mydata";
 Map<String,DB> dbList = DB.getDatabases(dbdir);
 DB atomDB  = dbList.get(dbname);
 if (atomDB==null) {
     atomDB = DB.createDB(dbdir,dbname);
 }
 Storage storage = new XMLDBStorage(Logger.getLogger("exist"),new
Reference("exist://"+dbname+"/feeds"));

 Application app = new AtomApplication(getContext(),atomDB,storage);

The project is at:

  http://code.google.com/p/atomojo

Keep in mind that some of the above code relies on the SVN trunk and not
the released 0.3.1 version.

I have planned to look at the client code in restlet and help out
there... but I
haven't quite found the time.  I do use my own client code inside atomojo for
restore and pull synchronization.  There is an opportunity to merge the two when
I get a chance.


--Alex Milowski

Reply via email to