From 7f57510ac8a145272649ebfbfba688a18aa9fff3 Mon Sep 17 00:00:00 2001 From: Nullkat Date: Sat, 10 Jul 2021 08:29:09 +0300 Subject: [PATCH] Licensed module system. Minor changes - Added license commetary to each file of module system - Added default meta info generation for Module --- .../progressia/common/modules/Module.java | 18 ++++++++++ .../common/modules/ModuleBuilder.java | 33 ++++++++++++++----- .../progressia/common/modules/Task.java | 27 ++++++++++++--- .../common/modules/TaskManager.java | 17 ++++++++++ 4 files changed, 82 insertions(+), 13 deletions(-) diff --git a/src/main/java/ru/windcorp/progressia/common/modules/Module.java b/src/main/java/ru/windcorp/progressia/common/modules/Module.java index 5e81be6..1eebf4d 100644 --- a/src/main/java/ru/windcorp/progressia/common/modules/Module.java +++ b/src/main/java/ru/windcorp/progressia/common/modules/Module.java @@ -1,3 +1,20 @@ +/* + * Progressia + * Copyright (C) 2020-2021 Wind Corporation and contributors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ package ru.windcorp.progressia.common.modules; import ru.windcorp.progressia.common.util.namespaces.Namespaced; @@ -13,6 +30,7 @@ public class Module extends Namespaced { public Module(String id) { super(id); + meta.put("id", id); } public Map getMeta() { diff --git a/src/main/java/ru/windcorp/progressia/common/modules/ModuleBuilder.java b/src/main/java/ru/windcorp/progressia/common/modules/ModuleBuilder.java index 303b7f1..915416d 100644 --- a/src/main/java/ru/windcorp/progressia/common/modules/ModuleBuilder.java +++ b/src/main/java/ru/windcorp/progressia/common/modules/ModuleBuilder.java @@ -1,14 +1,31 @@ +/* + * Progressia + * Copyright (C) 2020-2021 Wind Corporation and contributors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ package ru.windcorp.progressia.common.modules; public class ModuleBuilder { - private final Module module; + private final Module module; - public ModuleBuilder(String id) { - module = new Module(id); - } + public ModuleBuilder(String id) { + module = new Module(id); + } - public ModuleBuilder AddTask(Task task) { - module.addTask(task); - return this; - } + public ModuleBuilder AddTask(Task task) { + module.addTask(task); + return this; + } } diff --git a/src/main/java/ru/windcorp/progressia/common/modules/Task.java b/src/main/java/ru/windcorp/progressia/common/modules/Task.java index d0663b0..9769851 100644 --- a/src/main/java/ru/windcorp/progressia/common/modules/Task.java +++ b/src/main/java/ru/windcorp/progressia/common/modules/Task.java @@ -1,3 +1,20 @@ +/* + * Progressia + * Copyright (C) 2020-2021 Wind Corporation and contributors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ package ru.windcorp.progressia.common.modules; import ru.windcorp.progressia.common.util.crash.CrashReports; @@ -58,8 +75,12 @@ public abstract class Task requiredTasks.add(task); } + public Module getOwner() { + return owner; + } + public void setOwner(Module module) { - if(owner != null) { + if (owner != null) { CrashReports.crash( new Exception("Owner is not null") , "Could not set %s as owner of %s, because %s is already owner of it.", @@ -68,8 +89,4 @@ public abstract class Task owner = module; } } - - public Module getOwner() { - return owner; - } } diff --git a/src/main/java/ru/windcorp/progressia/common/modules/TaskManager.java b/src/main/java/ru/windcorp/progressia/common/modules/TaskManager.java index bea9abc..60a6dd1 100644 --- a/src/main/java/ru/windcorp/progressia/common/modules/TaskManager.java +++ b/src/main/java/ru/windcorp/progressia/common/modules/TaskManager.java @@ -1,3 +1,20 @@ +/* + * Progressia + * Copyright (C) 2020-2021 Wind Corporation and contributors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ package ru.windcorp.progressia.common.modules; import org.apache.logging.log4j.LogManager;