There has been ample discussion about the issue, and I have demonstrated the thing on the meeting of thursday. So I suppose now anybody should more or less know where this is about.
But a short description anyway. Introduction ------------ MMBase configuration is now most oftenly stored in the MMBase config directory. Originally this directory needed to be configurated with a 'mmbase.config' setting, later it's default became WEB-INF/config. Some new code (e.g. storage layer), perferred to fetch configuration-like resources by class-loader. The ratio for that was that using a _directory_ and opening resources as _file_ is not actually a good way to open resources, because it may not be sure that those can be available (e.g. when running as a war). Furthermore, some configuration hardly is configuration, but limits code, and you may want it not to bloat the configuration directory, by that suggesting that there may be something to configure there. Proposal -------- Addition of a 'ResourceLoader' class in org.mmbase.util (plus some related classes), which then should become the preferred way of opening mmbase resources (read 'configuration files'). The 'optimization' project will then be responsible of making sure that it is actually used all over the placed (but, I have done that on most places already, so it will not take long). ResourceLoader can currently load resources as mmbase-node, file, servlet-resource, or by class loader. All those 4 have their own advantages and disadvantages. The second and third of this list are often equivalent (the second works not in war, but can be 'watched'). The last one is currently unused, but can be used to add configuration to jars. The first one can be enabled by placing the 'resources' builder. The ResourceLoader is also capable of storing resources (if necessary in a builder), so it can also be used by tools which target modification or creation of MMBase configuration (e.g. the current admin-pages, packaging project). ResourceLoader is implemented as a ClassLoader, which will make it useable in a later stadium e.g. to load classes and load resourcebundles. There will be one clear way to load a resource from the code which will work (or can be configured to work) in any situation. It will generally be possible to adapt the code backwardscompatibly, though this may not always be worth the trouble (e.g. would it be worth the trouble adapting editwizard code backwardscompatibly for that case that someone extened the code?). The risque that placing configuration may become harder is present, but I think all-in-all it will become easier. Because it solves the current issues (storage, fieldtypes..), and addes a 'resourceeditor' which clearly shows which resources are available and where and how they are stored. When using resourceloader to place the configuration, the matter is completely transparant. Anyhow it will add much flexibility (e.g. you may run the same war in production and test, and override only some details in it etc. etc.). Todo ---- Currently resource-loader itself is configurable by the 'mmbase.config' and 'mmbase.htmlrootdir' settings and by the yes or not installing of the resources builder. We may add a configuration resource to make this more explicitely, and more pluggable (e.g. someone mentioned the possibillity of remote resources, so I imagine that it would be nice to plug that in). This could be done as a 'bugfix' (need more configurability) or as a seperate hack (e.g. by someone who actually has/need such a 'remote configuration'). This may involve the publication of some of the inner classes. Speaking of inner classes, there is one 'inner' class present in the code, which I've put there only for convenience (EncodingDetectingOutputStreamWriter), this will of course become a stand alone class. References ---------- The generic 'resource editor' demonstrates the features: http://mihxil.komputilo.org/mm18/mmbase/admin/default.jsp?category=admin&subcategory=resourceedit api-doc can be found on: http://mihxil.komputilo.org/MMBase/api/org/mmbase/util/ResourceLoader.html and the code itself can be found in speeltuin/mihxil/resourceloader Since this allows for running mmbase as a war (this one I installed 'life' thursday evening): http://mihxil.komputilo.org/MMBase/mmbase.war Furthermore, I refer to the discussions on this list. START OF VOTING: 2004-11-08 10:00 END OF CALL: 2004-11-11 10:00 [_] +1 (YES) [_] +0 (ABSTAIN ) [_] -1 (NO), because : [_] VETO, because: -- Michiel Meeuwissen mihxil' Mediacentrum 140 H'sum [] () +31 (0)35 6772979 nl_NL eo_XX en_US
