[COPY]Cloud plugin project

[COPY]Cloud plugin project

Structure of the Cloud plugin project:

sql src └── main │── java │ └── com │ │── csacc │ │ │── common │ │ │── controller │ │ └── service │ └── example │ │── common │ │── controller │ │── persistence │ │ │── dao │ │ └── entity │ │── AddonApplication.java │ └── JerseyConfig.java └── resources │── i18n │── META─INF │ │── resources │ │ │── css │ │ │── images │ │ └── javascripts │ └── spring └── templates pom.xml

This is Atlassian Connect Spring Boot addon. Please make sure to familiarize yourself with Atlassian Connect Spring Boot. In case you have not used Spring Boot before, make sure to try at least "Hello World".

Lets do a tour through folders that we have here.

  • sql - Here I have sql that crates test MySQL user and generates DB. Please note that under non-production profile spring boot generates DB tables for you. I have tables creates to run them under the production server.

  • src/main/java/com/csacc - Under this folder we have packages that are core part of the CSACC. The content is similar to appropriate folder under Server project. Anyway lets comment each package:

  • common - This is symbolic link to csacc-common/src/main/java/com/csacc/common. So all the files from the Common folder are treated as part of the Cloud addon project.

  • controller - Here we have Cloud addons version of parent class for servlets controllers. Important is "init" method that wires servlets to spring context.

  • service - Cloud specific implementations of common service interfaces.

  • src/main/java/com/example - Under this folder we have Cloud versions of Java classes that represent functionality of "example" plugin. Description for packages:

  • common - This is symbolic link to csacc-common/src/main/java/com/example/common. Classes from this folder are treated as part of the P2 addon project.

  • persistence - JPA based persistence implementation.

  • AddonApplication.java - This spring boot app entry class and it's worth to comment few lines from it:

  • @ImportResource instructs to read our shred spring config files.

  • Methods that return ServletRegistrationBean register servlet bases controllers and map them under URLs that match to servlet mapping that we have under the Server P2 addon.

  • JerseyConfig.java - Registers REST services and maps them so the URLs match the URLs from the P2 addon.

  • src/main/resources - Resources folder contains mostly symbolic links to appropriate folders from the Common folder and atlassian-connect.json. In atlassian-connect.json url attributes for plugin modules match appropriate URLs from the Server addon. Also you may want to check application.properties application-production.properties. There we have plugin key, base URL and database connection parameters.

  • pom.xml - Maven file for the Atlassian Connect Spring Boot application. Please make sure to put the same version here and in the Server project when adding dependencies that are used in common code.