From: Marc P. <ma...@an...> - 2003-03-26 19:48:18
|
Hi all, I'm trying to create instances of WM at runtime based on the "modules" a user has configured in this webapp I'm writing. Basically each "module" has its own properties file with settings for the webapp, but also they can supply WebMacro properties that would normally be in WebMacro.properties. The problem is that I need to load templates from the webapp context, but if I use the WM(Servlet) constructor I cannot force it to use a specific .properties file for the settings. If I don't use the WM(Servlet) constructor, things won't work obviously. I'm using the delegating template provider and need to use webapp:/WEB- INF/templates (for example) as a path. I think I would need to introduce a new ctor for WM - WM(Servlet, String configFile). What do you think? Following on from this, I actually want my webapp to predetermine some of the settings, without them existing in a file. For example I want to set the template provider to the delegating template provider, and set the default template path to webapp:/WEB-INF/templates and webapp:/templates and webapp:/ - and still allow the module writer to override this with new settings in their module properties file. To do this programmatically I would plan to create a Properties object and set my template path properties on it. Then I would create another Properties and set the first Properties I created as its "ancestor" in the constructor - and then load the module's specific properties into it. THEN I would pass that Properties to the constructor of WM... which I can't. Is there any reason anyone can see why I can't just add a ctor to WM that takes a Properties object instead of the filename? Of coure I'd have to add WM(Servlet, Properties) too. Thoughts? Marc |