Skip to content
Branden Ogata edited this page May 14, 2015 · 6 revisions

Prerequisites

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 8

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.

Play Framework

The Play framework is available for download at https://playframework.com/download. Detailed instructions on how to install the Play framework are available here.

PostgreSQL

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.

PGAdmin New Database

Enter reefnexus for the database name and put your user name as the owner.

PGAdmin Database Setup

The reefnexus database used for this application should then be ready for use.

PGAdmin Database Complete

Note that the instructions above are for Windows machines and the process of configuring PostgreSQL may differ for other operating systems.

Installation

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:

Import Project

Next, navigate to the project directory and click OK.

Select Directory

Make sure that SBT is selected under Import project from external model, then click Next.

External Model

Check the Use auto-import checkbox in the upper left, then click Finish.

Settings

Development

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....

Analyze > Inspect Code

Next, click OK in the window that appears.

Specify Inspection Scope

The results of the analysis should appear in the IDE.

Inspection Results

Project Structure

Controllers

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.

Models

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.

ER Diagram

Views

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

Global.java seeds the database with preliminary data.

Tests

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.

Deployment

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.