Development Installation
On this section we cover the complete procedure to setup a development environment for the SWIM backend. The current development version of the SWIM backend runs on a CentOS 7 virtual machine.
Requirements
- CentOS 7 64bit (native or virtualized)
- Virtual Box 5.1.26 (if using VM)
- VBoxGuestAdditions 5.0.16 (optional)
- Java JDK 1.8 or latest
- GAMS 24.7.4 - March 16, 2016 - Linux 64 bit
- Apache Maven 3.5 or latest
- Mongo DB
Environment Setup
Virtual Machine with VirtualBox
- Download and install Virtual Box [1].
- Download and Install a clean CentOS or virtual box image [2].
- Start CentOS 7.
- Update CentOS 7 to the latest release with the command line.
# yum clean all
# yum update
# reboot
- To use full screen resolution capacity VBoxGuestAdditions would need to be installed.
Mount the iso file to your virtual machine drive and follow the instructions presented here.
If guest additions is successfully installed, you will be able to use full screen resolution for the CentOS virtual machine.
Java Dependencies
- Make sure that the current Java JDK version installed is 1.8 or higher.
- You can use the command line to check current version:
# java -version
- You can download the latest version of the Java JDK here.
- Install Apache Maven
- Check if Maven was properly installed using the following command:
# mvn --version
MongoDB
- MongoDB is used as the default database manager to store model executions.
Download and install the community edition of MongoDB - Import a clean instance of the mongo watermodels database into mongoDB (Available Soon).
GAMS Installation
- Download GAMS version 24.7.4 from here
- Follow the GAMS documentation for installation instructions here
Local Maven Repository for GAMS API
- In order to use the GAMS API as a Maven dependency, a local custom repository will need to be created.
Using the command line type the following command, making sure the GAMS installation paths are correct:
# mvn install:install-file -Dfile=/opt/gams/gams24.7_linux_x64_64_sfx/apifiles/Java/api/GAMSJavaAPI.jar -DgroupId=org.gams.api -DartifactId=gams-api -Dversion=1.0 -Dpackaging=jar
- Copy the GAMS API dependency files (/opt/gams/gams24.7_linux_x64_64_sfx/apifiles/Java/api) to the same path as where the maven repository was created (.m2 folder on the current user directory).
Install and Run WMD service.
Note: Public repository will be available after first formal release.
- Download or clone the public repository of the water modeling backend.
- The source project can be located on the following directory:
\water-modeling-backend\Java\orchestrator
- Modify the settings.yml according to your installation paths and desired ports.
- Open the selected system ports if the service will be available from outside the host.
Running as a web service
1. Run a Maven install command on the project.
2. Execute the compiled jar with the following command from the orchestrator directory:
# java -jar target/wmd-0.9.jar server settings.yml
3. If execution is successful the webservice will be available at localhost:port
4. Go the Tutorials>Water Modeling Webservice for documentation on how to test the webservice.
Running standalone from eclipse
1. Install the latest version of eclipse [6].
2. Import the Maven project into eclipse
File > Import ... > Maven > Existing Maven Projects
3. Select the project folder Java/orchestrator on the repository.
4. Execute a maven install by right clicking on the project and navigating to:
Run as > Maven install
5. Copy the GAMS API Java library files into the generated target directory of the project.
6. Modify the App.java file inside the utep.cybershare.edu package according to your environment paths.
Line 49: model scenario input json file.
Lines 53-57: MongoDB connection parameters.
7. Modify the BucketV4_Dev.java file inside the utep.cybershare.edu.runner package according to your environment paths.
Line 164: GAMS work path and GAMS installation path.
Line 200: GAMS model file .gms
Water Distributor Lite
The Water Distributor Lite is a simplified Java application that reads a model scenario specification and executes a corresponding gams model without database and webservice dependency code. The project is available under Java/WMD-Lite.
Note: The current prototype version will be updated before the formal release of the full WMD application.
References
[1] Virtual Box - https://www.virtualbox.org/wiki/Downloads
[2] Osboxes.org - http://www.osboxes.org/centos/
[3] VBoxGuestAdditions - https://wiki.centos.org/HowTos/Virtualization/VirtualBox/CentOSguest
[4] GAMS - https://www.gams.com/
[5] MongoDB - https://www.mongodb.com/
[6] Eclipse - https://eclipse.org/
Contact Information
Luis Garnica Chavira
Research Associate
University of Texas at El Paso
lagarnicachavira@utep.edu