Update of /var/cvs/documentation/backenddevelopers
In directory james.mmbase.org:/tmp/cvs-serv553
Modified Files:
resourceloader.xml
Log Message:
some documentation about the new 'utils/resourceloader' config file
See also: http://cvs.mmbase.org/viewcvs/documentation/backenddevelopers
Index: resourceloader.xml
===================================================================
RCS file: /var/cvs/documentation/backenddevelopers/resourceloader.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- resourceloader.xml 28 Nov 2006 18:40:03 -0000 1.2
+++ resourceloader.xml 19 Dec 2008 21:37:45 -0000 1.3
@@ -4,7 +4,7 @@
<articleinfo>
<title>The MMBase Resource loader</title>
<date>2005-12-09</date>
- <edition>$Id: resourceloader.xml,v 1.2 2006/11/28 18:40:03 michiel Exp
$</edition>
+ <edition>$Id: resourceloader.xml,v 1.3 2008/12/19 21:37:45 michiel Exp
$</edition>
<authorgroup>
<author>
<firstname>Michiel</firstname><surname>Meeuwissen</surname>
@@ -105,6 +105,59 @@
</para>
</section>
<section>
+ <title>Loading from jars. Configuring weights.</title>
+ <para>
+ Since MMBase 1.8.7 it is possible to configure which of a set of
otherwise equivalent resources
+ is the one to be used. This can occur with resources present in jars.
E.g. any jar can contain
+ a config/security/security.xml, and if there are no more important
resources, like an actual
+ file WEB-INF/config/security.xml, then it is possible that two or more
jars contain such a
+ resource. There is no intrinsic way to decide which of the jars provides
the 'best' version of the
+ said xml resource. On default it would simply take one, more or less and
random.
+ </para>
+ <para>
+ It is possible to attribute 'weights' to these classloader provided
resources, using the
+ 'classloaderpatterns' setting in the resource
config/utils/resourceloader.xml.
+ </para>
+ <programlisting><![CDATA[
+<?xml version="1.0"?>
+<!DOCTYPE util PUBLIC "-//MMBase//DTD util config 1.0//EN"
"http://www.mmbase.org/dtd/util_1_0.dtd">
+<util>
+ <properties>
+ <property name="classloaderpatterns" type="mergingmap">
+
<entry><key>!/org/mmbase/config/datatypes.xml</key><value>-1</value></entry>
+ </property>
+ </properties>
+</util>]]>
+ </programlisting>
+ <para>
+ This is the resourceloader.xml of the mmbase xml itself. The entry keys
are regular
+ expressions which match the url of the resources. If it starts with '!',
then that is
+ implicitely replaced with the url of the <emphasis>current
jar</emphasis>, which makes it
+ possible for a jar to define it's own weights, without having to know
its own name.
+ </para>
+ <para>
+ In this case the weight of the datatypes.xml in the mmbase jar itself is
made a bit lighter
+ then the default (0). This makes sure that it is read in before other
datatypes.xml (which are
+ read from light to heavy, so if the same datatype occurs twice, the
heaviest one will prevail).
+ </para>
+ <para>
+ In the cloudcontext security jar, we find the following entry:
+ </para>
+ <programlisting><![CDATA[
+ <entry><key>!.*</key><value>100</value></entry>
+ ]]></programlisting>
+ <para>
+ So, any resource in this jar is pretty 'heavy'. Most noticeably the
security.xml. This means
+ that if you install the cloud context security jar, that cloud context
security will be
+ active. Even if there would be another security.xml in one of the other
jars. There could
+ e.g. be a default security xml in the mmbase.jar.
+ </para>
+ <para>
+ This mechanism could e.g. also be used to ship variants of the mmbase
core builders in your
+ own jars.
+ </para>
+ </section>
+ <section>
<title>Multiple resources</title>
<para>
The implementor can also decide that conflict resolution is not actually
needed, but that
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs