cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jens Maukisch" <>
Subject AW: Instantiating a class on Cocoon startup
Date Mon, 01 Aug 2005 12:29:19 GMT

> is there a way in Cocoon to load a class on cocoon startup? 
> What i want to accomplish is like read some sort of 
> configuration file and then hold these values in memory while 
> cocoon is running. So i thought of building a xml file which 
> is loaded through xmlbeans into a static var or so. Thath way 
> i wouldn't have to load the configuration File on each 
> request. Can anyone give me some hints on how to accomplish this?

You can wirte an avalon component:

class ConfigManager implements Component, ThreadSafe, Initializable {

	String xmlConfig;

	public static String ROLE = ConfigManager.getClass().getName();

	public void initialize() {
		xmlConfig = ....;

	public String getConfiguration() {
		return xmlConfig;


and then you can get this component via the ServiceManager
e.g. in Flowscript:
var config = cocoon.getComponent(Packages.ConfigManager.ROLE);


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message