On Mon, Jul 27, 2009 at 7:46 AM, Sean Devlin <francoisdev...@gmail.com>
 wrote:
>
> Howdy everyone,
> I've got a project that needs a Doc DB.  It will need to run on
> windows (and probably OS X), so I am looking for something that works
> with Java.  I thought I'd ask for some help here before I re-invent
> the wheel.
>
> 1.  Has anyone here worked with a Java based doc DB?
> 2.  Does anyone have Clojure bindings for said doc DB?
> 3.  Does anyone know of good guide for said doc DB?


Take a look at Xwiki <http://xwiki.org>, a 5-year-old open source project,
implemented in Java, which has database-backed documents, objects that can
be attached to documents, collaborative document versioning, and the ability
to write scripts in Velocity or
Groovy<http://platform.xwiki.org/xwiki/bin/view/DevGuide/Scripting>
and
jRuby <http://code.xwiki.org/xwiki/bin/view/Macros/RubyMacro>, and hopefully
if I have my way with it, Clojure too:
http://groups.google.com/group/clojure/browse_thread/thread/297861670c2f5611 .
This is an old Google Tech Talk on Xwiki's documents, and application
programming in Xwiki: http://www.youtube.com/watch?v=xs3LuzwqemM .. They've
gone "2.0" since this talk, but the overall flavor is the same.
For example, here's a trivial app I wrote which queries the Xwiki document
database that comprises my website, and returns a timeline of documents
published on the site:
http://nielsmayer.com/xwiki/bin/view/Main/SiteTimeline
(source code xar/jar:
http://nielsmayer.com/xwiki/bin/download/Main/SiteTimeline/SiteTimelinePkg.xar)

<http://nielsmayer.com/xwiki/bin/view/Main/SiteTimeline>The wiki
code<http://nielsmayer.com/xwiki/bin/view/Main/SiteTimeline?viewer=code>of
this app is boilerplate; the main business of this app happens inside
the
document's "XWiki.JavaScriptExtension[0] object, via Hibernate Query,
processed via the Xwiki API, and "scripted" in Velocity. This code is used
to generate Javascript for the Simile-Widgets
Timeline<http://simile-widgets.org/timeline/>used for the display.
(The Xwiki Java API calls are prefixed with "$xwiki."
"$util." "$request."  below):

#set( $at_start_p = true )## #set( $hqlQuery = ", XWikiRCSNodeInfo as ni
where doc.id=ni.id.docId and ni.id.version2=1 and doc.space<>'XWiki' and
doc.space<>'Main' and doc.space<>'Panels' group by doc.space, doc.name order
by max(ni.date) desc")## #set( $recentlyChangedDocuments =
$xwiki.searchDocuments($hqlQuery, $util.parseInt($request.changesNb), 0))##
var tl_events = [ #foreach( $rcName in $recentlyChangedDocuments )##{ #set(
$rcDoc = $xwiki.getDocument($rcName) )## #set( $docTitle =
$rcDoc.getDisplayTitle().replaceAll('"','\\"') )## #set( $docEpoch =
$rcDoc.date.getTime() )## #if($at_start_p == true) ## { #set( $at_start_p =
false )## #else ## }{ ,## #end ## } new Timeline.DefaultEventSource.Event({
start: epoch_date($docEpoch), end: null, latestStart: epoch_date($docEpoch),
latestEnd: null, instant: true, text: "$docTitle", description:
"<TABLE><TBODY><TR><TH>Link: </TH><TD><A href='${rcDoc.getURL()}'
target='_blank' >${rcName}</A></TD></TR><TR><TH>Date:
</TH><TD>$xwiki.formatDate($rcDoc.date)</TD></TR> #if("$!rcDoc.author" !=
"") <TR><TH>Author: </TH><TD><A
href='${xwiki.getURL("${rcDoc.author}","view")}' target='_blank'$
>$xwiki.getLocalUserName(${rcDoc.author}, false)</A></TD></TR> #end
#if("$!rcDoc.creator" != "") <TR><TH>Creator: </TH><TD><A
href='${xwiki.getURL("${rcDoc.creator}","view")}' target='_blank'
>$xwiki.getLocalUserName(${rcDoc.creator}, false)</A></TD></TR> #end
</TBODY></TABLE>", image: null, link: null, icon: null, color: null,
textColor: null }) #end ];
It would be much nicer to be able to use Clojure to dynamically generate
JSON on the server side. That's certainly one of the things you can do with
Xwiki, even though normally you'd be using it to dynamically generate HTML
documents or applications. For example, I'm looking at using closure to
access the Xwiki API to persist some information from my application in
Xwiki "documents" (everything in xwiki is a wiki-document) implemented via
Exhibit <http://simile-widgets.org/exhibit/>, that look like this:
http://nielsmayer.com/xwiki/bin/view/Exhibit/NPRpods3 (a work in progress).

Niels
http://nielsmayer.com

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to