mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2025-01-09 09:57:35 +01:00
[Debt] Updated Network page updating
This moves the network page servers tab generation and removes need for network page updates on Bukkit servers, so it was removed.
This commit is contained in:
parent
d448e7f868
commit
81be032ccf
@ -13,9 +13,6 @@ import com.djrapitops.plan.system.info.request.InfoRequest;
|
|||||||
import com.djrapitops.plan.system.info.request.InfoRequestFactory;
|
import com.djrapitops.plan.system.info.request.InfoRequestFactory;
|
||||||
import com.djrapitops.plan.system.info.server.ServerInfo;
|
import com.djrapitops.plan.system.info.server.ServerInfo;
|
||||||
import com.djrapitops.plan.system.webserver.WebServer;
|
import com.djrapitops.plan.system.webserver.WebServer;
|
||||||
import com.djrapitops.plan.system.webserver.cache.PageId;
|
|
||||||
import com.djrapitops.plan.system.webserver.cache.ResponseCache;
|
|
||||||
import com.djrapitops.plan.system.webserver.response.ResponseFactory;
|
|
||||||
import com.djrapitops.plugin.logging.console.PluginLogger;
|
import com.djrapitops.plugin.logging.console.PluginLogger;
|
||||||
import dagger.Lazy;
|
import dagger.Lazy;
|
||||||
|
|
||||||
@ -30,22 +27,15 @@ import javax.inject.Singleton;
|
|||||||
@Singleton
|
@Singleton
|
||||||
public class BungeeInfoSystem extends InfoSystem {
|
public class BungeeInfoSystem extends InfoSystem {
|
||||||
|
|
||||||
private final ResponseFactory responseFactory;
|
|
||||||
private final ServerInfo serverInfo;
|
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public BungeeInfoSystem(
|
public BungeeInfoSystem(
|
||||||
InfoRequestFactory infoRequestFactory,
|
InfoRequestFactory infoRequestFactory,
|
||||||
ResponseFactory responseFactory,
|
|
||||||
ConnectionSystem connectionSystem,
|
ConnectionSystem connectionSystem,
|
||||||
ServerInfo serverInfo,
|
ServerInfo serverInfo,
|
||||||
Lazy<WebServer> webServer,
|
Lazy<WebServer> webServer,
|
||||||
PluginLogger logger
|
PluginLogger logger
|
||||||
) {
|
) {
|
||||||
super(infoRequestFactory, connectionSystem, serverInfo, webServer, logger);
|
super(infoRequestFactory, connectionSystem, serverInfo, webServer, logger);
|
||||||
this.responseFactory = responseFactory;
|
|
||||||
|
|
||||||
this.serverInfo = serverInfo;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -58,9 +48,4 @@ public class BungeeInfoSystem extends InfoSystem {
|
|||||||
throw new NoServersException("No servers were available to process this request (Local attempt): " + infoRequest.getClass().getSimpleName());
|
throw new NoServersException("No servers were available to process this request (Local attempt): " + infoRequest.getClass().getSimpleName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void updateNetworkPage() {
|
|
||||||
ResponseCache.cacheResponse(PageId.SERVER.of(serverInfo.getServerUUID()), responseFactory::networkPageResponse);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -138,15 +138,6 @@ public abstract class InfoSystem implements SubSystem {
|
|||||||
return connectionSystem;
|
return connectionSystem;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Updates Network page.
|
|
||||||
* <p>
|
|
||||||
* No calls from non-async thread found on 09.02.2018
|
|
||||||
*
|
|
||||||
* @throws WebException If fails.
|
|
||||||
*/
|
|
||||||
public abstract void updateNetworkPage() throws WebException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Requests Set up from Bungee.
|
* Requests Set up from Bungee.
|
||||||
* <p>
|
* <p>
|
||||||
|
@ -27,7 +27,6 @@ import javax.inject.Singleton;
|
|||||||
@Singleton
|
@Singleton
|
||||||
public class ServerInfoSystem extends InfoSystem {
|
public class ServerInfoSystem extends InfoSystem {
|
||||||
|
|
||||||
private final ServerInfo serverInfo;
|
|
||||||
private final PluginLogger logger;
|
private final PluginLogger logger;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
@ -39,7 +38,6 @@ public class ServerInfoSystem extends InfoSystem {
|
|||||||
PluginLogger logger
|
PluginLogger logger
|
||||||
) {
|
) {
|
||||||
super(infoRequestFactory, connectionSystem, serverInfo, webServer, logger);
|
super(infoRequestFactory, connectionSystem, serverInfo, webServer, logger);
|
||||||
this.serverInfo = serverInfo;
|
|
||||||
this.logger = logger;
|
this.logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,10 +49,4 @@ public class ServerInfoSystem extends InfoSystem {
|
|||||||
logger.getDebugLogger().logOn(DebugChannels.INFO_REQUESTS, "Local: " + infoRequest.getClass().getSimpleName());
|
logger.getDebugLogger().logOn(DebugChannels.INFO_REQUESTS, "Local: " + infoRequest.getClass().getSimpleName());
|
||||||
infoRequest.runLocally();
|
infoRequest.runLocally();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void updateNetworkPage() throws WebException {
|
|
||||||
String html = ""; // TODO Rework this part of the info system
|
|
||||||
sendRequest(infoRequestFactory.cacheNetworkPageContentRequest(serverInfo.getServerUUID(), html));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@ package com.djrapitops.plan.system.info.request;
|
|||||||
import com.djrapitops.plan.api.exceptions.connection.BadRequestException;
|
import com.djrapitops.plan.api.exceptions.connection.BadRequestException;
|
||||||
import com.djrapitops.plan.api.exceptions.connection.WebException;
|
import com.djrapitops.plan.api.exceptions.connection.WebException;
|
||||||
import com.djrapitops.plan.system.processing.Processing;
|
import com.djrapitops.plan.system.processing.Processing;
|
||||||
|
import com.djrapitops.plan.system.processing.processors.Processors;
|
||||||
import com.djrapitops.plan.system.settings.Settings;
|
import com.djrapitops.plan.system.settings.Settings;
|
||||||
import com.djrapitops.plan.system.settings.config.PlanConfig;
|
import com.djrapitops.plan.system.settings.config.PlanConfig;
|
||||||
import com.djrapitops.plan.system.webserver.cache.PageId;
|
import com.djrapitops.plan.system.webserver.cache.PageId;
|
||||||
@ -30,6 +31,7 @@ public class CacheAnalysisPageRequest extends InfoRequestWithVariables implement
|
|||||||
|
|
||||||
private final PlanConfig config;
|
private final PlanConfig config;
|
||||||
private final Processing processing;
|
private final Processing processing;
|
||||||
|
private final Processors processors;
|
||||||
private final HtmlExport htmlExport;
|
private final HtmlExport htmlExport;
|
||||||
|
|
||||||
private UUID serverUUID;
|
private UUID serverUUID;
|
||||||
@ -38,10 +40,12 @@ public class CacheAnalysisPageRequest extends InfoRequestWithVariables implement
|
|||||||
CacheAnalysisPageRequest(
|
CacheAnalysisPageRequest(
|
||||||
PlanConfig config,
|
PlanConfig config,
|
||||||
Processing processing,
|
Processing processing,
|
||||||
|
Processors processors,
|
||||||
HtmlExport htmlExport
|
HtmlExport htmlExport
|
||||||
) {
|
) {
|
||||||
this.config = config;
|
this.config = config;
|
||||||
this.processing = processing;
|
this.processing = processing;
|
||||||
|
this.processors = processors;
|
||||||
this.htmlExport = htmlExport;
|
this.htmlExport = htmlExport;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,10 +53,12 @@ public class CacheAnalysisPageRequest extends InfoRequestWithVariables implement
|
|||||||
UUID serverUUID, String html,
|
UUID serverUUID, String html,
|
||||||
PlanConfig config,
|
PlanConfig config,
|
||||||
Processing processing,
|
Processing processing,
|
||||||
|
Processors processors,
|
||||||
HtmlExport htmlExport
|
HtmlExport htmlExport
|
||||||
) {
|
) {
|
||||||
this.config = config;
|
this.config = config;
|
||||||
this.processing = processing;
|
this.processing = processing;
|
||||||
|
this.processors = processors;
|
||||||
this.htmlExport = htmlExport;
|
this.htmlExport = htmlExport;
|
||||||
|
|
||||||
Verify.nullCheck(serverUUID, html);
|
Verify.nullCheck(serverUUID, html);
|
||||||
@ -76,6 +82,7 @@ public class CacheAnalysisPageRequest extends InfoRequestWithVariables implement
|
|||||||
|
|
||||||
private void cache(UUID serverUUID, String html) {
|
private void cache(UUID serverUUID, String html) {
|
||||||
ResponseCache.cacheResponse(PageId.SERVER.of(serverUUID), () -> new AnalysisPageResponse(html));
|
ResponseCache.cacheResponse(PageId.SERVER.of(serverUUID), () -> new AnalysisPageResponse(html));
|
||||||
|
processing.submitNonCritical(processors.info().networkPageUpdateProcessor());
|
||||||
|
|
||||||
if (config.isTrue(Settings.ANALYSIS_EXPORT)) {
|
if (config.isTrue(Settings.ANALYSIS_EXPORT)) {
|
||||||
processing.submitNonCritical(() -> htmlExport.exportServer(serverUUID));
|
processing.submitNonCritical(() -> htmlExport.exportServer(serverUUID));
|
||||||
|
@ -83,7 +83,6 @@ public class GenerateAnalysisPageRequest extends InfoRequestWithVariables implem
|
|||||||
|
|
||||||
private void generateAndCache(UUID serverUUID) throws WebException {
|
private void generateAndCache(UUID serverUUID) throws WebException {
|
||||||
infoSystem.sendRequest(infoRequestFactory.cacheAnalysisPageRequest(serverUUID, analyseAndGetHtml()));
|
infoSystem.sendRequest(infoRequestFactory.cacheAnalysisPageRequest(serverUUID, analyseAndGetHtml()));
|
||||||
infoSystem.updateNetworkPage();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,37 +0,0 @@
|
|||||||
/*
|
|
||||||
* License is provided in the jar as LICENSE also here:
|
|
||||||
* https://github.com/Rsl1122/Plan-PlayerAnalytics/blob/master/Plan/src/main/resources/LICENSE
|
|
||||||
*/
|
|
||||||
package com.djrapitops.plan.system.info.request;
|
|
||||||
|
|
||||||
import com.djrapitops.plan.api.exceptions.connection.WebException;
|
|
||||||
import com.djrapitops.plan.system.info.InfoSystem;
|
|
||||||
import com.djrapitops.plan.system.webserver.response.DefaultResponses;
|
|
||||||
import com.djrapitops.plan.system.webserver.response.Response;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* InfoRequest for generating network page content of a Bukkit server.
|
|
||||||
*
|
|
||||||
* @author Rsl1122
|
|
||||||
*/
|
|
||||||
public class GenerateNetworkPageContentRequest implements WideRequest, GenerateRequest {
|
|
||||||
|
|
||||||
private final InfoSystem infoSystem;
|
|
||||||
|
|
||||||
GenerateNetworkPageContentRequest(InfoSystem infoSystem) {
|
|
||||||
this.infoSystem = infoSystem;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Response handleRequest(Map<String, String> variables) throws WebException {
|
|
||||||
runLocally();
|
|
||||||
return DefaultResponses.SUCCESS.get();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void runLocally() throws WebException {
|
|
||||||
infoSystem.updateNetworkPage();
|
|
||||||
}
|
|
||||||
}
|
|
@ -5,6 +5,7 @@ import com.djrapitops.plan.system.info.InfoSystem;
|
|||||||
import com.djrapitops.plan.system.info.connection.ConnectionSystem;
|
import com.djrapitops.plan.system.info.connection.ConnectionSystem;
|
||||||
import com.djrapitops.plan.system.info.server.ServerInfo;
|
import com.djrapitops.plan.system.info.server.ServerInfo;
|
||||||
import com.djrapitops.plan.system.processing.Processing;
|
import com.djrapitops.plan.system.processing.Processing;
|
||||||
|
import com.djrapitops.plan.system.processing.processors.Processors;
|
||||||
import com.djrapitops.plan.system.settings.config.PlanConfig;
|
import com.djrapitops.plan.system.settings.config.PlanConfig;
|
||||||
import com.djrapitops.plan.system.webserver.response.ResponseFactory;
|
import com.djrapitops.plan.system.webserver.response.ResponseFactory;
|
||||||
import com.djrapitops.plan.utilities.file.export.HtmlExport;
|
import com.djrapitops.plan.utilities.file.export.HtmlExport;
|
||||||
@ -28,6 +29,7 @@ public class InfoRequestFactory {
|
|||||||
private final Lazy<PlanPlugin> plugin;
|
private final Lazy<PlanPlugin> plugin;
|
||||||
private final Lazy<PlanConfig> config;
|
private final Lazy<PlanConfig> config;
|
||||||
private final Lazy<Processing> processing;
|
private final Lazy<Processing> processing;
|
||||||
|
private final Lazy<Processors> processors;
|
||||||
private final Lazy<InfoSystem> infoSystem;
|
private final Lazy<InfoSystem> infoSystem;
|
||||||
private final Lazy<ConnectionSystem> connectionSystem;
|
private final Lazy<ConnectionSystem> connectionSystem;
|
||||||
private final Lazy<ServerInfo> serverInfo;
|
private final Lazy<ServerInfo> serverInfo;
|
||||||
@ -43,6 +45,7 @@ public class InfoRequestFactory {
|
|||||||
Lazy<PlanPlugin> plugin,
|
Lazy<PlanPlugin> plugin,
|
||||||
Lazy<PlanConfig> config,
|
Lazy<PlanConfig> config,
|
||||||
Lazy<Processing> processing,
|
Lazy<Processing> processing,
|
||||||
|
Lazy<Processors> processors,
|
||||||
Lazy<InfoSystem> infoSystem,
|
Lazy<InfoSystem> infoSystem,
|
||||||
Lazy<ConnectionSystem> connectionSystem,
|
Lazy<ConnectionSystem> connectionSystem,
|
||||||
Lazy<ServerInfo> serverInfo,
|
Lazy<ServerInfo> serverInfo,
|
||||||
@ -56,6 +59,7 @@ public class InfoRequestFactory {
|
|||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
this.config = config;
|
this.config = config;
|
||||||
this.processing = processing;
|
this.processing = processing;
|
||||||
|
this.processors = processors;
|
||||||
this.infoSystem = infoSystem;
|
this.infoSystem = infoSystem;
|
||||||
this.connectionSystem = connectionSystem;
|
this.connectionSystem = connectionSystem;
|
||||||
this.serverInfo = serverInfo;
|
this.serverInfo = serverInfo;
|
||||||
@ -68,7 +72,7 @@ public class InfoRequestFactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public CacheRequest cacheAnalysisPageRequest(UUID serverUUID, String html) {
|
public CacheRequest cacheAnalysisPageRequest(UUID serverUUID, String html) {
|
||||||
return new CacheAnalysisPageRequest(serverUUID, html, config.get(), processing.get(), htmlExport.get());
|
return new CacheAnalysisPageRequest(serverUUID, html, config.get(), processing.get(), processors.get(), htmlExport.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
public CacheRequest cacheInspectPageRequest(UUID uuid, String html) {
|
public CacheRequest cacheInspectPageRequest(UUID uuid, String html) {
|
||||||
@ -95,10 +99,6 @@ public class InfoRequestFactory {
|
|||||||
return new GenerateInspectPluginsTabRequest(uuid, infoSystem.get(), this, pageFactory.get());
|
return new GenerateInspectPluginsTabRequest(uuid, infoSystem.get(), this, pageFactory.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
public GenerateNetworkPageContentRequest generateNetworkPageContentRequest() {
|
|
||||||
return new GenerateNetworkPageContentRequest(infoSystem.get());
|
|
||||||
}
|
|
||||||
|
|
||||||
public SaveDBSettingsRequest saveDBSettingsRequest() {
|
public SaveDBSettingsRequest saveDBSettingsRequest() {
|
||||||
return new SaveDBSettingsRequest(plugin.get(), config.get(), logger.get(), runnableFactory.get());
|
return new SaveDBSettingsRequest(plugin.get(), config.get(), logger.get(), runnableFactory.get());
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ import com.djrapitops.plan.system.info.InfoSystem;
|
|||||||
import com.djrapitops.plan.system.info.connection.ConnectionSystem;
|
import com.djrapitops.plan.system.info.connection.ConnectionSystem;
|
||||||
import com.djrapitops.plan.system.info.server.ServerInfo;
|
import com.djrapitops.plan.system.info.server.ServerInfo;
|
||||||
import com.djrapitops.plan.system.processing.Processing;
|
import com.djrapitops.plan.system.processing.Processing;
|
||||||
|
import com.djrapitops.plan.system.processing.processors.Processors;
|
||||||
import com.djrapitops.plan.system.settings.config.PlanConfig;
|
import com.djrapitops.plan.system.settings.config.PlanConfig;
|
||||||
import com.djrapitops.plan.system.webserver.response.ResponseFactory;
|
import com.djrapitops.plan.system.webserver.response.ResponseFactory;
|
||||||
import com.djrapitops.plan.utilities.file.export.HtmlExport;
|
import com.djrapitops.plan.utilities.file.export.HtmlExport;
|
||||||
@ -27,6 +28,7 @@ public class InfoRequestHandlerFactory {
|
|||||||
private final Lazy<PlanPlugin> plugin;
|
private final Lazy<PlanPlugin> plugin;
|
||||||
private final Lazy<PlanConfig> config;
|
private final Lazy<PlanConfig> config;
|
||||||
private final Lazy<Processing> processing;
|
private final Lazy<Processing> processing;
|
||||||
|
private final Lazy<Processors> processors;
|
||||||
private final Lazy<InfoSystem> infoSystem;
|
private final Lazy<InfoSystem> infoSystem;
|
||||||
private final Lazy<ConnectionSystem> connectionSystem;
|
private final Lazy<ConnectionSystem> connectionSystem;
|
||||||
private final Lazy<ServerInfo> serverInfo;
|
private final Lazy<ServerInfo> serverInfo;
|
||||||
@ -42,6 +44,7 @@ public class InfoRequestHandlerFactory {
|
|||||||
Lazy<PlanPlugin> plugin,
|
Lazy<PlanPlugin> plugin,
|
||||||
Lazy<PlanConfig> config,
|
Lazy<PlanConfig> config,
|
||||||
Lazy<Processing> processing,
|
Lazy<Processing> processing,
|
||||||
|
Lazy<Processors> processors,
|
||||||
Lazy<InfoSystem> infoSystem,
|
Lazy<InfoSystem> infoSystem,
|
||||||
Lazy<ConnectionSystem> connectionSystem,
|
Lazy<ConnectionSystem> connectionSystem,
|
||||||
Lazy<ServerInfo> serverInfo,
|
Lazy<ServerInfo> serverInfo,
|
||||||
@ -55,6 +58,7 @@ public class InfoRequestHandlerFactory {
|
|||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
this.config = config;
|
this.config = config;
|
||||||
this.processing = processing;
|
this.processing = processing;
|
||||||
|
this.processors = processors;
|
||||||
this.infoSystem = infoSystem;
|
this.infoSystem = infoSystem;
|
||||||
this.connectionSystem = connectionSystem;
|
this.connectionSystem = connectionSystem;
|
||||||
this.serverInfo = serverInfo;
|
this.serverInfo = serverInfo;
|
||||||
@ -67,7 +71,7 @@ public class InfoRequestHandlerFactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
CacheRequest cacheAnalysisPageRequest() {
|
CacheRequest cacheAnalysisPageRequest() {
|
||||||
return new CacheAnalysisPageRequest(config.get(), processing.get(), htmlExport.get());
|
return new CacheAnalysisPageRequest(config.get(), processing.get(), processors.get(), htmlExport.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
CacheRequest cacheInspectPageRequest() {
|
CacheRequest cacheInspectPageRequest() {
|
||||||
@ -98,10 +102,6 @@ public class InfoRequestHandlerFactory {
|
|||||||
return new GenerateInspectPluginsTabRequest(infoSystem.get(), infoRequestFactory.get(), pageFactory.get());
|
return new GenerateInspectPluginsTabRequest(infoSystem.get(), infoRequestFactory.get(), pageFactory.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
GenerateRequest generateNetworkPageContentRequest() {
|
|
||||||
return new GenerateNetworkPageContentRequest(infoSystem.get());
|
|
||||||
}
|
|
||||||
|
|
||||||
SetupRequest saveDBSettingsRequest() {
|
SetupRequest saveDBSettingsRequest() {
|
||||||
return new SaveDBSettingsRequest(plugin.get(), config.get(), logger.get(), runnableFactory.get());
|
return new SaveDBSettingsRequest(plugin.get(), config.get(), logger.get(), runnableFactory.get());
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,6 @@ public class InfoRequests extends HashMap<String, InfoRequest> {
|
|||||||
putRequest(handlers.generateAnalysisPageRequest());
|
putRequest(handlers.generateAnalysisPageRequest());
|
||||||
putRequest(handlers.generateInspectPageRequest());
|
putRequest(handlers.generateInspectPageRequest());
|
||||||
putRequest(handlers.generateInspectPluginsTabRequest());
|
putRequest(handlers.generateInspectPluginsTabRequest());
|
||||||
putRequest(handlers.generateNetworkPageContentRequest());
|
|
||||||
|
|
||||||
putRequest(handlers.saveDBSettingsRequest());
|
putRequest(handlers.saveDBSettingsRequest());
|
||||||
putRequest(handlers.sendDBSettingsRequest());
|
putRequest(handlers.sendDBSettingsRequest());
|
||||||
|
@ -2,6 +2,7 @@ package com.djrapitops.plan.system.processing.processors.info;
|
|||||||
|
|
||||||
import com.djrapitops.plan.system.info.InfoSystem;
|
import com.djrapitops.plan.system.info.InfoSystem;
|
||||||
import com.djrapitops.plan.system.info.connection.WebExceptionLogger;
|
import com.djrapitops.plan.system.info.connection.WebExceptionLogger;
|
||||||
|
import com.djrapitops.plan.system.info.server.ServerInfo;
|
||||||
import com.djrapitops.plugin.command.Sender;
|
import com.djrapitops.plugin.command.Sender;
|
||||||
import com.djrapitops.plugin.task.RunnableFactory;
|
import com.djrapitops.plugin.task.RunnableFactory;
|
||||||
import dagger.Lazy;
|
import dagger.Lazy;
|
||||||
@ -19,16 +20,18 @@ import java.util.function.BiConsumer;
|
|||||||
@Singleton
|
@Singleton
|
||||||
public class InfoProcessors {
|
public class InfoProcessors {
|
||||||
|
|
||||||
|
private final Lazy<ServerInfo> serverInfo;
|
||||||
private final Lazy<InfoSystem> infoSystem;
|
private final Lazy<InfoSystem> infoSystem;
|
||||||
private final Lazy<WebExceptionLogger> webExceptionLogger;
|
private final Lazy<WebExceptionLogger> webExceptionLogger;
|
||||||
private final Lazy<RunnableFactory> runnableFactory;
|
private final Lazy<RunnableFactory> runnableFactory;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public InfoProcessors(
|
public InfoProcessors(
|
||||||
Lazy<InfoSystem> infoSystem,
|
Lazy<ServerInfo> serverInfo, Lazy<InfoSystem> infoSystem,
|
||||||
Lazy<WebExceptionLogger> webExceptionLogger,
|
Lazy<WebExceptionLogger> webExceptionLogger,
|
||||||
Lazy<RunnableFactory> runnableFactory
|
Lazy<RunnableFactory> runnableFactory
|
||||||
) {
|
) {
|
||||||
|
this.serverInfo = serverInfo;
|
||||||
this.infoSystem = infoSystem;
|
this.infoSystem = infoSystem;
|
||||||
this.webExceptionLogger = webExceptionLogger;
|
this.webExceptionLogger = webExceptionLogger;
|
||||||
this.runnableFactory = runnableFactory;
|
this.runnableFactory = runnableFactory;
|
||||||
@ -46,7 +49,7 @@ public class InfoProcessors {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public NetworkPageUpdateProcessor networkPageUpdateProcessor() {
|
public NetworkPageUpdateProcessor networkPageUpdateProcessor() {
|
||||||
return new NetworkPageUpdateProcessor(infoSystem.get(), webExceptionLogger.get());
|
return new NetworkPageUpdateProcessor(serverInfo.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
public PlayerPageUpdateProcessor playerPageUpdateProcessor(UUID uuid) {
|
public PlayerPageUpdateProcessor playerPageUpdateProcessor(UUID uuid) {
|
||||||
|
@ -4,8 +4,9 @@
|
|||||||
*/
|
*/
|
||||||
package com.djrapitops.plan.system.processing.processors.info;
|
package com.djrapitops.plan.system.processing.processors.info;
|
||||||
|
|
||||||
import com.djrapitops.plan.system.info.InfoSystem;
|
import com.djrapitops.plan.system.info.server.ServerInfo;
|
||||||
import com.djrapitops.plan.system.info.connection.WebExceptionLogger;
|
import com.djrapitops.plan.system.webserver.cache.PageId;
|
||||||
|
import com.djrapitops.plan.system.webserver.cache.ResponseCache;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Processor for updating the network page.
|
* Processor for updating the network page.
|
||||||
@ -14,19 +15,16 @@ import com.djrapitops.plan.system.info.connection.WebExceptionLogger;
|
|||||||
*/
|
*/
|
||||||
public class NetworkPageUpdateProcessor implements Runnable {
|
public class NetworkPageUpdateProcessor implements Runnable {
|
||||||
|
|
||||||
private final InfoSystem infoSystem;
|
private final ServerInfo serverInfo;
|
||||||
private final WebExceptionLogger webExceptionLogger;
|
|
||||||
|
|
||||||
NetworkPageUpdateProcessor(
|
NetworkPageUpdateProcessor(
|
||||||
InfoSystem infoSystem,
|
ServerInfo serverInfo
|
||||||
WebExceptionLogger webExceptionLogger
|
|
||||||
) {
|
) {
|
||||||
this.infoSystem = infoSystem;
|
this.serverInfo = serverInfo;
|
||||||
this.webExceptionLogger = webExceptionLogger;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
webExceptionLogger.logIfOccurs(this.getClass(), infoSystem::updateNetworkPage);
|
ResponseCache.clearResponse(PageId.SERVER.of(serverInfo.getServerUUID()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,6 @@ public class BukkitTaskSystem extends ServerTaskSystem {
|
|||||||
runnableFactory,
|
runnableFactory,
|
||||||
Check.isPaperAvailable() ? paperTPSCountTimer : bukkitTPSCountTimer,
|
Check.isPaperAvailable() ? paperTPSCountTimer : bukkitTPSCountTimer,
|
||||||
config,
|
config,
|
||||||
networkPageRefreshTask,
|
|
||||||
bootAnalysisTask,
|
bootAnalysisTask,
|
||||||
periodicAnalysisTask,
|
periodicAnalysisTask,
|
||||||
logsFolderCleanTask
|
logsFolderCleanTask
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
package com.djrapitops.plan.system.tasks;
|
package com.djrapitops.plan.system.tasks;
|
||||||
|
|
||||||
import com.djrapitops.plan.system.tasks.bungee.BungeeTPSCountTimer;
|
import com.djrapitops.plan.system.tasks.bungee.BungeeTPSCountTimer;
|
||||||
import com.djrapitops.plan.system.tasks.bungee.EnableConnectionTask;
|
|
||||||
import com.djrapitops.plan.system.tasks.server.NetworkPageRefreshTask;
|
import com.djrapitops.plan.system.tasks.server.NetworkPageRefreshTask;
|
||||||
import com.djrapitops.plugin.api.TimeAmount;
|
import com.djrapitops.plugin.api.TimeAmount;
|
||||||
import com.djrapitops.plugin.task.RunnableFactory;
|
import com.djrapitops.plugin.task.RunnableFactory;
|
||||||
@ -20,7 +19,6 @@ import java.util.concurrent.TimeUnit;
|
|||||||
*/
|
*/
|
||||||
public class BungeeTaskSystem extends TaskSystem {
|
public class BungeeTaskSystem extends TaskSystem {
|
||||||
|
|
||||||
private final EnableConnectionTask enableConnectionTask;
|
|
||||||
private final NetworkPageRefreshTask networkPageRefreshTask;
|
private final NetworkPageRefreshTask networkPageRefreshTask;
|
||||||
private final LogsFolderCleanTask logsFolderCleanTask;
|
private final LogsFolderCleanTask logsFolderCleanTask;
|
||||||
|
|
||||||
@ -28,13 +26,11 @@ public class BungeeTaskSystem extends TaskSystem {
|
|||||||
public BungeeTaskSystem(
|
public BungeeTaskSystem(
|
||||||
RunnableFactory runnableFactory,
|
RunnableFactory runnableFactory,
|
||||||
BungeeTPSCountTimer bungeeTPSCountTimer,
|
BungeeTPSCountTimer bungeeTPSCountTimer,
|
||||||
EnableConnectionTask enableConnectionTask,
|
|
||||||
NetworkPageRefreshTask networkPageRefreshTask,
|
NetworkPageRefreshTask networkPageRefreshTask,
|
||||||
LogsFolderCleanTask logsFolderCleanTask
|
LogsFolderCleanTask logsFolderCleanTask
|
||||||
) {
|
) {
|
||||||
super(runnableFactory, bungeeTPSCountTimer);
|
super(runnableFactory, bungeeTPSCountTimer);
|
||||||
|
|
||||||
this.enableConnectionTask = enableConnectionTask;
|
|
||||||
this.networkPageRefreshTask = networkPageRefreshTask;
|
this.networkPageRefreshTask = networkPageRefreshTask;
|
||||||
this.logsFolderCleanTask = logsFolderCleanTask;
|
this.logsFolderCleanTask = logsFolderCleanTask;
|
||||||
}
|
}
|
||||||
@ -45,7 +41,6 @@ public class BungeeTaskSystem extends TaskSystem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void registerTasks() {
|
private void registerTasks() {
|
||||||
registerTask(enableConnectionTask).runTaskAsynchronously();
|
|
||||||
registerTask(tpsCountTimer).runTaskTimerAsynchronously(1000, TimeAmount.toTicks(1L, TimeUnit.SECONDS));
|
registerTask(tpsCountTimer).runTaskTimerAsynchronously(1000, TimeAmount.toTicks(1L, TimeUnit.SECONDS));
|
||||||
registerTask(networkPageRefreshTask).runTaskTimerAsynchronously(1500, TimeAmount.toTicks(5L, TimeUnit.MINUTES));
|
registerTask(networkPageRefreshTask).runTaskTimerAsynchronously(1500, TimeAmount.toTicks(5L, TimeUnit.MINUTES));
|
||||||
registerTask(logsFolderCleanTask).runTaskLaterAsynchronously(TimeAmount.toTicks(30L, TimeUnit.SECONDS));
|
registerTask(logsFolderCleanTask).runTaskLaterAsynchronously(TimeAmount.toTicks(30L, TimeUnit.SECONDS));
|
||||||
|
@ -3,7 +3,6 @@ package com.djrapitops.plan.system.tasks;
|
|||||||
import com.djrapitops.plan.system.settings.Settings;
|
import com.djrapitops.plan.system.settings.Settings;
|
||||||
import com.djrapitops.plan.system.settings.config.PlanConfig;
|
import com.djrapitops.plan.system.settings.config.PlanConfig;
|
||||||
import com.djrapitops.plan.system.tasks.server.BootAnalysisTask;
|
import com.djrapitops.plan.system.tasks.server.BootAnalysisTask;
|
||||||
import com.djrapitops.plan.system.tasks.server.NetworkPageRefreshTask;
|
|
||||||
import com.djrapitops.plan.system.tasks.server.PeriodicAnalysisTask;
|
import com.djrapitops.plan.system.tasks.server.PeriodicAnalysisTask;
|
||||||
import com.djrapitops.plugin.api.TimeAmount;
|
import com.djrapitops.plugin.api.TimeAmount;
|
||||||
import com.djrapitops.plugin.task.RunnableFactory;
|
import com.djrapitops.plugin.task.RunnableFactory;
|
||||||
@ -18,7 +17,6 @@ import java.util.concurrent.TimeUnit;
|
|||||||
public abstract class ServerTaskSystem extends TaskSystem {
|
public abstract class ServerTaskSystem extends TaskSystem {
|
||||||
|
|
||||||
private final PlanConfig config;
|
private final PlanConfig config;
|
||||||
private final NetworkPageRefreshTask networkPageRefreshTask;
|
|
||||||
private final BootAnalysisTask bootAnalysisTask;
|
private final BootAnalysisTask bootAnalysisTask;
|
||||||
private final PeriodicAnalysisTask periodicAnalysisTask;
|
private final PeriodicAnalysisTask periodicAnalysisTask;
|
||||||
private final LogsFolderCleanTask logsFolderCleanTask;
|
private final LogsFolderCleanTask logsFolderCleanTask;
|
||||||
@ -27,13 +25,11 @@ public abstract class ServerTaskSystem extends TaskSystem {
|
|||||||
RunnableFactory runnableFactory,
|
RunnableFactory runnableFactory,
|
||||||
TPSCountTimer tpsCountTimer,
|
TPSCountTimer tpsCountTimer,
|
||||||
PlanConfig config,
|
PlanConfig config,
|
||||||
NetworkPageRefreshTask networkPageRefreshTask,
|
|
||||||
BootAnalysisTask bootAnalysisTask,
|
BootAnalysisTask bootAnalysisTask,
|
||||||
PeriodicAnalysisTask periodicAnalysisTask,
|
PeriodicAnalysisTask periodicAnalysisTask,
|
||||||
LogsFolderCleanTask logsFolderCleanTask) {
|
LogsFolderCleanTask logsFolderCleanTask) {
|
||||||
super(runnableFactory, tpsCountTimer);
|
super(runnableFactory, tpsCountTimer);
|
||||||
this.config = config;
|
this.config = config;
|
||||||
this.networkPageRefreshTask = networkPageRefreshTask;
|
|
||||||
this.bootAnalysisTask = bootAnalysisTask;
|
this.bootAnalysisTask = bootAnalysisTask;
|
||||||
this.periodicAnalysisTask = periodicAnalysisTask;
|
this.periodicAnalysisTask = periodicAnalysisTask;
|
||||||
this.logsFolderCleanTask = logsFolderCleanTask;
|
this.logsFolderCleanTask = logsFolderCleanTask;
|
||||||
@ -51,7 +47,6 @@ public abstract class ServerTaskSystem extends TaskSystem {
|
|||||||
long analysisPeriod = TimeAmount.toTicks(analysisRefreshMinutes, TimeUnit.MINUTES);
|
long analysisPeriod = TimeAmount.toTicks(analysisRefreshMinutes, TimeUnit.MINUTES);
|
||||||
|
|
||||||
registerTask(tpsCountTimer).runTaskTimer(1000, TimeAmount.toTicks(1L, TimeUnit.SECONDS));
|
registerTask(tpsCountTimer).runTaskTimer(1000, TimeAmount.toTicks(1L, TimeUnit.SECONDS));
|
||||||
registerTask(networkPageRefreshTask).runTaskTimerAsynchronously(20L, TimeAmount.toTicks(5L, TimeUnit.MINUTES));
|
|
||||||
registerTask(bootAnalysisTask).runTaskLaterAsynchronously(TimeAmount.toTicks(30L, TimeUnit.SECONDS));
|
registerTask(bootAnalysisTask).runTaskLaterAsynchronously(TimeAmount.toTicks(30L, TimeUnit.SECONDS));
|
||||||
|
|
||||||
if (analysisRefreshTaskIsEnabled) {
|
if (analysisRefreshTaskIsEnabled) {
|
||||||
|
@ -31,7 +31,6 @@ public class SpongeTaskSystem extends ServerTaskSystem {
|
|||||||
runnableFactory,
|
runnableFactory,
|
||||||
spongeTPSCountTimer,
|
spongeTPSCountTimer,
|
||||||
config,
|
config,
|
||||||
networkPageRefreshTask,
|
|
||||||
bootAnalysisTask,
|
bootAnalysisTask,
|
||||||
periodicAnalysisTask,
|
periodicAnalysisTask,
|
||||||
logsFolderCleanTask
|
logsFolderCleanTask
|
||||||
|
@ -1,36 +0,0 @@
|
|||||||
package com.djrapitops.plan.system.tasks.bungee;
|
|
||||||
|
|
||||||
import com.djrapitops.plan.system.info.connection.ConnectionSystem;
|
|
||||||
import com.djrapitops.plan.system.info.connection.WebExceptionLogger;
|
|
||||||
import com.djrapitops.plan.system.info.request.InfoRequestFactory;
|
|
||||||
import com.djrapitops.plugin.task.AbsRunnable;
|
|
||||||
|
|
||||||
import javax.inject.Inject;
|
|
||||||
import javax.inject.Singleton;
|
|
||||||
|
|
||||||
@Singleton
|
|
||||||
public class EnableConnectionTask extends AbsRunnable {
|
|
||||||
|
|
||||||
private ConnectionSystem connectionSystem;
|
|
||||||
private final InfoRequestFactory infoRequestFactory;
|
|
||||||
private final WebExceptionLogger webExceptionLogger;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
public EnableConnectionTask(
|
|
||||||
ConnectionSystem connectionSystem,
|
|
||||||
InfoRequestFactory infoRequestFactory,
|
|
||||||
WebExceptionLogger webExceptionLogger
|
|
||||||
) {
|
|
||||||
this.connectionSystem = connectionSystem;
|
|
||||||
this.infoRequestFactory = infoRequestFactory;
|
|
||||||
this.webExceptionLogger = webExceptionLogger;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
webExceptionLogger.logIfOccurs(this.getClass(),
|
|
||||||
() -> connectionSystem.sendWideInfoRequest(infoRequestFactory.generateNetworkPageContentRequest())
|
|
||||||
);
|
|
||||||
cancel();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,7 +1,8 @@
|
|||||||
package com.djrapitops.plan.system.tasks.server;
|
package com.djrapitops.plan.system.tasks.server;
|
||||||
|
|
||||||
import com.djrapitops.plan.system.info.InfoSystem;
|
import com.djrapitops.plan.system.info.server.ServerInfo;
|
||||||
import com.djrapitops.plan.system.info.connection.WebExceptionLogger;
|
import com.djrapitops.plan.system.webserver.cache.PageId;
|
||||||
|
import com.djrapitops.plan.system.webserver.cache.ResponseCache;
|
||||||
import com.djrapitops.plugin.task.AbsRunnable;
|
import com.djrapitops.plugin.task.AbsRunnable;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
@ -10,20 +11,15 @@ import javax.inject.Singleton;
|
|||||||
@Singleton
|
@Singleton
|
||||||
public class NetworkPageRefreshTask extends AbsRunnable {
|
public class NetworkPageRefreshTask extends AbsRunnable {
|
||||||
|
|
||||||
private InfoSystem infoSystem;
|
private final ServerInfo serverInfo;
|
||||||
private final WebExceptionLogger webExceptionLogger;
|
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public NetworkPageRefreshTask(
|
public NetworkPageRefreshTask(ServerInfo serverInfo) {
|
||||||
InfoSystem infoSystem,
|
this.serverInfo = serverInfo;
|
||||||
WebExceptionLogger webExceptionLogger
|
|
||||||
) {
|
|
||||||
this.infoSystem = infoSystem;
|
|
||||||
this.webExceptionLogger = webExceptionLogger;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
webExceptionLogger.logIfOccurs(this.getClass(), () -> infoSystem.updateNetworkPage());
|
ResponseCache.clearResponse(PageId.SERVER.of(serverInfo.getServerUUID()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -70,12 +70,7 @@ public class ServerPageHandler implements PageHandler {
|
|||||||
return response;
|
return response;
|
||||||
} else {
|
} else {
|
||||||
if (Check.isBungeeAvailable() && serverInfo.getServerUUID().equals(serverUUID)) {
|
if (Check.isBungeeAvailable() && serverInfo.getServerUUID().equals(serverUUID)) {
|
||||||
try {
|
return ResponseCache.loadResponse(PageId.SERVER.of(serverUUID), responseFactory::networkPageResponse);
|
||||||
infoSystem.updateNetworkPage();
|
|
||||||
} catch (WebException e) {
|
|
||||||
/*Ignore, should not occur*/
|
|
||||||
}
|
|
||||||
return ResponseCache.loadResponse(PageId.SERVER.of(serverUUID));
|
|
||||||
}
|
}
|
||||||
return refreshNow(serverUUID);
|
return refreshNow(serverUUID);
|
||||||
}
|
}
|
||||||
|
@ -9,9 +9,6 @@ import com.djrapitops.plan.data.store.containers.NetworkContainer;
|
|||||||
import com.djrapitops.plan.data.store.keys.NetworkKeys;
|
import com.djrapitops.plan.data.store.keys.NetworkKeys;
|
||||||
import com.djrapitops.plan.system.file.PlanFiles;
|
import com.djrapitops.plan.system.file.PlanFiles;
|
||||||
import com.djrapitops.plan.system.info.server.properties.ServerProperties;
|
import com.djrapitops.plan.system.info.server.properties.ServerProperties;
|
||||||
import com.djrapitops.plan.system.webserver.cache.PageId;
|
|
||||||
import com.djrapitops.plan.system.webserver.cache.ResponseCache;
|
|
||||||
import com.djrapitops.plan.system.webserver.response.pages.parts.NetworkPageContent;
|
|
||||||
import com.djrapitops.plan.utilities.formatting.PlaceholderReplacer;
|
import com.djrapitops.plan.utilities.formatting.PlaceholderReplacer;
|
||||||
|
|
||||||
import static com.djrapitops.plan.data.store.keys.NetworkKeys.*;
|
import static com.djrapitops.plan.data.store.keys.NetworkKeys.*;
|
||||||
@ -54,11 +51,9 @@ public class NetworkPage implements Page {
|
|||||||
WORLD_MAP_SERIES, WORLD_MAP_HIGH_COLOR, WORLD_MAP_LOW_COLOR,
|
WORLD_MAP_SERIES, WORLD_MAP_HIGH_COLOR, WORLD_MAP_LOW_COLOR,
|
||||||
COUNTRY_CATEGORIES, COUNTRY_SERIES,
|
COUNTRY_CATEGORIES, COUNTRY_SERIES,
|
||||||
HEALTH_INDEX, HEALTH_NOTES,
|
HEALTH_INDEX, HEALTH_NOTES,
|
||||||
ACTIVITY_PIE_SERIES, ACTIVITY_STACK_SERIES, ACTIVITY_STACK_CATEGORIES
|
ACTIVITY_PIE_SERIES, ACTIVITY_STACK_SERIES, ACTIVITY_STACK_CATEGORIES,
|
||||||
|
SERVERS_TAB
|
||||||
);
|
);
|
||||||
NetworkPageContent networkPageContent = (NetworkPageContent)
|
|
||||||
ResponseCache.loadResponse(PageId.NETWORK_CONTENT.id(), NetworkPageContent::new);
|
|
||||||
placeholderReplacer.put("tabContentServers", networkPageContent.getContents());
|
|
||||||
|
|
||||||
return placeholderReplacer.apply(files.readCustomizableResourceFlat("web/network.html"));
|
return placeholderReplacer.apply(files.readCustomizableResourceFlat("web/network.html"));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
Loading…
Reference in New Issue
Block a user