mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-12-22 08:31:07 +03:00
Reload,ReloadAll,ReloadInfo commands
This commit is contained in:
parent
172eb97ce6
commit
c7c270fc2c
5 changed files with 73 additions and 1 deletions
|
@ -10,6 +10,9 @@
|
|||
import ru.gravit.launchserver.command.hash.*;
|
||||
import ru.gravit.launchserver.command.modules.LoadModuleCommand;
|
||||
import ru.gravit.launchserver.command.modules.ModulesCommand;
|
||||
import ru.gravit.launchserver.command.service.ReloadAllCommand;
|
||||
import ru.gravit.launchserver.command.service.ReloadCommand;
|
||||
import ru.gravit.launchserver.command.service.ReloadInfoCommand;
|
||||
import ru.gravit.utils.helper.LogHelper;
|
||||
import ru.gravit.utils.helper.VerifyHelper;
|
||||
|
||||
|
@ -108,6 +111,11 @@ protected CommandHandler(LaunchServer server) {
|
|||
//Register dump commands
|
||||
registerCommand("dumpSessions", new DumpSessionsCommand(server));
|
||||
registerCommand("dumpEntryCache", new DumpEntryCacheCommand(server));
|
||||
|
||||
//Register service commands
|
||||
registerCommand("reload",new ReloadCommand(server));
|
||||
registerCommand("reloadAll",new ReloadAllCommand(server));
|
||||
registerCommand("reloadInfo",new ReloadInfoCommand(server));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
package ru.gravit.launchserver.command.service;
|
||||
|
||||
import ru.gravit.launchserver.LaunchServer;
|
||||
import ru.gravit.launchserver.command.Command;
|
||||
import ru.gravit.utils.helper.LogHelper;
|
||||
|
||||
public class ReloadAllCommand extends Command {
|
||||
public ReloadAllCommand(LaunchServer server) {
|
||||
super(server);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getArgsDescription() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUsageDescription() {
|
||||
return "Reload all provider/handler/module config";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invoke(String... args) throws Exception {
|
||||
verifyArgs(args,1);
|
||||
LogHelper.info("Reload all config");
|
||||
server.reloadManager.reloadAll();
|
||||
}
|
||||
}
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
import ru.gravit.launchserver.LaunchServer;
|
||||
import ru.gravit.launchserver.command.Command;
|
||||
import ru.gravit.utils.helper.LogHelper;
|
||||
|
||||
public class ReloadCommand extends Command {
|
||||
public ReloadCommand(LaunchServer server) {
|
||||
|
@ -21,6 +22,7 @@ public String getUsageDescription() {
|
|||
@Override
|
||||
public void invoke(String... args) throws Exception {
|
||||
verifyArgs(args,1);
|
||||
|
||||
LogHelper.info("Reload %s config",args[0]);
|
||||
server.reloadManager.reload(args[0]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
package ru.gravit.launchserver.command.service;
|
||||
|
||||
import ru.gravit.launchserver.LaunchServer;
|
||||
import ru.gravit.launchserver.command.Command;
|
||||
import ru.gravit.utils.helper.LogHelper;
|
||||
|
||||
public class ReloadInfoCommand extends Command {
|
||||
public ReloadInfoCommand(LaunchServer server) {
|
||||
super(server);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getArgsDescription() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUsageDescription() {
|
||||
return "print reloadable configs";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invoke(String... args) throws Exception {
|
||||
verifyArgs(args,1);
|
||||
LogHelper.info("Reload %s config",args[0]);
|
||||
server.reloadManager.printReloadables();
|
||||
}
|
||||
}
|
|
@ -28,4 +28,10 @@ public void reloadAll()
|
|||
public void reload(String name) throws Exception {
|
||||
RELOADABLES.get(name).reload();
|
||||
}
|
||||
public void printReloadables()
|
||||
{
|
||||
LogHelper.info("Print reloadables");
|
||||
RELOADABLES.forEach((k,v) -> LogHelper.subInfo(k));
|
||||
LogHelper.info("Found %d reloadables", RELOADABLES.size());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue