You will need to do it manually so that the spring restart happens once per
batch instead of once per module.

I don't like how the module system has to start up, but its worked for the
last 5 years and I've never had a chance to refactor it.  You must first
start the module in the api layer, then start it in the web layer.  The
latter is where spring is restarted for you (unless you ask it to delay the
spring restart).  Spring doesn't need to be restarted for all modules, only
90% of them. Your choice of whether you want to support that or not.

1) Load each module.  See ModuleFactory.loadModules(modulesToLoad)
2) Then start all loaded modules in the api layer.
ModuleFactory.startModules();
3) Then loop over each started module and "start" it in the web layer:

(see org.openmrs.web.Listener.performWebStartOfModules)
for Module mod in ModFactory.getStartedModules():
  WebModuleUtil.startModule(mod, servletContext, /* delayContextRefresh */
true)

// do this only once after all modules have been started
WebModuleUtil.refreshWAC(ServletContext, false, null)

4) ???
5) Profit!

(sorry, couldn't help but throw that
meme<http://knowyourmeme.com/memes/profit>in there)

Ben

On Thu, May 10, 2012 at 3:36 AM, Darius Jazayeri <djazay...@gmail.com>wrote:

> Hey Ben,
>
> I did what may have been an incorrect initial attempt at the distro/ozip
> approach, by just having a controller delete file from and copy them into
> the modules folder. I imagine that would work, but I'd have to ask the user
> to restart OpenMRS themself, which is non-ideal.
>
> So I'm going to try to rewrite my code to start and stop the relevant
> modules from the zip file in-place. Do you know where exactly the spring
> application context is restarted though? Does that happen each time I do a
> ModuleFactory.startModule, or a WebModuleUtil.startModule? Or is it
> something I have to manually make happen?
>
> -Darius
> ------------------------------
> Click here to 
> unsubscribe<lists...@listserv.iupui.edu?body=SIGNOFF%20openmrs-devel-l>from 
> OpenMRS Developers' mailing list

_________________________________________

To unsubscribe from OpenMRS Developers' mailing list, send an e-mail to 
lists...@listserv.iupui.edu with "SIGNOFF openmrs-devel-l" in the  body (not 
the subject) of your e-mail.

[mailto:lists...@listserv.iupui.edu?body=SIGNOFF%20openmrs-devel-l]

Reply via email to