Hi,

> 
> 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:

e.g.:
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);
print(config.getConfiguration());

hth
Jens


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to