Have you implemented OpenMRS? Please participate in the Implementation Site Survey. If you already have, thank you!
Child pages
  • 2009 Implementers Group Meeting Program ModuleArchitecture
Skip to end of metadata
Go to start of metadata

Module Architecture

Ben Wolfe gave this presentation, and the basic format was a tour of the source packages, the ModuleActivator class, and the config .xml files.

portlets, resources, tags are special folders made to contain portlets, module resources (like .css, .js, .xml files), and custom tags, respectively.

config.xml includes the items' extension points, required other modules, AOP, required privileges, required Settings (formerly Global Properties from 1.9 downwards), dwr, servlets.

applicationContext.xml includes spring configuration info, most notably mapping URL to controller.

Ben used the basic module to demonstrate how to write a simple jsp/controller that created an observation for a patient based on user input.

Notes based on user questions

  • Liquibase as a replacement for sqldiff is probably the next architectural change. This change will probably be released in openmrs 1.6 or 1.7.
  • Module activators don't have access to that module's own services.
  • JUnit:
    • To use your own module's services in a junit test, be sure to include your module's /dist folder in the classpath.
    • The junit framework in openmrs 1.5 has changed slightly, so the junit tests in older modules may have to be upgraded.
  • Request parameters can be extracted from the request with spring's ServletRequestUtils object
  • 'Attach source' in eclipse is your friend - a great way to view the source code for a jar.
  • To include a module in your openmrs installation at tomcat start, be sure that the module folder global property is set, and then add your .omod files (i.e., modules) to this folder. They will be loaded at tomcat start.
  • Jar files included in lib will be packaged with the module; lib-common is for jar files that are expected to already be loaded through the openmrs core. The will not be packaged.
    There is an eclipse plugin that allows you to auto-generate a module's package configuration, although the jar files in the lib folders are old, and you will have to update these.
  • No labels