Final Project for EPL441 - Advanced Software Engineering
We used OSGi R7 specification to implement this application for a Clinic's Management. We used bnd and Eclipse's Bndtools plugin with OSGi annotations as the OSGi implementation(bnd workspace model). Each OSGi component (annotated with the @Component annotation) is located in a private package of an OSGi bundle and implements the corresponding interface located in an exported package of the OSGi bundle. Services and View Components are implemented as OSGi components. Bndtools bootstraps our bnd workspace with a gradle script used to build, run, test and generate javadocs for our OSGi bundles. We have three OSGi application bundles(meaning they are executable), namely Clinic main bundle for the application, Migration for migrating the database schema and Seed for seeding the database with mock records. We have a model package to describe the entities of the database where each entity corresponds to a java class, each model has a corresponding Service component for CRUD operations to the DB. Each main service has a corresponding JUnit Test Case that asserts the correctness of CRUD operations to the databse. For the Database we used MySQL hosted through a Docker container.
- Installing Eclipse Plug-In Development Environment(Necessary for developing OSGi Bundles):
Help-> Install New Software... -> Work with: --All Available Sites-- --> Select Eclipse Plug-In Development Environment --> Install
- Installing Bndtools(Necessary for using bnd, tool that makes OSGi development easier, and using the bnd workspace model.
Help-> Install New Software... -> Work with: --All Available Sites-- --> Select Bndtools and all subplug-ins --> Install
Gradle is the tool that we will use to build the project(instead of ant/maven) as it is the requirement for the Project to have a build script.
- Clone the repository by running.
git clone https://github.com/npafitis/EPL441Clinic.git <path-to-your-workspace-name>
- The repository you just cloned will be the workspace that you are going to use in Eclipse. Set the Eclipse workspace to that repository. Now, in your package explorer you should only see a cnf folder
-
New Project (Wizard).
-
Under Bndtools select Bnd OSGi Project, then Next.
-
Select Component Project.
-
Create Project.
-
New Project (Wizard).
-
Under Bndtools select Bnd OSGi Project, then Next.
-
Select Application Project.
-
Create Project.
Database has been set up using docker to avoid any installation/configuration problems across different team members. A docker-compose.yml file with a MySQL image.
-
Install Docker
-
Run in terminal
docker-compose up
The database must be running now.
Optional:
-
Install MySQL Workbench for IDE interface to MySQL.
-
Open MySQL Workbench.
-
Create a new Connection with the following settings
Host: 0.0.0.0
port: 33061
username: homestead
Implementation classes of Services are not exported. That means that they're not public. What you do instead is a reference to the public interface, example:
@Ref
private UserService service;
and it will be automatically instantiated. You have to include the model.services.implementation package in your Run Requirements in bndrun.
For *nix Systems run the following
sudo ./gradlew run.cy.ac.ucy.epl441.migration
For Windows Systems run gradlew.bat instead with the same arguments.
Password is: secret
For seeding the database with mockup records:
sudo ./gradlew run.cy.ac.ucy.epl441.seed
To build all Application Project in the workspace run
./gradlew
./gradlew resolve
./gradlew test
./gradlew run.cy.ac.ucy.epl441.clinic
./gradlew javadoc