For details related to the main project visit the Main project page.
Inside the generated airport project open airport-web-server/application.properties file and replace lines 48-52 with the following:
hibernate.connection.url=jdbc:postgresql://localhost:5432/tg_local
hibernate.connection.driver_class=org.postgresql.Driver
hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
hibernate.connection.username=t32
hibernate.connection.password=t32
This should resolve the issue with being uable to start the web server using StartOverHttp.
Specifically, if you encountered an error that said: FATAL: Password authentication failed for user 'sa'* it was due to the misconfiguration during the project generation phase.
After performing the above modification, please make sure that you can launch StartOverHttp.
Also don't forget that the database and HAProxy Docker containers have to be running before starting the web server.
For Frequently Asked Questions and troubleshooting go to FAQ.
First of all, clone this repository to a suitable location on your machine:
git clone https://github.com/fieldenms/sysad-2022
We will be using Java 17. You can check your Java version by running the following command on the console: java --version.
If your version is lower or if you haven't got Java on your machine at all, then install it using one of the following links:
What you are installing is a distribution of OpenJDK from Adoptium.
Next, you need to set the JAVA_HOME environment variable.
-
Windows - the installer should have done this for you if you enabled the option related to
JAVA_HOME.If it hadn't, then you have to do it manually. The JDK was probably installed at
C:\Program Files\Eclipse Adoptium\jdk-17.0.4.101-hotspot.Make sure that
JAVA_HOMEandPathare set correctly: -
macOS
The default shell might be either
bashorzsh, so simply update both of them by runing the following 2 commands:printf 'export JAVA_HOME="/Library/Java/JavaVirtualMachines/temurin-17.jdk/Contents/Home"\nexport PATH="$PATH:$JAVA_HOME/bin"' >> ~/.bashrcprintf 'export JAVA_HOME="/Library/Java/JavaVirtualMachines/temurin-17.jdk/Contents/Home"\nexport PATH="$PATH:$JAVA_HOME/bin"' >> ~/.zshrcRestart the terminal for the changes to take effect.
-
Linux
First, unpack the archive you downloaded with
tar -xf PATH_TO_ARCHIVE. This will create a directoryjdk-17.0.4.1+1in the current one. You can move it to a suitable location if you want.The default shell might be either
bashorzsh, so simply update both of them by runing the following 2 commands, replacingPATH_TO_JKD_DIRwith the path tojdk-17.0.4.1+1:printf 'export JAVA_HOME="PATH_TO_JDK_DIR"\nexport PATH="$PATH:$JAVA_HOME/bin"' >> ~/.bashrcprintf 'export JAVA_HOME="PATH_TO_JDK_DIR"\nexport PATH="$PATH:$JAVA_HOME/bin"' >> ~/.zshrcRestart the terminal for the changes to take effect.
After the installation is done, you can verify it by running java --version. The output should look similar to the following:
openjdk 17.0.4.1 2022-08-12
OpenJDK Runtime Environment Temurin-17.0.4.1+1 (build 17.0.4.1+1)
OpenJDK 64-Bit Server VM Temurin-17.0.4.1+1 (build 17.0.4.1+1, mixed mode, sharing)
Apache Maven is a build system for Java projects that we will be using. If you haven't got Maven on your machine, then you need to install it.
Maven can be downloaded here. Grab the Binary zip archive. Since there is no provided installer, the installation process requires a bit more effort.
-
Windows installation instructions can be found here (skip the install Java part).
-
macOS installation instructions - here (skip the install Java part).
-
Linux installation instructions (I doubt you need them :)) - here
MacOS and Linux users should also edit their
~/.bashrcto include the following line, replacingYOUR_MAVEN_DIRECTORYby the location where you downloaded Maven to.export PATH="YOUR_MAVEN_DIRECTORY/bin:$PATH"For example, if you downloaded maven and unzipped it to
/Users/username/maven(macOS), then:export PATH="/Users/username/maven/bin:$PATH"On Linux that would be
/homeinstead of/Users.
Verify your installation with mvn -version. Make sure that mvn command is run and that the indicated Java version is 17 or newer.
More information:
File settings.xml needs to have section <server> completed by specifying <username> and <password>, which should be your GitHub username and a personal token generated using GitHub.
Such token should be generated with option read:packages using GitHub->Settings->Developer settings->Personal access tokens menu.
Put file settings.xml into the directory for your local Maven repo, which usually is ~/.m2. Symbol ~ stands for the user home directory. Under Windows, this would be C:\Users\<username>\.m2\.
-
Navigate to the directory with the archetype that contains jar and pom files to install the archetype locally on your system.
cd tg-archetypemvn install:install-file -Dfile=tg-application-archetype-1.4.6-SNAPSHOT.jar -DpomFile=pom.xml
-
Update local archetype catalog:
mvn archetype:update-local-catalog -
Now we need to generate the project structure. This should be done from another directory (NOT from
tg-archetypeand NOT from this cloned repository). So simply go create a new directory somewhere likeDesktop/system-analysisand run the following command inside it. A new directoryairportwill be generated upon running this command.
For Linux and macOS:
mvn -o org.apache.maven.plugins:maven-archetype-plugin:3.1.0:generate \
-DarchetypeGroupId=fielden \
-DarchetypeArtifactId=tg-application-archetype \
-DarchetypeVersion=1.4.6-SNAPSHOT \
-DgroupId=helsinki \
-DartifactId=airport \
-Dversion=1.0-SNAPSHOT \
-Dpackage=helsinki \
-DcompanyName="Helsinki Asset Management Pty. Ltd." \
-DplatformVersion=1.4.6-SNAPSHOT \
-DprojectName="Helsinki Airport Asset Management" \
-DprojectWebSite=https://airport.helsinki.com.ua \
-DsupportEmail=airport_support@helsinki.com.ua \
-DemailSmtp=localhost
For Windows:
mvn org.apache.maven.plugins:maven-archetype-plugin:3.1.0:generate -DarchetypeGroupId=fielden -DarchetypeArtifactId=tg-application-archetype -DarchetypeVersion="1.4.6-SNAPSHOT" -DgroupId=helsinki -DartifactId=airport -Dversion="1.0-SNAPSHOT" -Dpackage=helsinki -DcompanyName="Helsinki Asset Management Pty. Ltd." -DplatformVersion="1.4.6-SNAPSHOT" -DprojectName="Helsinki Airport Asset Management" -DprojectWebSite="https://airport.helsinki.com.ua" -DsupportEmail="airport_support@helsinki.com.ua" -DemailSmtp="localhost"
Note that -DemailSmtp points to localhost. We will be running a local SMTP server in a Docker container. More on that later.
- Navigate to the generated
airportdirectory and make sure it compiles successfully.cd airportmvn clean compile
-
Note that this is not an installer program, but a zip archive that contains the program. You should unzip it after downloading and put the resulting directory somewhere suitable on your system, e.g. on your Desktop. To launch Eclipse simply open that directory and start
eclipse.exe.
-
Import the
airportproject into Eclipse.- Open Eclipse IDE.
- File->Import->Existing Maven Projects.
- Set Root Directory to the
airportdirectory. - Finish.
-
Configure run configurations for Eclipse.
- Open Eclipse IDE.
- Open a file named
PopulateDb.java. It's located underairport-web-server/src/test/javainsidehelsinki.dev_mod.utilpackage. You can also useCtrl+Shift+T(Cmd+Shift+Ton macOS) to find it quickly. - Right click -> Run As -> Run Configurations -> Java Application -> New launch configuration (Left-upper corner, the first icon) -> Arguments tab.
- In the VM arguments text box enter:
-Dlog4j.configurationFile=src/main/resources/log4j2.xml --add-opens java.base/java.lang=ALL-UNNAMED- Do the same for
StartOverHttp.java, which is located underairport-web-server/src/main/javainsidehelsinki.webapppackage.
The
PopulateDbclass is responsible for populating initial data for starting the application, such as a bootstrap user. It is required to run this configuration every time you reset your database, before starting the web server.The
StartOverHttpclass is responsible for actually starting the web server. There is also a class namedStart, but we will be starting overHTTP, since we will be usingHAProxyto make our web application recognized as legitimate by the web browser. More on that later in this note. -
Enable annotation processing in Eclipse. a. In the Package Explorer pane on the left select
airport-pojo-blproject:b. Right-click on it -> Properties. c. Navigate to Java Compiler -> Annotation Processing, tick the box Enable project specific settings, then hit Apply and Close and finally Yes.
This should resolve the compilation errors.
We will be using a plugin that makes development of TG applications more convenient.
To install it you need to copy the *.jar files that can be found here to a directory named dropins in your local Eclipse installation.
-
Windows guys, remeber when we told you to put the unzipped Eclipse folder somewhere suitable? I hope you remember where it was. Now go there and open it. There should be a
dropinsdirectory inside. -
macOS guys, a file
Eclipse.appshould be located in/Applications. You can also find it using the standardFinderprogram insideApplications. Then right-click and Show Package Contents. Put the*.jarfiles insideContents/Eclipse/dropins. Eclipse needs to be restarted for plugins to be loaded. -
Linux guy, the same goes for you, find your local eclipse installation and there should be a
dropinsdirectory inside.
TG templates for Eclipse provide convenient code snippets to facilitate definition of entity properties and EQL queries.
The template file should be imported into Eclipse from menu Preferences->Java->Editor->Templates.
The recommended TG code formatting file should be imported into Eclipse from menu Preferences->Java->Code Style->Formatter.
Grab the files from github-repo-setup and put them inside your project directory (airport).
Domain name tgdev.com needs to be configured in the hosts file to be resolvable to the localhost (127.0.0.1).
Under macOS or Linux this file is /etc/hosts.
Under Windows this file is C:\Windows\System32\drivers\etc\hosts
In all cases this file needs to be edited with administrative privileges.
The following entry needs to be added:
127.0.0.1 tgdev.com
Take a break now and then head over to devops to configure Docker to run supporting services.



