[TransWarp] hotload config info

Joel Boehland jboehland at attbi.com
Sun Feb 9 22:40:36 EST 2003


Hello,
I am playing around with the peak and 
zope3 apis, trying to wrap my head 
around how they work. To test out some 
of the capabilities of the component 
architecture, I am working on 
implementing a simple services 
microkernel, roughly based upon the 
jboss jmx microkernel. As I have it now, 
the kernel loads its own config file 
(kernel.ini) by setting the PEAK_CONFIG 
variable to "conf/kernel.ini" and this 
works fine. I can subsequently make 
calls to lookup variables loaded in the 
kernel.ini. What I also want to do, is 
have a services directory, where each 
subdirectory would be a service 
component to be loaded by the kernel. 
Each of these subdirs would have their 
own module.ini file to hold 
component-level configuration info:

services-dir
|_module-1-dir
    |_module.ini
...
|_module-2-dir
    |_module.ini

I figured out how to load other .ini 
files into the global configuration 
space using code like the following:
 
config.loadConfigFile(config.getGlobal().__instance_provides__, 
     		 
"conf/module1/module.ini")
 From there, I can pull values out of 
the global config namespace using code like:
naming.lookup('config:module1.someproperty/')

This will work, but this sort of feels 
like a hack, so I'm wondering, is this 
the right way to approach per-component 
runtime configuration? Is it advisable 
to load the components config info into 
the global config namespace, or should I 
load it into a per-component config 
namespace? Is that is even possible?

The other thing that I'm trying to work 
out is how I would manage component 
loading/unloading at runtime. It would 
be useful to be able to remove a 
component's config info when undeploying 
a component at runtime, but I'm not sure 
how I would go about doing that.  Any 
ideas about this? Also, am I using the 
wrong frameworks to do this? Are the 
peak or zope3 frameworks designed to 
facilitate component 
loading/unloading/reloading at runtime?

Thanks for any info on this. I've been 
having fun playing with this code the 
last few days.

--Joel




More information about the PEAK mailing list