Developer Guide
This project requires the Java 8 JDK, the Play framework, and PostgreSQL. As of this writing, we have used IntelliJ IDEA as our IDE for this project; however, it should be possible to use other development environments to work on this project if desired.
Java is available for download at https://java.com/en/download/. Make sure to select the JDK, not the JRE. Once installed, typing in java -version
on the command line should produce something like the following:
> java -version
java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)
This application should work so long as the Java version begins with 1.8
.
The Play framework is available for download at https://playframework.com/download. Detailed instructions on how to install the Play framework are available here.
First, download PostgreSQL from http://www.postgresql.org/download/. Once PostgreSQL is configured, open pgAdmin III, expand the PostgreSQL server entry in the left panel, then right-click on Databases. Choose the New Database... option from the menu that appears.
Enter reefnexus for the database name and put your user name as the owner.
The reefnexus database used for this application should then be ready for use.
Note that the instructions above are for Windows machines and the process of configuring PostgreSQL may differ for other operating systems.
To download the project files to your system, clone the repository to your system. This can be accomplished through a GUI or executing git clone https://github.com/wengdg/reefnexus.git
from the command line.
Next, run activator test
from the command line to verify that all tests pass before making any changes to the system. (It is highly likely that not all tests will pass.) If the tests pass, you should see something like the following at the end of the output:
[info] Passed: Total 3, Failed 0, Errors 0, Passed 3
[success] Total time: 34 s, completed Apr 21, 2015 12:29:23 PM
Once this is complete, import the project into IntelliJ IDEA or your IDE of choice. To do this in IntelliJ IDEA, click on the Import Project button:
Next, navigate to the project directory and click OK.
Make sure that SBT is selected under Import project from external model, then click Next.
Check the Use auto-import checkbox in the upper left, then click Finish.
If using IntelliJ IDEA, the coding standards for this project should already be configured for you. Otherwise, the Checkstyle rules for this project are a combination of the guidelines in Elements of Java Style and some supplementary rules defined here. The Checkstyle configuration file for this project is available here.
To run the Checkstyle tests, open IntelliJ IDEA, then open Analyze > Inspect Code....
Next, click OK in the window that appears.
The results of the analysis should appear in the IDE.
The sole controller for this project is located in app/controllers/Application.java
. This handles the connections between the database and the pages shown to the user. Each method in Application.java
corresponds to a single page.
The models are in app/models
. Theses contain the representations of the data in the application. The primary classes here are Fish.java
and Location.java
, which represent fish species and geographic regions respectively.
The app/views
directory stores the files that control what the user will directly see and interact with. Each *.scala.html
file represents a single page in this application. Note that the file names begin with a capital letter; in accordance with Java coding standards, we have capitalized the first letter of the view names as these files will be compiled into Java classes.
app/views/bootstrap3
contains templates for form input; these were acquired from https://github.com/ics-software-engineering/play-example-form.
app/views/formdata
stores our backing classes. These essentially serve as intermediaries for conveying data throughout the application. For instance, FishFormData.java
is roughly equivalent to the Fish
model, but is designed to be easier to work with as all of its fields are public.
Global.java
seeds the database with preliminary data.
Our tests are currently very rudimentary and focus primarily on ensuring that pages load correctly (test/tests/Application.java
) and that the models work properly with the database (test/tests/ModelsTest.java
). We hope to eventually incorporate the FluentLenium testing framework and the Page Object pattern into our testing for this project.
This application is currently deployed on Heroku at http://www.reefnexus.com. To make changes to the deployed application, first notify Danny Weng to acquire permission to modify the Heroku deployment, then follow the instructions here to set up a Git remote for the Heroku site.
Once the remote is set up, type in git push heroku master
to push your code to the Heroku server.