From 85af640162212674b72dbca87c05d0d4519c8c68 Mon Sep 17 00:00:00 2001 From: Marcel Gaupp Date: Sun, 29 Dec 2024 17:16:57 +0100 Subject: [PATCH] Add documentation --- .../programming/service/LicenseService.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/main/java/de/tum/cit/aet/artemis/programming/service/LicenseService.java b/src/main/java/de/tum/cit/aet/artemis/programming/service/LicenseService.java index 53c279aaf690..4999dccc4d30 100644 --- a/src/main/java/de/tum/cit/aet/artemis/programming/service/LicenseService.java +++ b/src/main/java/de/tum/cit/aet/artemis/programming/service/LicenseService.java @@ -14,6 +14,9 @@ import de.tum.cit.aet.artemis.programming.domain.ProgrammingLanguage; import de.tum.cit.aet.artemis.programming.domain.ProjectType; +/** + * Provides licensing information for proprietary software to build jobs via environment variables. + */ @Profile(PROFILE_CORE) @Service public class LicenseService { @@ -24,6 +27,14 @@ public LicenseService(LicenseConfiguration licenseConfiguration) { this.licenseConfiguration = licenseConfiguration; } + /** + * Checks whether a required license is configured for the specified exercise type. + * If no license is required this returns true. + * + * @param programmingLanguage the programming language of the exercise type + * @param projectType the project type of the exercise type + * @return whether a required license is configured + */ public boolean isLicensed(ProgrammingLanguage programmingLanguage, @Nullable ProjectType projectType) { if (programmingLanguage == ProgrammingLanguage.MATLAB && projectType == null) { return licenseConfiguration.getMatlabLicenseServer() != null; @@ -32,6 +43,13 @@ public boolean isLicensed(ProgrammingLanguage programmingLanguage, @Nullable Pro return true; } + /** + * Returns environment variables required to run programming exercise tests. + * + * @param programmingLanguage the programming language of the exercise + * @param projectType the project type of the exercise + * @return environment variables for the specified exercise type + */ public Map getEnvironment(ProgrammingLanguage programmingLanguage, @Nullable ProjectType projectType) { if (programmingLanguage == ProgrammingLanguage.MATLAB && projectType == null) { return Map.of("MLM_LICENSE_FILE", Objects.requireNonNull(licenseConfiguration.getMatlabLicenseServer()));