cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bertrand Delacretaz <bdelacre...@apache.org>
Subject Re: Instantiating a class on Cocoon startup
Date Mon, 01 Aug 2005 13:31:55 GMT
Le 1 août 05, à 15:05, Christoph Hermann a écrit :
>> ...*BUT*, maybe you just need XMLFileModule[1]? ;-)
>> Or at least you should implement your own input module to easy obtain
>> your configuration.
>
> well, it looks very interesting. Is it documented somewhere in a more
> detailed way? i.e. how to access it from flowscript?

Here's an example which gets a value from an input module named "xyz"

function conf_get_nxms_value(path) {
     var module = null;
     var result = null;
     try {
         module  = cocoon.getComponent(InputModule.ROLE + 
"Selector").select("xyz");
         result = module.getAttribute(path,null,null);
         if(result==null) throw new java.lang.Exception("nxms 
configuration value '" + path + "' not found");
     } finally {
         // selected components need not be released, right?
     }
    return result;
}

This is perfect for reading configs from an XML file, with automatic 
reloading if the input module is configured for this.

-Bertrand

Mime
View raw message