diff --git a/serverpackcreator-api/src/jvmMain/kotlin/de/griefed/serverpackcreator/api/ApiProperties.kt b/serverpackcreator-api/src/jvmMain/kotlin/de/griefed/serverpackcreator/api/ApiProperties.kt index 7a72e7051..746cdb7ec 100644 --- a/serverpackcreator-api/src/jvmMain/kotlin/de/griefed/serverpackcreator/api/ApiProperties.kt +++ b/serverpackcreator-api/src/jvmMain/kotlin/de/griefed/serverpackcreator/api/ApiProperties.kt @@ -522,6 +522,10 @@ actual class ApiProperties( val fallbackServerPackCleanupEnabled = true val fallbackMinecraftPreReleasesAvailabilityEnabled = false val fallbackAutoExcludingModsEnabled = true + val fallbackArtemisQueueMaxDiskUsage = 90 + val fallbackCleanupSchedule = "0 0 0 * * *" + val fallbackVersionSchedule = "0 0 0 * * *" + val fallbackDatabaseCleanupSchedule = "0 0 0 * * *" private val serverPackCreatorProperties = "serverpackcreator.properties" private val checkedJavas = hashMapOf() @@ -1089,7 +1093,7 @@ actual class ApiProperties( /** * Maximum disk usage in percent until Artemis stops accepting new entries. */ - var queueMaxDiskUsage = 90 + var artemisQueueMaxDiskUsage = 90 get() { val usage = getIntProperty(pSpringArtemisQueueMaxDiskUsage, 90) field = if (usage in 0..100) { @@ -1110,6 +1114,38 @@ actual class ApiProperties( } } + var webserviceCleanupSchedule: String + get() { + return internalProps.getProperty("de.griefed.serverpackcreator.spring.schedules.database.cleanup") + } + set(value) { + internalProps.setProperty("de.griefed.serverpackcreator.spring.schedules.database.cleanup",value) + } + + var webserviceVersionSchedule: String + get() { + return internalProps.getProperty("de.griefed.serverpackcreator.spring.schedules.versions.refresh") + } + set(value) { + internalProps.setProperty("de.griefed.serverpackcreator.spring.schedules.versions.refresh",value) + } + + var webserviceDatabaseCleanupSchedule: String + get() { + return internalProps.getProperty("de.griefed.serverpackcreator.spring.schedules.files.cleanup") + } + set(value) { + internalProps.setProperty("de.griefed.serverpackcreator.spring.schedules.files.cleanup",value) + } + + fun defaultWebserviceDatabase(): File { + return File(userHome,"serverpackcreator.db") + } + + fun defaultArtemisDataDirectory(): File { + return File(workDirectory, "artemis") + } + /** * Default home-directory for ServerPackCreator. If there's no user-home, then the directory containing the * ServerPackCreator JAR will be used as the home-directory for ServerPackCreator. @@ -1193,6 +1229,10 @@ actual class ApiProperties( log.info("Set Tomcat base-directory to: $field") } + fun defaultTomcatBaseDirectory(): File { + return homeDirectory.absoluteFile + } + fun defaultServerPacksDirectory(): File { return File(homeDirectory, "server-packs").absoluteFile } @@ -1237,7 +1277,7 @@ actual class ApiProperties( @Suppress("MemberVisibilityCanBePrivate") var tomcatLogsDirectory: File = logsDirectory get() { - val default = File("${homeDirectory}${File.separator}logs").absolutePath + val default = File(homeDirectory,"logs").absolutePath val dir = internalProps.getProperty(pTomcatLogsDirectory, default) field = File(dir).absoluteFile return field @@ -1248,6 +1288,10 @@ actual class ApiProperties( log.info("Set Tomcat logs-directory to: $field") } + fun defaultTomcatLogsDirectory(): File { + return File(homeDirectory,"logs").absoluteFile + } + /** * Directory to which default/fallback manifests are copied to during the startup of * ServerPackCreator. @@ -2066,7 +2110,7 @@ actual class ApiProperties( log.info("Checking for pre-releases set to: $isCheckingForPreReleasesEnabled") log.info("Zip-file exclusion enabled set to: $isZipFileExclusionEnabled") log.info("HasteBin documents endpoint set to: $hasteBinServerUrl") - log.info("Queue max disk usage set to: $queueMaxDiskUsage") + log.info("Queue max disk usage set to: $artemisQueueMaxDiskUsage") log.info("Directories which must always be included set to: $directoriesToInclude") log.info("Directories which must always be excluded set to: $directoriesToExclude") log.info("Cleanup of already existing server packs set to: $isServerPackCleanupEnabled") diff --git a/serverpackcreator-api/src/jvmTest/kotlin/de/griefed/serverpackcreator/api/ApiPropertiesTest.kt b/serverpackcreator-api/src/jvmTest/kotlin/de/griefed/serverpackcreator/api/ApiPropertiesTest.kt index 1402e0504..e2856d83a 100644 --- a/serverpackcreator-api/src/jvmTest/kotlin/de/griefed/serverpackcreator/api/ApiPropertiesTest.kt +++ b/serverpackcreator-api/src/jvmTest/kotlin/de/griefed/serverpackcreator/api/ApiPropertiesTest.kt @@ -214,7 +214,7 @@ class ApiPropertiesTest internal constructor() { Assertions.assertNotNull(apiProperties.serverPacksDirectory) Assertions.assertNotNull(apiProperties.directoriesToExclude) Assertions.assertFalse(apiProperties.isCheckingForPreReleasesEnabled) - Assertions.assertEquals(90, apiProperties.queueMaxDiskUsage) + Assertions.assertEquals(90, apiProperties.artemisQueueMaxDiskUsage) Assertions.assertEquals("dev", apiProperties.apiVersion) } } \ No newline at end of file diff --git a/serverpackcreator-gui/src/main/kotlin/de/griefed/serverpackcreator/gui/window/settings/GlobalSettings.kt b/serverpackcreator-gui/src/main/kotlin/de/griefed/serverpackcreator/gui/window/settings/GlobalSettings.kt index 260788898..f6273ea4b 100644 --- a/serverpackcreator-gui/src/main/kotlin/de/griefed/serverpackcreator/gui/window/settings/GlobalSettings.kt +++ b/serverpackcreator-gui/src/main/kotlin/de/griefed/serverpackcreator/gui/window/settings/GlobalSettings.kt @@ -42,7 +42,7 @@ class GlobalSettings(guiProps: GuiProps, apiProperties: ApiProperties, component val homeReset = BalloonTipButton(null,guiProps.resetIcon,"Reset to default value",guiProps) { homeSetting.file = apiProperties.defaultHomeDirectory() } val homeChoose = BalloonTipButton(null,guiProps.folderIcon,"Select directory",guiProps) { val homeChooser = HomeDirChooser(apiProperties,"Home Directory Chooser") - if (homeChooser.showSaveDialog(mainFrame.frame) == JFileChooser.APPROVE_OPTION) { + if (homeChooser.showSaveDialog(mainFrame.frame) == JFileChooser.SAVE_DIALOG) { homeSetting.file = homeChooser.selectedFile.absoluteFile } } @@ -54,7 +54,7 @@ class GlobalSettings(guiProps: GuiProps, apiProperties: ApiProperties, component val javaReset = BalloonTipButton(null,guiProps.resetIcon,"Reset to default value",guiProps) { javaSetting.file = File(apiProperties.acquireJavaPath()).absoluteFile } val javaChoose = BalloonTipButton(null,guiProps.folderIcon,"Select executable",guiProps) { val javaChooser = JavaChooser(apiProperties,"Java Executable Chooser") - if (javaChooser.showSaveDialog(mainFrame.frame) == JFileChooser.APPROVE_OPTION) { + if (javaChooser.showSaveDialog(mainFrame.frame) == JFileChooser.SAVE_DIALOG) { javaSetting.file = javaChooser.selectedFile.absoluteFile } } @@ -66,7 +66,7 @@ class GlobalSettings(guiProps: GuiProps, apiProperties: ApiProperties, component val serverPacksReset = BalloonTipButton(null,guiProps.resetIcon,"Reset to default value",guiProps) { serverPacksSetting.file = apiProperties.defaultServerPacksDirectory() } val serverPacksChoose = BalloonTipButton(null,guiProps.folderIcon,"Select directory",guiProps) { val serverPackDirChooser = ServerPackDirChooser(apiProperties,"Server Pack Directory Chooser") - if (serverPackDirChooser.showSaveDialog(mainFrame.frame) == JFileChooser.APPROVE_OPTION) { + if (serverPackDirChooser.showSaveDialog(mainFrame.frame) == JFileChooser.SAVE_DIALOG) { serverPacksSetting.file = serverPackDirChooser.selectedFile.absoluteFile } } @@ -96,7 +96,7 @@ class GlobalSettings(guiProps: GuiProps, apiProperties: ApiProperties, component val scriptReset = BalloonTipButton(null,guiProps.resetIcon,"Reset to default value",guiProps) { scriptSetting.text = apiProperties.defaultScriptTemplates().joinToString(", ") } val scriptChoose = BalloonTipButton(null,guiProps.folderIcon,"Select directory",guiProps) { val scriptChooser = ScriptTemplatesChooser(apiProperties,"Script Template Chooser") - if (scriptChooser.showSaveDialog(mainFrame.frame) == JFileChooser.APPROVE_OPTION) { + if (scriptChooser.showSaveDialog(mainFrame.frame) == JFileChooser.SAVE_DIALOG) { scriptSetting.text = scriptChooser.selectedFiles.joinToString(", ") { it.absolutePath } } } diff --git a/serverpackcreator-gui/src/main/kotlin/de/griefed/serverpackcreator/gui/window/settings/GuiSettings.kt b/serverpackcreator-gui/src/main/kotlin/de/griefed/serverpackcreator/gui/window/settings/GuiSettings.kt index 21307fb1c..0a9529059 100644 --- a/serverpackcreator-gui/src/main/kotlin/de/griefed/serverpackcreator/gui/window/settings/GuiSettings.kt +++ b/serverpackcreator-gui/src/main/kotlin/de/griefed/serverpackcreator/gui/window/settings/GuiSettings.kt @@ -24,69 +24,67 @@ import de.griefed.serverpackcreator.gui.components.BalloonTipButton import de.griefed.serverpackcreator.gui.components.ElementLabel import de.griefed.serverpackcreator.gui.components.StatusIcon import de.griefed.serverpackcreator.gui.window.settings.components.Editor -import java.awt.Font import javax.swing.JCheckBox import javax.swing.JSlider -import javax.swing.UIManager class GuiSettings(guiProps: GuiProps) : Editor("Gui", guiProps) { val fontSizeIcon = StatusIcon(guiProps,"Size of fonts in ServerPackCreators GUI.") val fontSizeLabel = ElementLabel("Font Size") - val fontSizeSlider = JSlider(8,76,guiProps.fontSize) + val fontSizeSetting = JSlider(8,76,guiProps.fontSize) val fontSizeRevert = BalloonTipButton(null,guiProps.revertIcon,"Revert changes", guiProps) { - fontSizeSlider.value = guiProps.fontSize + fontSizeSetting.value = guiProps.fontSize } val fontSizeReset = BalloonTipButton(null,guiProps.resetIcon,"Reset to default value",guiProps) { - fontSizeSlider.value = 12 + fontSizeSetting.value = 12 } val startFocusIcon = StatusIcon(guiProps,"Whether ServerPackCreator should be focused after starting.") val startFocusLabel = ElementLabel("Focus On Start") - val startFocusEnabled = JCheckBox() + val startFocusSetting = JCheckBox() val startFocusRevert = BalloonTipButton(null,guiProps.revertIcon,"Revert changes",guiProps) { - startFocusEnabled.isSelected = guiProps.startFocusEnabled + startFocusSetting.isSelected = guiProps.startFocusEnabled } val startFocusReset = BalloonTipButton(null,guiProps.resetIcon,"Reset to default value",guiProps) { - startFocusEnabled.isSelected = false + startFocusSetting.isSelected = false } val generationFocusIcon = StatusIcon(guiProps,"Whether ServerPackCreator should be focused after a server pack has been generated.") val generationFocusLabel = ElementLabel("Focus After Generation") - val generationFocusEnabled = JCheckBox() + val generationFocusSetting = JCheckBox() val generationFocusRevert = BalloonTipButton(null,guiProps.revertIcon,"Revert changes",guiProps) { - generationFocusEnabled.isSelected = guiProps.generationFocusEnabled + generationFocusSetting.isSelected = guiProps.generationFocusEnabled } val generationFocusReset = BalloonTipButton(null,guiProps.resetIcon,"Reset to default value",guiProps) { - generationFocusEnabled.isSelected = false + generationFocusSetting.isSelected = false } init { - startFocusEnabled.isSelected = guiProps.startFocusEnabled - generationFocusEnabled.isSelected = guiProps.generationFocusEnabled - fontSizeSlider.paintTicks = true - fontSizeSlider.paintLabels = true - fontSizeSlider.majorTickSpacing = 4 - fontSizeSlider.minorTickSpacing = 2 + startFocusSetting.isSelected = guiProps.startFocusEnabled + generationFocusSetting.isSelected = guiProps.generationFocusEnabled + fontSizeSetting.paintTicks = true + fontSizeSetting.paintLabels = true + fontSizeSetting.majorTickSpacing = 4 + fontSizeSetting.minorTickSpacing = 2 var y = 0 panel.add(fontSizeIcon, "cell 0 $y") panel.add(fontSizeLabel, "cell 1 $y") - panel.add(fontSizeSlider, "cell 2 $y, grow") + panel.add(fontSizeSetting, "cell 2 $y, grow") panel.add(fontSizeRevert, "cell 3 $y") panel.add(fontSizeReset, "cell 4 $y") y++ panel.add(startFocusIcon, "cell 0 $y") panel.add(startFocusLabel, "cell 1 $y") - panel.add(startFocusEnabled, "cell 2 $y, grow") + panel.add(startFocusSetting, "cell 2 $y, grow") panel.add(startFocusRevert, "cell 3 $y") panel.add(startFocusReset, "cell 4 $y") y++ panel.add(generationFocusIcon, "cell 0 $y") panel.add(generationFocusLabel, "cell 1 $y") - panel.add(generationFocusEnabled, "cell 2 $y, grow") + panel.add(generationFocusSetting, "cell 2 $y, grow") panel.add(generationFocusRevert, "cell 3 $y") panel.add(generationFocusReset, "cell 4 $y") } diff --git a/serverpackcreator-gui/src/main/kotlin/de/griefed/serverpackcreator/gui/window/settings/SettingsEditorsTab.kt b/serverpackcreator-gui/src/main/kotlin/de/griefed/serverpackcreator/gui/window/settings/SettingsEditorsTab.kt index f515258ab..4c99d34ab 100644 --- a/serverpackcreator-gui/src/main/kotlin/de/griefed/serverpackcreator/gui/window/settings/SettingsEditorsTab.kt +++ b/serverpackcreator-gui/src/main/kotlin/de/griefed/serverpackcreator/gui/window/settings/SettingsEditorsTab.kt @@ -36,7 +36,7 @@ class SettingsEditorsTab(guiProps: GuiProps, apiProperties: ApiProperties, mainF private val componentResizer = ComponentResizer() val global = GlobalSettings(guiProps, apiProperties, componentResizer, mainFrame) - val webservice = WebserviceSettings(guiProps) + val webservice = WebserviceSettings(guiProps, apiProperties,mainFrame) val gui = GuiSettings(guiProps) init { diff --git a/serverpackcreator-gui/src/main/kotlin/de/griefed/serverpackcreator/gui/window/settings/WebserviceSettings.kt b/serverpackcreator-gui/src/main/kotlin/de/griefed/serverpackcreator/gui/window/settings/WebserviceSettings.kt index 2a0495016..134106ad3 100644 --- a/serverpackcreator-gui/src/main/kotlin/de/griefed/serverpackcreator/gui/window/settings/WebserviceSettings.kt +++ b/serverpackcreator-gui/src/main/kotlin/de/griefed/serverpackcreator/gui/window/settings/WebserviceSettings.kt @@ -19,11 +19,155 @@ */ package de.griefed.serverpackcreator.gui.window.settings +import de.griefed.serverpackcreator.api.ApiProperties import de.griefed.serverpackcreator.gui.GuiProps -import de.griefed.serverpackcreator.gui.window.settings.components.Editor +import de.griefed.serverpackcreator.gui.components.* +import de.griefed.serverpackcreator.gui.window.MainFrame +import de.griefed.serverpackcreator.gui.window.settings.components.* +import java.io.File +import javax.swing.JFileChooser +import javax.swing.JSlider -class WebserviceSettings(guiProps: GuiProps) : Editor("Webservice", guiProps) { +class WebserviceSettings(guiProps: GuiProps, apiProperties: ApiProperties, mainFrame: MainFrame) : Editor("Webservice", guiProps) { + val artemisDataDirectoryIcon = StatusIcon(guiProps, "Data directory for Artemis Queue System") + val artemisDataDirectoryLabel = ElementLabel("Artemis Data Directory") + val artemisDataDirectorySetting = ScrollTextFileField(guiProps,apiProperties.artemisDataDirectory.absolutePath) + val artemisDataDirectoryRevert = BalloonTipButton(null,guiProps.revertIcon,"Revert changes.",guiProps) { artemisDataDirectorySetting.file = apiProperties.artemisDataDirectory.absoluteFile } + val artemisDataDirectoryReset = BalloonTipButton(null,guiProps.resetIcon,"Reset to default value",guiProps) { artemisDataDirectorySetting.file = apiProperties.defaultArtemisDataDirectory().absoluteFile } + val artemisDataDirectoryChoose = BalloonTipButton(null,guiProps.folderIcon,"Select directory",guiProps) { + val artemisChooser = ArtemisDataDirChooser(apiProperties,"Artemis Data Directory Chooser") + if (artemisChooser.showSaveDialog(mainFrame.frame) == JFileChooser.SAVE_DIALOG) { + artemisDataDirectorySetting.file = artemisChooser.selectedFile.absoluteFile + } + } + + val artemisQueueMaxDiskUsageIcon = StatusIcon(guiProps,"Max disk usage by Artemis, in absolute percentages.") + val artemisQueueMaxDiskUsageLabel = ElementLabel("Artemis Max Disk Usage") + val artemisQueueMaxDiskUsageSetting = JSlider(10,90,apiProperties.artemisQueueMaxDiskUsage) + val artemisQueueMaxDiskUsageRevert = BalloonTipButton(null,guiProps.revertIcon,"Revert changes.",guiProps) { artemisQueueMaxDiskUsageSetting.value = apiProperties.artemisQueueMaxDiskUsage } + val artemisQueueMaxDiskUsageReset = BalloonTipButton(null,guiProps.resetIcon,"Reset to default value", guiProps) { artemisQueueMaxDiskUsageSetting.value = apiProperties.fallbackArtemisQueueMaxDiskUsage } + + val databaseFileIcon = StatusIcon(guiProps,"Webservice database file") + val databaseFileLabel = ElementLabel("Database File") + val databaseFileSetting = ScrollTextFileField(guiProps,apiProperties.serverPackCreatorDatabase.absolutePath) + val databaseFileRevert = BalloonTipButton(null,guiProps.revertIcon,"Revert changes.",guiProps) { databaseFileSetting.file = apiProperties.serverPackCreatorDatabase.absoluteFile } + val databaseFileReset = BalloonTipButton(null,guiProps.resetIcon,"Reset to default value",guiProps) { databaseFileSetting.file = apiProperties.defaultWebserviceDatabase().absoluteFile } + val databaseFileChoose = BalloonTipButton(null,guiProps.folderIcon,"Select directory",guiProps) { + val webserviceChooser = WebserviceDBDirChooser(apiProperties,"Webservice Database Directory Chooser") + if (webserviceChooser.showSaveDialog(mainFrame.frame) == JFileChooser.SAVE_DIALOG) { + databaseFileSetting.file = File(webserviceChooser.selectedFile.absoluteFile,"serverpackcreator.db").absoluteFile + } + } + + val cleanupScheduleIcon = StatusIcon(guiProps,"Schedule by which the webservice will perform cleanup operations") + val cleanupScheduleLabel = ElementLabel("Cleanup Schedule") + val cleanupScheduleSetting = ScrollTextField(guiProps,apiProperties.webserviceCleanupSchedule) + val cleanupRevert = BalloonTipButton(null,guiProps.revertIcon,"Revert changes.",guiProps) { cleanupScheduleSetting.text = apiProperties.webserviceCleanupSchedule } + val cleanupReset = BalloonTipButton(null,guiProps.resetIcon,"Reset to default value",guiProps) { cleanupScheduleSetting.text = apiProperties.fallbackCleanupSchedule } + + val logDirectoryIcon = StatusIcon(guiProps,"Directory which contains the Tomcat Access logs") + val logDirectoryLabel = ElementLabel("Tomcat Access Log Directory") + val logDirectorySetting = ScrollTextFileField(guiProps,apiProperties.tomcatLogsDirectory.absolutePath) + val logDirectoryRevert = BalloonTipButton(null,guiProps.revertIcon,"Revert changes.",guiProps) { logDirectorySetting.file = apiProperties.tomcatLogsDirectory.absoluteFile } + val logDirectoryReset = BalloonTipButton(null,guiProps.resetIcon,"Reset to default value",guiProps) { logDirectorySetting.file = apiProperties.defaultTomcatLogsDirectory().absoluteFile } + val logDirectoryChoose = BalloonTipButton(null,guiProps.folderIcon,"Select directory",guiProps) { + val logDirectoryChooser = TomcatLogDirChooser(apiProperties,"Tomcat Log Directory Chooser") + if (logDirectoryChooser.showSaveDialog(mainFrame.frame) == JFileChooser.SAVE_DIALOG) { + logDirectorySetting.file = logDirectoryChooser.selectedFile.absoluteFile + } + } + + val baseDirIcon = StatusIcon(guiProps,"Base directory for Tomcat") + val baseDirLabel = ElementLabel("Tomcat Base Directory") + val baseDirSetting = ScrollTextFileField(guiProps,apiProperties.tomcatBaseDirectory.absolutePath) + val baseDirRevert = BalloonTipButton(null,guiProps.revertIcon,"Revert changes.",guiProps) { baseDirSetting.file = apiProperties.tomcatBaseDirectory.absoluteFile } + val baseDirReset = BalloonTipButton(null,guiProps.resetIcon,"Reset to default value",guiProps) { baseDirSetting.file = apiProperties.defaultTomcatBaseDirectory().absoluteFile } + val baseDirChoose = BalloonTipButton(null,guiProps.folderIcon,"Select directory",guiProps) { + val baseDirChooser = TomcatBaseDirChooser(apiProperties,"Tomcat Base Directory Chooser") + if (baseDirChooser.showSaveDialog(mainFrame.frame) == JFileChooser.SAVE_DIALOG) { + baseDirSetting.file = baseDirChooser.selectedFile.absoluteFile + } + } + + val versionScheduleIcon = StatusIcon(guiProps,"Schedule by which the webservice will perform version meta updates") + val versionScheduleLabel = ElementLabel("Version Schedule") + val versionScheduleSetting = ScrollTextField(guiProps,apiProperties.webserviceVersionSchedule) + val versionRevert = BalloonTipButton(null,guiProps.revertIcon,"Revert changes.",guiProps) { versionScheduleSetting.text = apiProperties.webserviceVersionSchedule } + val versionReset = BalloonTipButton(null,guiProps.resetIcon,"Reset to default value",guiProps) { versionScheduleSetting.text = apiProperties.fallbackVersionSchedule } + + val databaseCleanupScheduleIcon = StatusIcon(guiProps,"Schedule by which the webservice will perform database cleanup operations") + val databaseCleanupScheduleLabel = ElementLabel("Database Cleanup Schedule") + val databaseCleanupScheduleSetting = ScrollTextField(guiProps,apiProperties.webserviceDatabaseCleanupSchedule) + val databaseCleanupRevert = BalloonTipButton(null,guiProps.revertIcon,"Revert changes.",guiProps) { databaseCleanupScheduleSetting.text = apiProperties.webserviceDatabaseCleanupSchedule } + val databaseCleanupReset = BalloonTipButton(null,guiProps.resetIcon,"Reset to default value",guiProps) { databaseCleanupScheduleSetting.text = apiProperties.fallbackDatabaseCleanupSchedule } + + init { + artemisQueueMaxDiskUsageSetting.paintTicks = true + artemisQueueMaxDiskUsageSetting.paintLabels = true + artemisQueueMaxDiskUsageSetting.majorTickSpacing = 10 + artemisQueueMaxDiskUsageSetting.minorTickSpacing = 5 + + var y = 0 + panel.add(artemisQueueMaxDiskUsageIcon, "cell 0 $y") + panel.add(artemisQueueMaxDiskUsageLabel, "cell 1 $y") + panel.add(artemisQueueMaxDiskUsageSetting, "cell 2 $y, grow") + panel.add(artemisQueueMaxDiskUsageRevert, "cell 3 $y") + panel.add(artemisQueueMaxDiskUsageReset, "cell 4 $y") + + y++ + panel.add(artemisDataDirectoryIcon, "cell 0 $y") + panel.add(artemisDataDirectoryLabel, "cell 1 $y") + panel.add(artemisDataDirectorySetting, "cell 2 $y, grow") + panel.add(artemisDataDirectoryRevert, "cell 3 $y") + panel.add(artemisDataDirectoryReset, "cell 4 $y") + panel.add(artemisDataDirectoryChoose, "cell 5 $y") + + y++ + panel.add(databaseFileIcon, "cell 0 $y") + panel.add(databaseFileLabel, "cell 1 $y") + panel.add(databaseFileSetting, "cell 2 $y, grow") + panel.add(databaseFileRevert, "cell 3 $y") + panel.add(databaseFileReset, "cell 4 $y") + panel.add(databaseFileChoose, "cell 5 $y") + + y++ + panel.add(logDirectoryIcon, "cell 0 $y") + panel.add(logDirectoryLabel, "cell 1 $y") + panel.add(logDirectorySetting, "cell 2 $y, grow") + panel.add(logDirectoryRevert, "cell 3 $y") + panel.add(logDirectoryReset, "cell 4 $y") + panel.add(logDirectoryChoose, "cell 5 $y") + + y++ + panel.add(baseDirIcon, "cell 0 $y") + panel.add(baseDirLabel, "cell 1 $y") + panel.add(baseDirSetting, "cell 2 $y, grow") + panel.add(baseDirRevert, "cell 3 $y") + panel.add(baseDirReset, "cell 4 $y") + panel.add(baseDirChoose, "cell 5 $y") + + y++ + panel.add(cleanupScheduleIcon, "cell 0 $y") + panel.add(cleanupScheduleLabel, "cell 1 $y") + panel.add(cleanupScheduleSetting, "cell 2 $y, grow") + panel.add(cleanupRevert, "cell 3 $y") + panel.add(cleanupReset, "cell 4 $y") + + y++ + panel.add(versionScheduleIcon, "cell 0 $y") + panel.add(versionScheduleLabel, "cell 1 $y") + panel.add(versionScheduleSetting, "cell 2 $y, grow") + panel.add(versionRevert, "cell 3 $y") + panel.add(versionReset, "cell 4 $y") + + y++ + panel.add(databaseCleanupScheduleIcon, "cell 0 $y") + panel.add(databaseCleanupScheduleLabel, "cell 1 $y") + panel.add(databaseCleanupScheduleSetting, "cell 2 $y, grow") + panel.add(databaseCleanupRevert, "cell 3 $y") + panel.add(databaseCleanupReset, "cell 4 $y") + } override fun loadSettings() { TODO("Not yet implemented") @@ -32,44 +176,4 @@ class WebserviceSettings(guiProps: GuiProps) : Editor("Webservice", guiProps) { override fun saveSettings() { TODO("Not yet implemented") } - - /*TODO - Artemis-Data - spring.artemis.embedded.data-directory - */ - - /*TODO - Artemis Max Disk Usage - de.griefed.serverpackcreator.spring.artemis.queue.max_disk_usage - */ - - /*TODO - Webservice Database - spring.datasource.url - */ - - /*TODO - Webservice Cleanup Schedule - de.griefed.serverpackcreator.spring.schedules.database.cleanup - */ - - /*TODO - Webservice Accesslog Directory - server.tomcat.accesslog.directory - */ - - /*TODO - Webservice-Server Base-Directory - server.tomcat.basedir - */ - - /*TODO - Webservice Version Refreshing - de.griefed.serverpackcreator.spring.schedules.versions.refresh - */ - - /*TODO - Webservice database cleanups - de.griefed.serverpackcreator.spring.schedules.files.cleanup - */ } \ No newline at end of file diff --git a/serverpackcreator-gui/src/main/kotlin/de/griefed/serverpackcreator/gui/window/settings/components/ArtemisDataDirChooser.kt b/serverpackcreator-gui/src/main/kotlin/de/griefed/serverpackcreator/gui/window/settings/components/ArtemisDataDirChooser.kt new file mode 100644 index 000000000..8746d606f --- /dev/null +++ b/serverpackcreator-gui/src/main/kotlin/de/griefed/serverpackcreator/gui/window/settings/components/ArtemisDataDirChooser.kt @@ -0,0 +1,41 @@ +/* Copyright (C) 2023 Griefed + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 + * USA + * + * The full license can be found at https:github.com/Griefed/ServerPackCreator/blob/main/LICENSE + */ +package de.griefed.serverpackcreator.gui.window.settings.components + +import de.griefed.serverpackcreator.api.ApiProperties +import java.awt.Dimension +import javax.swing.JFileChooser + +/** + * Customized filechooser for picking ServerPackCreator Artemis Data-directory. + * + * @author Griefed + */ +class ArtemisDataDirChooser(apiProperties: ApiProperties, title: String) : JFileChooser() { + init { + currentDirectory = apiProperties.artemisDataDirectory + dialogTitle = title + fileSelectionMode = DIRECTORIES_ONLY + isAcceptAllFileFilterUsed = false + isMultiSelectionEnabled = false + dialogType = SAVE_DIALOG + preferredSize = Dimension(750, 450) + } +} \ No newline at end of file diff --git a/serverpackcreator-gui/src/main/kotlin/de/griefed/serverpackcreator/gui/window/settings/components/TomcatBaseDirChooser.kt b/serverpackcreator-gui/src/main/kotlin/de/griefed/serverpackcreator/gui/window/settings/components/TomcatBaseDirChooser.kt new file mode 100644 index 000000000..c6d29559f --- /dev/null +++ b/serverpackcreator-gui/src/main/kotlin/de/griefed/serverpackcreator/gui/window/settings/components/TomcatBaseDirChooser.kt @@ -0,0 +1,41 @@ +/* Copyright (C) 2023 Griefed + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 + * USA + * + * The full license can be found at https:github.com/Griefed/ServerPackCreator/blob/main/LICENSE + */ +package de.griefed.serverpackcreator.gui.window.settings.components + +import de.griefed.serverpackcreator.api.ApiProperties +import java.awt.Dimension +import javax.swing.JFileChooser + +/** + * Customized filechooser for picking ServerPackCreator Tomcat base-directory. + * + * @author Griefed + */ +class TomcatBaseDirChooser(apiProperties: ApiProperties, title: String) : JFileChooser() { + init { + currentDirectory = apiProperties.tomcatBaseDirectory + dialogTitle = title + fileSelectionMode = DIRECTORIES_ONLY + isAcceptAllFileFilterUsed = false + isMultiSelectionEnabled = false + dialogType = SAVE_DIALOG + preferredSize = Dimension(750, 450) + } +} \ No newline at end of file diff --git a/serverpackcreator-gui/src/main/kotlin/de/griefed/serverpackcreator/gui/window/settings/components/TomcatLogDirChooser.kt b/serverpackcreator-gui/src/main/kotlin/de/griefed/serverpackcreator/gui/window/settings/components/TomcatLogDirChooser.kt new file mode 100644 index 000000000..078351210 --- /dev/null +++ b/serverpackcreator-gui/src/main/kotlin/de/griefed/serverpackcreator/gui/window/settings/components/TomcatLogDirChooser.kt @@ -0,0 +1,41 @@ +/* Copyright (C) 2023 Griefed + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 + * USA + * + * The full license can be found at https:github.com/Griefed/ServerPackCreator/blob/main/LICENSE + */ +package de.griefed.serverpackcreator.gui.window.settings.components + +import de.griefed.serverpackcreator.api.ApiProperties +import java.awt.Dimension +import javax.swing.JFileChooser + +/** + * Customized filechooser for picking ServerPackCreator Tomcat log-directory. + * + * @author Griefed + */ +class TomcatLogDirChooser(apiProperties: ApiProperties, title: String) : JFileChooser() { + init { + currentDirectory = apiProperties.tomcatLogsDirectory + dialogTitle = title + fileSelectionMode = DIRECTORIES_ONLY + isAcceptAllFileFilterUsed = false + isMultiSelectionEnabled = false + dialogType = SAVE_DIALOG + preferredSize = Dimension(750, 450) + } +} \ No newline at end of file diff --git a/serverpackcreator-gui/src/main/kotlin/de/griefed/serverpackcreator/gui/window/settings/components/WebserviceDBDirChooser.kt b/serverpackcreator-gui/src/main/kotlin/de/griefed/serverpackcreator/gui/window/settings/components/WebserviceDBDirChooser.kt new file mode 100644 index 000000000..1b5aedc25 --- /dev/null +++ b/serverpackcreator-gui/src/main/kotlin/de/griefed/serverpackcreator/gui/window/settings/components/WebserviceDBDirChooser.kt @@ -0,0 +1,41 @@ +/* Copyright (C) 2023 Griefed + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 + * USA + * + * The full license can be found at https:github.com/Griefed/ServerPackCreator/blob/main/LICENSE + */ +package de.griefed.serverpackcreator.gui.window.settings.components + +import de.griefed.serverpackcreator.api.ApiProperties +import java.awt.Dimension +import javax.swing.JFileChooser + +/** + * Customized filechooser for picking ServerPackCreator webservice-database directory. + * + * @author Griefed + */ +class WebserviceDBDirChooser(apiProperties: ApiProperties, title: String) : JFileChooser() { + init { + currentDirectory = apiProperties.serverPackCreatorDatabase.parentFile + dialogTitle = title + fileSelectionMode = DIRECTORIES_ONLY + isAcceptAllFileFilterUsed = false + isMultiSelectionEnabled = false + dialogType = SAVE_DIALOG + preferredSize = Dimension(750, 450) + } +} \ No newline at end of file diff --git a/serverpackcreator-web/src/main/kotlin/de/griefed/serverpackcreator/web/task/ArtemisConfig.kt b/serverpackcreator-web/src/main/kotlin/de/griefed/serverpackcreator/web/task/ArtemisConfig.kt index 40b5c7778..b9cbf481b 100644 --- a/serverpackcreator-web/src/main/kotlin/de/griefed/serverpackcreator/web/task/ArtemisConfig.kt +++ b/serverpackcreator-web/src/main/kotlin/de/griefed/serverpackcreator/web/task/ArtemisConfig.kt @@ -60,7 +60,7 @@ class ArtemisConfig @Autowired constructor(private val apiProperties: ApiPropert * @author Griefed */ override fun customize(configuration: org.apache.activemq.artemis.core.config.Configuration) { - configuration.maxDiskUsage = apiProperties.queueMaxDiskUsage + configuration.maxDiskUsage = apiProperties.artemisQueueMaxDiskUsage val addressSettings = AddressSettings() addressSettings.defaultConsumerWindowSize = 0 configuration.addAddressesSetting("tasks.background", addressSettings)