Module Config File


The module config file gives vital information about the module to OpenMRS. The config file is parsed and this causes appropriate files to be loaded/cached.

The xml doctype for the config file should be defined as:

<!DOCTYPE module PUBLIC "-//OpenMRS//DTD OpenMRS Config 1.0//EN" "http://resources.openmrs.org/doctype/config-1.0.dtd">


id: Very important. Should be unique for all modules. Serves as the module's identifier

name: Descriptive name used for display purposes

version: Should be in the form of x.x Used for compatibility comparisons

description: Text describing the module. Used for display

require_version: Text giving the minimum version of the core OpenMRS that is required to run this module. (Example: 1.1.0)

require_modules: Allows you list modules that this module depends on.

activator: full path to activator. Must implement org.openmrs.module.Activator Contains startup/shutdown code for the module

updateURL: Http URL to the location of the update.rdf file

extension

  • Must have child elements 'point', and 'class'.
  • See extension points
  • point: String referring to the unique extension point labeled the same in the code
  • class: Full path to the java class that will be called. Must implement org.openmrs.module.Extension

advice

  • Must have child elements 'point', and 'class'.
  • See Aspect Oriented Programming (AOP)
  • point: String referring to one of the interface of one of the services: i.e. org.openmrs.api.PatientService
  • class: Full path to the java class that will be called. Must implement org.aopalliance.aop.Advice or org.springframework.aop.Advisor

privilege

  • If the privilege doesn't exist in the OpenMRS system when the module is started, the privilege is added
  • Must have child elements 'name, and 'description'.
  • name: privilege name. Should be unique across OpenMRS
  • description: Text describing the privilege. Added as default description.

globalProperty

  • If the global property doesn't exist in the OpenMRS system when the module is started, the property is added
  • 'property' and 'description' are required. 'defaultValue' is optional
  • property: Name of the global property
  • defaultValue: Value of the property if it doesn't exist (defaults to the empty string)
  • description: Text describing the property.

dwr

  • Contains dwr code similar to what would be put in dwr.xml
  • Should contain an 'allow' and an optional 'signatures' element.

servlet

  • Servlets defined by modules are accessed via /openmrs/moduleServlet/moduleId/servlet-name
  • Must contain both 'servlet-name' and 'servlet-class' elements
  • See Module Servlets
  • servlet-name: name/path used for the servlet
  • servlet-class: Full path to the java class implementing javax.servlet.http.HttpServlet

messages

  • lang: two letter language for the locale
  • file: name of the file (i.e. messages.properties or messages_*.properties)

The elements id, name, version, package, author, description, and activator are all required. The remaining elements are optional.