You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lenya.apache.org by "Gregor J. Rothfuss" <gr...@apache.org> on 2005/03/09 18:57:25 UTC

[Fwd: Experimental per-sitemap reloadable classloader]

as we ponder the plugins discussion, this seems highly relevant. if we 
can avoid the build & restart cycle, that would rock.

-------- Original Message --------
Subject: Experimental per-sitemap reloadable classloader
Date: Tue, 08 Mar 2005 23:52:14 +0100
From: Sylvain Wallez <sy...@apache.org>
Reply-To: dev@cocoon.apache.org
Organization: Anyware Technologies
Newsgroups: gmane.text.xml.cocoon.devel

Hi all,

Having to often write quick prototypes with Cocoon, I have on my laptop
one main Cocoon installation and a lot of subsitemap directories in
various locations, all mounted into the main Cocoon using the
mount-table matcher.

That works fine until the prototypes need some specific classes, as I
then hit the problem of deploying these classes. Some ant tasks
automatically copy the corresponding jars in the main WEB-INF/lib, but
that's really not convenient.

So I wrote in 2.2 an experimental per-sitemap classpath that allows each
sitemap to define its own specific classpath for the components defined
by <map:components>.

The syntax is as follows (the sitemap is in src/webapp hence the "../..").
<map:components>
  <map:classpath>
    <class-dir src="../../build/eclipse"/>
    <lib-dir src="../../lib"/>
  </map:classpath>
  <!-- other components -->
</map:components>

A side benefit, tremedously useful, is that the classloader is
re-created when the sitemap is reloaded. So this allows, by setting a
class-dir, to reload changed classes simply by touching the sitemap.

Maybe not as smart as an automatic compiling classloader, but as saving
in Eclipse automatically recompiles the classes, the productivity boost
is impressive, especially when combined with the component lazy-loading
mode.

This feature is intended for application development-time, as it doesn't
take into consideration instances of the previous versions of the
reloaded classes that may be stored here and there such as in session
attributes. That means that you may get some ClassCastException whenever
such a cases arises. This is the current price to pay for fast roundtrips.

Enjoy,
Sylvain

-- 
Sylvain Wallez                                  Anyware Technologies
http://www.apache.org/~sylvain           http://www.anyware-tech.com
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }



-- 
Gregor J. Rothfuss
COO, Wyona       Content Management Solutions    http://wyona.com
Apache Lenya                              http://lenya.apache.org
gregor.rothfuss@wyona.com                       gregor@apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org