-------------------------------------------------------------------------
(c) 2011-2014 OpenInfobutton Project, Biomedical Informatics, University of Utah
Contact: <andrew.iskander@utah.edu>
Biomedical Informatics
421 Wakara Way, Ste 140
Salt Lake City, UT 84108-3514
(801) 581-4080
-------------------------------------------------------------------------

Changes for version 1.6
-----------------------

-Modules have been refactored further to cut down on autogenerated source code in the repository
-Unit tests have been added to test functionality in each individual module
-Jacoco and Checkstyle plugins have been integrated to ensure compliance with OSEHRA development standards
-Parameters for database and UMLS connections are now found in the master POM, rather than in the submodules


Build Guide For OpenInfobutton Manager

1 - Initial Setup
2 - Building
3 - Building with CMake

Initial Setup
-------------

1) Clone the entire Innovation-182 branch you'd like to build. 

2) Install JDK 7.0, which can be downloaded from 
   http://www.oracle.com/technetwork/java/javase/downloads/index.html
   Use version of 1.7.0_17 JDK or higher.

3) Make sure that your JAVA_HOME environment variable is set to the newly
   installed JDK location, and that your PATH includes %JAVA_HOME%\bin
   (windows) or $JAVA_HOME$/bin (unix).

4) Install Maven 3.0, which can be downloaded from 
   http://maven.apache.org/download.html. Make sure that your PATH includes 
   the $MVN_HOME/bin directory. 
   
5) Install a MySQL 5.0 server instance on the server you're building.
   http://dev.mysql.com/downloads/mysql/
   
6) If you are behind a proxy, keep in mind that additional setup will be
   required as the build process and the service itself requires an unhindered 
   connection to the internet.

7) Obtain a UTS account from here, 
   https://uts.nlm.nih.gov/home.html
   

Building
--------

1) Execute all the SQL scripts found in the Innovations-182/DeploymentPackage/sqlWithInsert directory. 

   Additionally, execute the SQL script found in Innovations-182/DeploymentPackage/sqlDump/prodoib_logs.sql. 

2) Navigate back to the oib-request module directory (this directory)

3) The oib-request master module's pom.xml includes the following properties block,

   <properties>
       <dts-version>3.5.0</dts-version>
              
		<datasource1.url>jdbc:mysql://localhost:3306/prodoib</datasource1.url>
		<datasource1.driver>com.mysql.jdbc.Driver</datasource1.driver>
		<datasource1.user></datasource1.user>
		<datasource1.password></datasource1.password>
		
		<datasource2.url>jdbc:mysql://localhost:3306/profilesdbprod</datasource2.url>
		<datasource2.driver>com.mysql.jdbc.Driver</datasource2.driver>
		<datasource2.user></datasource2.user>
		<datasource2.password></datasource2.password>
		
		<umls.username></umls.username>
		<umls.password></umls.password>
   </properties>
   
   Set these to match your local database connection parameters and UTS account.

4) Run

         $> mvn clean install

   This will compile the OpenInfobutton Manager and run all of the tests in the 
   oib-request source module. Alternatively, you can run

         $> mvn install -Dmaven.test.skip=true

   This will compile OpenInfobutton without running the tests in case you encounter problems
   with the database connections or have not yet obtained a UTS account.

   It usually takes some time for maven to download required dependencies 
   in the first build.

5) Upon a completed build, the WAR will be found under the oib-request-service/target directory. 
   Simply deploy it to a functional Java EE servlet container and you should be able to
   start firing requests at it. Alternatively, you can also use the following maven command to start an
   instance of the manager in a self contained Tomcat 7 container.
   
   mvn clean tomcat7:run-war -Ddatasource1.password=mypass -Ddatasource2.password=mypass -DskipTests
   
Building with CMake
--------

1) The OpenInfobutton Manager module includes a CMakeLists.txt file. If you use a recent
   version of CMake in your development environment, you simply have to check the MySQL connection
   parameters in the following files,
   
   oib-request/CMakeLists.txt
   
   oib-request/pom.xml
   
   and the execute the following commands from the module directory,
   
   cmake CMakeLists.txt
   
   ctest
   
   This should exectute the SQL scripts and build the project as well. 
   
   
   
   
   
