(assuming you agree that xwiki-backed sites like http://www.idiva.com ,
http://www.curriki.org or http://www.bestventes.com constitute
"serious web apps"...)

On the Xwiki devs list, I inquired:
http://lists.xwiki.org/pipermail/devs/2009-July/013763.html about using
Clojure as a scripting language in Xwiki,   via JSR-223. I got two very
helpful replies:

(1) http://lists.xwiki.org/pipermail/devs/2009-July/013764.html

*Asiri Rathnayake* *Sun Jul 26 10:43:25 CEST 2009*
> [...]
> >* Clojure <http://groups.google.com/group/clojure> has a JSR-223 *
> implementation
> > according to:
> > http://github.com/pmf/clojure-jsr223/tree/master
> >* http://groovy.codehaus.org/JSR-223+access+to+other+JVM+languages*
> >
> http://sayspy.blogspot.com/2009/03/interacting-between-jvm-lang-here-and.html
> >
> > Are there any examples, documentation, or suggestions of writing a
> "script* macro" to call a new jar in WEB-INF/lib ?*
>
1. Put the Clojure jar file <
http://repo1.maven.org/maven2/org/clojure/clojure/1.0.0/clojure-1.0.0.jar>
inside WEB-INF/lib directory

2. Build the Clojure JSR223 engine from
http://github.com/pmf/clojure-jsr223/tree/master and place it inside
WEB-INF/lib

3. Restart your xwiki and use the script macro as below:

{{script language="Clojure"}}
// Put your clojure script here.
{{/script}}

(Note that since context is a reserved binding in JSR-223 specifications
used for Scripting Macros, the XWiki Api Context is now accessible through
xcontext.)

I haven't myself tried out clojure inside xwiki but I built a ruby
macro<http://code.xwiki.org/xwiki/bin/view/Macros/RubyMacro>(for
2.0M2) just by following the steps I described to you :)

Question: does  anybody have any hints, warnings, potential "gotchas"
regarding this part: "Build the Clojure JSR223 engine from
http://github.com/pmf/clojure-jsr223/tree/master and place it inside
WEB-INF/lib" ??

(2)  http://lists.xwiki.org/pipermail/devs/2009-July/013767.html

From: Vincent Massol
Date: Sun, Jul 26, 2009 at 10:21 AM
[...]
Well all you need is drop the JSR223 jar in WEB-INF/lib and then you can use
the new language using the script macro:
http://code.xwiki.org/xwiki/bin/view/Macros/ScriptMacro

Then if you want you can write a wrapping macro such as we've done for
groovy and jruby so that it can be called with {{clojure}} instead of
{{script language="clojure"}}.

>* PS: Here's examples of easy "scripted java" programming you can do in*
>* Clojure (note the helpful parallelism constructs):*
>*
http://travis-whitton.blogspot.com/2009/07/network-sweeping-with-clojure.html
*
**>*
http://travis-whitton.blogspot.com/2009/06/clojures-agents-scientists-monkeys-and_18.html
*
**>
**>* It could be very useful to employ massive parallelism via such Clojure*
>* scripts, which could achieve a xwiki-based web portal performance akin to
*
>* Yahoo's, Google's, etc. For example, the following describes how Yahoo
works*
>* -- and would be quite easy to implement this kind of processing "for
free"*
>* in Clojure with very little code:*
>
>* http://research.yahoo.com/files/pnuts.pdf*

I'm definitely +1 to make it part of the XWiki platform (same as for jruby)
if you develop it. Similar to jruby I don't think we should
package it in the default WAR though but as an optional download to install
(will be even easier with the app manager).

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