I've just finished integrating eXist (an XML database) with
the Restlet API.  Now you can use the Client API to access
an embedded eXist database via GET/POST/etc.

The code is located at:

 https://exist.svn.sourceforge.net/svnroot/exist/trunk/restlet

and to build it you need:

 https://exist.svn.sourceforge.net/svnroot/exist/trunk/eXist-1.0
 https://exist.svn.sourceforge.net/svnroot/exist/trunk/embedded
 https://exist.svn.sourceforge.net/svnroot/exist/trunk/restlet

Then do:

 cd eXist-1.0; ant; cd ..
 cd embedded; ant import-exist; ant jar; cd ..
 cd restlet; ant jar

You can then run the example via:

 java -jar dist/exist-restlet.jar localhost localhost 8080 conf.xml

The neat bit here is that you can now write:

 Client client = new Client(Protocol.valueOf("exist"));
 client.get("exist:///foo.xml").getEntity().write(System.out);

to get a document out of eXist or post a query via:

 Client client = new Client(Protocol.valueOf("exist"));
 Response r = client.post(new Reference("exist:///foo.xml"),
                               new StringRepresentation(
                                    "<target>{/document/section}</target>",
                               MediaType.valueOf("application/xquery")) );

--Alex Milowski

Reply via email to