Getting Started Guide: Back-end Development

The functionality in OpenMRS core should not be changed directly. OpenMRS modules need to be created for additional features like new REST resources, services and datamodel changes that are required by modules. This is the back-end development that needs to be done as part of the Raxa-JSS project.

Software required to start:

  1. JDK 1.6 update 30 and higher (1.7.0_03 and higher, if you want to use JDK7)
  2. Netbeans IDE with MySQL and Tomcat
  3. OpenMRS standalone available here: http://openmrs.org/download/

Install Netbeans, Getting code and Building OpenMRS

  1. Install Netbeans by downloading from here. The JavaEE bundle is adequate, but all will do as well.
  2. Set the following Environment variables to be able to give enough memory to Java and Maven.

    JAVA_OPTS = -Xms512m -Xmx1024m -XX:MaxPermSize=256m
    MAVEN_OPTS = -Xms512m -Xmx1024m -XX:MaxPermSize=256m
  3. After installation, create a fork of https://github.com/raxa/raxacore and clone your local repo

Expert Mode:

Software required to start:

  1. JDK 1.6 update 30 and higher (1.7.0_03 and higher, if you want to use JDK7)
  2. Netbeans IDE (You may use IDE of your choice - for Eclipse configuration, you can look here: https://wiki.openmrs.org/display/docs/Step+by+Step+Installation+for+Developers)
  3. OpenMRS standalone available here: http://openmrs.org/download/
  4. (optional – this comes with NetBeans) MySQL server (and a nice GUI client to manage the database is useful - SQLYog)

Install MySQL

  1. Create database openmrs (hint: create schema openmrs OR use a nice GUI client)
  2. We will use the root password to connect to openmrs from the application. So make sure to remember the root password

Install Netbeans, Getting code and Building OpenMRS

  1. Install Netbeans by downloading from here. The JavaEE bundle is adequate, but all will do as well.
  2. Set the following Environment variables to be able to give enough memory to Java and Maven.

    JAVA_OPTS = -Xms512m -Xmx1024m -XX:MaxPermSize=256m
    MAVEN_OPTS = -Xms512m -Xmx1024m -XX:MaxPermSize=256m
  3. After installation follow the page here: Using Maven in Netbeans. In summary you have to do the following:
    1. Activate features from plugins (Java SE, Java Web and EE, Web Applications)
    2. Checkout OpenMRS from SVN (For Raxa we are using the stable 1.8 branch - http://svn.openmrs.org/openmrs/branches/1.8.x/)
    3. Skip tests for builds that are not directly related to testing
    4. Clean and Build the main OpenMRS project

Deploying OpenMRS and installing a clean OpenMRS

  1. The above steps created an openmrs.war in the webapp/target folder. This can be directly deployed to the Apache Tomcat (for production testing) or as developers we will run this through Jetty.
  2. To run, OpenMRS in jetty (and this is recommended for developers), open the openmrs-webapp project in Netbeans, right-click on it and select Custom -> Goals. In the Goals textfield, type jetty:run, checkbox 'Remember as' and type JettyRun in the textfield. Press OK. This will run the maven jetty:run task and will deploy openmrs to port 8080 on your localhost. In the output window, once you can see the below, you should open your browser (Chrome or Firefox preferred)

    ...
    Started Jetty Server
    Starting scanner at interval of 10 seconds
  3. In the browser go to address:

    http://localhost:8080/openmrs
  4. This will show the installation wizard for OpenMRS and you should follow the different screens and complete the initial setup of OpenMRS.
  5. After installation is complete, download the source for the module you'd like to contribute to:
    1. raxacore - https://github.com/Raxa/raxacore
    2. patientimage - https://github.com/Raxa/patientimage
    3. jsslab - http://svn.openmrs.org/openmrs-modules/jsslab/trunk/ (You will have to use the demo data that works on top of the OpenMRS test data or by itself.  Those tables named "labtest_<name>" should be added to the other tables with the command "INSERT INTO table SELECT * FROM labtest_table. This demo data is available in Lab Rats Dropbox folder)
    4. pharmacy - https://github.com/Raxa/pharmacy/tree/master/trunk

Tutorials and Online Resources for Back End Development

  1. IBM tutorial on REST + spring http://www.ibm.com/developerworks/library/wa-spring3webserv/index.html