/swe-senior-design

Backend for ENGG4000 Capstone Project

Primary LanguageJava

Software Engineering Senior Design Project

The code is organized as follows:

  • api contains all the web service controllers that provides various APIs and security features
  • core is the business logic layer, which includes BO entities and services
  • application is where the high-level services exist, which includes DAOs and adapters
  • infrastructure contains all the implementation classes as the technique details

Setup Environment for Development

You will need to install the IntelliJ IDE from JetBrains. You can download the community edition for free, or use your student email to get the complete version. This walkthrough also assumes you are developing on a Unix-based system.

You will also need to download and install Java JDK 10. You can verify which version you are using by running java --version at the command line.

Environment Setup

First, you'll need to checkout a copy of the repository on your local machine. All communication with the remote repository should be done over SSH, so you must first generate an SSH keypair and link it to your GitLab account. You can find the complete details here.

First, you can check if you have already generated an SSH keypair by running the following in the terminal.

ls -la ~/.ssh

To generate a new SSH keypair, run the following and follow the prompts:

ssh-keygen -t rsa -b 4096 -C "your_email@example.com"

Next, you can add the SSH key to your key-agent:

eval "$(ssh-agent -s)"
ssh-add -K ~/.ssh/id_rsa

Next you will need to add your SSH public key to your GitLab account. Once your public key is associated to your GitLab account, you can clone the repository into your IntelliJ working directory.

git clone git@gitlab.com:brandon1024/swe-senior-design.git
cd swe-senior-design

Once complete, you can import the project into IntelliJ by selecting Import Project and selecting the swe-senior-design directory. Select Import Project from External Model and select Gradle from the list. Use the default settings and import the project.

IDE Configuration and Run Configurations

First and foremost, you will need to configure the project Code Style settings. These settings are already configured in the repository .idea folder, but you will need to ensure you are using the project settings and not the system settings. To do this, navigate to the IntelliJ preferences window, select Editor, then select the Code Style top level node. In the Scheme dropdown, select Project.

Next you will need to configure Lombok. The Lombok Project is a Java library that uses annotations to simplify your code. You will first need to install the Lombok plugin by navigating to the preferences window, select Plugins, then press the Browse Repositories button. Search and install Lombok Plugin.

In the preferences window, you will also need to enable Enable Annotation Processing, which can be found by selecting Build, Execution, Deployment, then Compiler, then Annotation Preprocessors.

Database Configuration

This project relies on PostgreSQL, so you will need to ensure you have it installed. If you don't, here are some links to get you started:

Using the PG Admin tool, you can create a new database named kick_the_bucket_dev. You will also need to create a new user named root with password password.

Although it isn't necessarily required, JetBrains DataGrip is a very useful tool for managing the database users and schemas. Once you have DataGrip installed, create a new connection with the following parameters:

  • Connection Name: swe-senior-design (note: this name is irrelevant)
  • Hostname: 127.0.0.1
  • Port: 5432
  • Username: root
  • Password: password

Click the Test Connection to ensure you're able to connect to the PostgreSQL server.

Spring Configuration

If you plan to use the Amazon S3 integration through the user profile picture upload API, you will need to configure your local development environment with the necessary credentials for communicating with AWS S3.

First, you will need to obtain the AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY for the development IAM user. This provides programmatic access to the S3 buckets for development.

Next, configure your IDE Run Configuration with the credentials provided as environment variables, of if you are executing the server from the command line, you will need to export the environment variables:

export AWS_ACCESS_KEY_ID=<your access key>
export AWS_SECRET_ACCESS_KEY=<your secret key>
./gradlew bootRun

Running the Server

Run the following at the command line from the root of the project.

./gradlew bootRun

In your web browser, navigate to http://localhost:8080.

Useful Resources

Authors

Brandon Richardson
Software Engineering

License

This software is available under the MIT License.