Remove LoggingService and RequestManagerFactory from Services and make fully static

This commit is contained in:
Rohit Awate 2018-08-01 17:04:28 +05:30
parent 22973d1c95
commit 45b757c7c8
No known key found for this signature in database
GPG key ID: 1051D7B79CF2EE25
19 changed files with 106 additions and 122 deletions

View file

@ -30,9 +30,6 @@ import javafx.stage.Stage;
public class Main extends Application {
@Override
public void start(Stage primaryStage) throws Exception {
Services.start();
Services.startServicesThread.join();
SettingsLoader settingsLoader = new SettingsLoader();
settingsLoader.settingsLoaderThread.join();

View file

@ -20,7 +20,7 @@ import com.rohitawate.everest.controllers.codearea.EverestCodeArea;
import com.rohitawate.everest.controllers.codearea.highlighters.HighlighterFactory;
import com.rohitawate.everest.controllers.state.ComposerState;
import com.rohitawate.everest.controllers.state.FieldState;
import com.rohitawate.everest.misc.Services;
import com.rohitawate.everest.logging.LoggingService;
import com.rohitawate.everest.misc.ThemeManager;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
@ -98,7 +98,7 @@ public class BodyTabController implements Initializable {
urlTab.setContent(formTabContent);
urlTabController = loader.getController();
} catch (IOException e) {
Services.loggingService.logSevere("Could not load URL tab.", e, LocalDateTime.now());
LoggingService.logSevere("Could not load URL tab.", e, LocalDateTime.now());
}
}

View file

@ -26,6 +26,7 @@ import com.rohitawate.everest.controllers.state.FieldState;
import com.rohitawate.everest.exceptions.RedirectException;
import com.rohitawate.everest.exceptions.UnreliableResponseException;
import com.rohitawate.everest.format.FormatterFactory;
import com.rohitawate.everest.logging.LoggingService;
import com.rohitawate.everest.misc.Services;
import com.rohitawate.everest.misc.ThemeManager;
import com.rohitawate.everest.models.requests.DELETERequest;
@ -34,6 +35,7 @@ import com.rohitawate.everest.models.requests.GETRequest;
import com.rohitawate.everest.models.responses.EverestResponse;
import com.rohitawate.everest.requestmanager.DataDispatchRequestManager;
import com.rohitawate.everest.requestmanager.RequestManager;
import com.rohitawate.everest.requestmanager.RequestManagersFactory;
import javafx.beans.binding.Bindings;
import javafx.beans.property.IntegerProperty;
import javafx.beans.property.SimpleIntegerProperty;
@ -135,7 +137,7 @@ public class DashboardController implements Initializable {
bodyTabController = bodyTabLoader.getController();
bodyTab.setContent(bodyTabContent);
} catch (IOException e) {
Services.loggingService.logSevere("Could not load headers/body tabs.", e, LocalDateTime.now());
LoggingService.logSevere("Could not load headers/body tabs.", e, LocalDateTime.now());
}
snackbar = new JFXSnackbar(dashboard);
@ -181,7 +183,7 @@ public class DashboardController implements Initializable {
FormatterFactory.getHighlighter(type),
HighlighterFactory.getHighlighter(type));
} catch (IOException e) {
Services.loggingService.logWarning("Response could not be parsed.", e, LocalDateTime.now());
LoggingService.logWarning("Response could not be parsed.", e, LocalDateTime.now());
}
return;
@ -241,7 +243,7 @@ public class DashboardController implements Initializable {
getRequest.setTarget(address);
getRequest.setHeaders(headerTabController.getHeaders());
requestManager = Services.pool.get();
requestManager = RequestManagersFactory.get();
requestManager.setRequest(getRequest);
break;
case "POST":
@ -286,7 +288,7 @@ public class DashboardController implements Initializable {
dataRequest.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
}
requestManager = Services.pool.data();
requestManager = RequestManagersFactory.data();
requestManager.setRequest(dataRequest);
break;
case "DELETE":
@ -296,7 +298,7 @@ public class DashboardController implements Initializable {
deleteRequest.setTarget(address);
deleteRequest.setHeaders(headerTabController.getHeaders());
requestManager = Services.pool.delete();
requestManager = RequestManagersFactory.delete();
requestManager.setRequest(deleteRequest);
break;
default:
@ -310,7 +312,7 @@ public class DashboardController implements Initializable {
showLayer(ResponseLayer.PROMPT);
snackbar.show("Invalid address. Please verify and try again.", 3000);
} catch (Exception E) {
Services.loggingService.logSevere("Request execution failed.", E, LocalDateTime.now());
LoggingService.logSevere("Request execution failed.", E, LocalDateTime.now());
showLayer(ResponseLayer.ERROR);
errorTitle.setText("Oops... That's embarrassing!");
errorDetails.setText("Something went wrong. Try to make another request.\nRestart Everest if that doesn't work.");
@ -322,7 +324,7 @@ public class DashboardController implements Initializable {
showLayer(ResponseLayer.ERROR);
Throwable throwable = requestManager.getException();
Exception exception = (Exception) throwable;
Services.loggingService.logWarning(httpMethodBox.getValue() + " request could not be processed.", exception, LocalDateTime.now());
LoggingService.logWarning(httpMethodBox.getValue() + " request could not be processed.", exception, LocalDateTime.now());
if (throwable.getClass() == UnreliableResponseException.class) {
UnreliableResponseException URE = (UnreliableResponseException) throwable;
@ -470,7 +472,7 @@ public class DashboardController implements Initializable {
try {
Desktop.getDesktop().browse(new URI(addressField.getText()));
} catch (Exception ex) {
Services.loggingService.logWarning("Invalid URL encountered while opening in browser.", ex, LocalDateTime.now());
LoggingService.logWarning("Invalid URL encountered while opening in browser.", ex, LocalDateTime.now());
}
}).start();
});
@ -491,7 +493,7 @@ public class DashboardController implements Initializable {
} catch (Exception e) {
String errorMessage = "Response could not be parsed.";
snackbar.show(errorMessage, 5000);
Services.loggingService.logSevere(errorMessage, e, LocalDateTime.now());
LoggingService.logSevere(errorMessage, e, LocalDateTime.now());
errorTitle.setText("Parsing Error");
errorDetails.setText(errorMessage);
showLayer(ResponseLayer.ERROR);
@ -597,7 +599,7 @@ public class DashboardController implements Initializable {
});
paramsBox.getChildren().add(headerField);
} catch (IOException e) {
Services.loggingService.logSevere("Could not append params field.", e, LocalDateTime.now());
LoggingService.logSevere("Could not append params field.", e, LocalDateTime.now());
}
}
@ -778,7 +780,7 @@ public class DashboardController implements Initializable {
}
if (!validMethod) {
Services.loggingService.logInfo("Application state file was tampered with. State could not be recovered.", LocalDateTime.now());
LoggingService.logInfo("Application state file was tampered with. State could not be recovered.", LocalDateTime.now());
return;
}

View file

@ -17,7 +17,7 @@
package com.rohitawate.everest.controllers;
import com.rohitawate.everest.controllers.state.FieldState;
import com.rohitawate.everest.misc.Services;
import com.rohitawate.everest.logging.LoggingService;
import com.rohitawate.everest.misc.ThemeManager;
import javafx.beans.binding.Bindings;
import javafx.beans.property.IntegerProperty;
@ -109,7 +109,7 @@ public class FormDataTabController implements Initializable {
});
fieldsBox.getChildren().add(fileField);
} catch (IOException e) {
Services.loggingService.logSevere("Could not add file field.", e, LocalDateTime.now());
LoggingService.logSevere("Could not add file field.", e, LocalDateTime.now());
}
}
@ -161,7 +161,7 @@ public class FormDataTabController implements Initializable {
});
fieldsBox.getChildren().add(stringField);
} catch (IOException e) {
Services.loggingService.logSevere("Could not add string field.", e, LocalDateTime.now());
LoggingService.logSevere("Could not add string field.", e, LocalDateTime.now());
}
}

View file

@ -17,7 +17,7 @@
package com.rohitawate.everest.controllers;
import com.rohitawate.everest.controllers.state.FieldState;
import com.rohitawate.everest.misc.Services;
import com.rohitawate.everest.logging.LoggingService;
import com.rohitawate.everest.misc.ThemeManager;
import javafx.beans.binding.Bindings;
import javafx.beans.property.IntegerProperty;
@ -102,7 +102,7 @@ public class HeaderTabController implements Initializable {
});
headersBox.getChildren().add(headerField);
} catch (IOException e) {
Services.loggingService.logSevere("Could not add string field.", e, LocalDateTime.now());
LoggingService.logSevere("Could not add string field.", e, LocalDateTime.now());
}
}

View file

@ -19,7 +19,7 @@ package com.rohitawate.everest.controllers;
import com.rohitawate.everest.controllers.search.Searchable;
import com.rohitawate.everest.controllers.state.ComposerState;
import com.rohitawate.everest.controllers.state.FieldState;
import com.rohitawate.everest.misc.Services;
import com.rohitawate.everest.logging.LoggingService;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Label;
@ -76,7 +76,7 @@ public class HistoryItemController implements Initializable, Searchable<Composer
if (comparisonString.contains(searchString))
return 9;
} catch (MalformedURLException e) {
Services.loggingService.logInfo("Failed to parse URL while calculating relativity index.", LocalDateTime.now());
LoggingService.logInfo("Failed to parse URL while calculating relativity index.", LocalDateTime.now());
}
// Checks if matches with HTTP method

View file

@ -19,9 +19,9 @@ package com.rohitawate.everest.controllers;
import com.fasterxml.jackson.core.type.TypeReference;
import com.rohitawate.everest.controllers.state.ComposerState;
import com.rohitawate.everest.controllers.state.DashboardState;
import com.rohitawate.everest.logging.LoggingService;
import com.rohitawate.everest.misc.EverestUtilities;
import com.rohitawate.everest.misc.KeyMap;
import com.rohitawate.everest.misc.Services;
import com.rohitawate.everest.misc.ThemeManager;
import javafx.application.Platform;
import javafx.beans.Observable;
@ -222,9 +222,9 @@ public class HomeWindowController implements Initializable {
try {
File stateFile = new File("Everest/config/state.json");
EverestUtilities.jsonMapper.writeValue(stateFile, composerStates);
Services.loggingService.logInfo("Application state saved.", LocalDateTime.now());
LoggingService.logInfo("Application state saved.", LocalDateTime.now());
} catch (IOException e) {
Services.loggingService.logSevere("Failed to save application state.", e, LocalDateTime.now());
LoggingService.logSevere("Failed to save application state.", e, LocalDateTime.now());
}
}
@ -233,7 +233,7 @@ public class HomeWindowController implements Initializable {
File stateFile = new File("Everest/config/state.json");
if (!stateFile.exists()) {
Services.loggingService.logInfo("Application state file not found. Loading default state.", LocalDateTime.now());
LoggingService.logInfo("Application state file not found. Loading default state.", LocalDateTime.now());
addTab();
return;
}
@ -251,10 +251,10 @@ public class HomeWindowController implements Initializable {
addTab();
}
} catch (IOException e) {
Services.loggingService.logWarning("Application state file is either corrupted or outdated. State recovery failed. Loading default state.", e, LocalDateTime.now());
LoggingService.logWarning("Application state file is either corrupted or outdated. State recovery failed. Loading default state.", e, LocalDateTime.now());
addTab();
} finally {
Services.loggingService.logInfo("Application loaded.", LocalDateTime.now());
LoggingService.logInfo("Application loaded.", LocalDateTime.now());
}
}

View file

@ -17,7 +17,7 @@
package com.rohitawate.everest.controllers;
import com.rohitawate.everest.controllers.state.FieldState;
import com.rohitawate.everest.misc.Services;
import com.rohitawate.everest.logging.LoggingService;
import com.rohitawate.everest.misc.ThemeManager;
import javafx.beans.binding.Bindings;
import javafx.beans.property.IntegerProperty;
@ -102,7 +102,7 @@ public class URLTabController implements Initializable {
});
fieldsBox.getChildren().add(stringField);
} catch (IOException e) {
Services.loggingService.logSevere("Could not add string field.", e, LocalDateTime.now());
LoggingService.logSevere("Could not add string field.", e, LocalDateTime.now());
}
}

View file

@ -46,7 +46,7 @@ class Visualizer extends ScrollPane {
private void populate(TreeItem<HBox> rootItem, String rootName, JsonNode root) {
if (rootName.equals("root")) {
this.visualizer.setRoot(rootItem);
visualizer.setRoot(rootItem);
}
Label rootLabel = new Label(rootName);
@ -117,6 +117,6 @@ class Visualizer extends ScrollPane {
}
public void clear() {
this.visualizer.setRoot(null);
visualizer.setRoot(null);
}
}

View file

@ -17,6 +17,7 @@
package com.rohitawate.everest.controllers.search;
import com.jfoenix.controls.JFXButton;
import com.rohitawate.everest.logging.LoggingService;
import com.rohitawate.everest.misc.Services;
import javafx.application.Platform;
import javafx.concurrent.Task;
@ -116,12 +117,12 @@ public abstract class SearchablePaneController<T> implements Initializable {
for (T state : entries)
addHistoryItem(state);
} catch (InterruptedException | ExecutionException E) {
Services.loggingService.logSevere("Task thread interrupted while populating HistoryTab.", E,
LoggingService.logSevere("Task thread interrupted while populating HistoryTab.", E,
LocalDateTime.now());
}
});
entryLoader.setOnFailed(e -> Services.loggingService.logWarning("Failed to load history.",
entryLoader.setOnFailed(e -> LoggingService.logWarning("Failed to load history.",
(Exception) entryLoader.getException(), LocalDateTime.now()));
Services.singleExecutor.execute(entryLoader);
@ -149,7 +150,7 @@ public abstract class SearchablePaneController<T> implements Initializable {
return searchEntry.getSearchable();
} catch (IOException e) {
Services.loggingService.logSevere("Could not append HistoryItem to list.", e, LocalDateTime.now());
LoggingService.logSevere("Could not append HistoryItem to list.", e, LocalDateTime.now());
}
return null;

View file

@ -21,7 +21,7 @@ import com.rohitawate.everest.controllers.DashboardController.ResponseLayer;
import com.rohitawate.everest.controllers.DashboardController.ResponseTab;
import com.rohitawate.everest.exceptions.RedirectException;
import com.rohitawate.everest.exceptions.UnreliableResponseException;
import com.rohitawate.everest.misc.Services;
import com.rohitawate.everest.logging.LoggingService;
import com.rohitawate.everest.models.requests.EverestRequest;
import com.rohitawate.everest.models.responses.EverestResponse;
import com.rohitawate.everest.requestmanager.DataDispatchRequestManager;
@ -104,7 +104,7 @@ public class DashboardState {
this.visibleResponseLayer = ResponseLayer.ERROR;
Throwable throwable = requestManager.getException();
Exception exception = (Exception) throwable;
Services.loggingService.logWarning(this.composer.httpMethod + " request could not be processed.", exception, LocalDateTime.now());
LoggingService.logWarning(this.composer.httpMethod + " request could not be processed.", exception, LocalDateTime.now());
if (throwable.getClass() == UnreliableResponseException.class) {
UnreliableResponseException URE = (UnreliableResponseException) throwable;
@ -124,7 +124,7 @@ public class DashboardState {
requestManager.restart();
return;
} catch (MalformedURLException MURLE) {
Services.loggingService.logInfo("Invalid URL: " + this.composer.target, LocalDateTime.now());
LoggingService.logInfo("Invalid URL: " + this.composer.target, LocalDateTime.now());
}
} else {
errorTitle = "Oops... That's embarrassing!";

View file

@ -20,6 +20,7 @@ import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.rohitawate.everest.controllers.state.ComposerState;
import com.rohitawate.everest.controllers.state.FieldState;
import com.rohitawate.everest.logging.LoggingService;
import com.rohitawate.everest.misc.EverestUtilities;
import com.rohitawate.everest.misc.Services;
import com.rohitawate.everest.settings.Settings;
@ -50,7 +51,7 @@ public class HistoryManager {
initDatabase();
} catch (Exception E) {
Services.loggingService.logSevere("Exception while initializing HistoryManager.", E, LocalDateTime.now());
LoggingService.logSevere("Exception while initializing HistoryManager.", E, LocalDateTime.now());
} finally {
System.out.println("Connected to database.");
}
@ -89,7 +90,7 @@ public class HistoryManager {
statement.execute();
}
// Method is made synchronized to allow only one database transaction at a time.
// Method is synchronized to allow only one database transaction at a time.
/**
* Saves the request to the database if it is not identical to one made exactly before it.
@ -172,7 +173,7 @@ public class HistoryManager {
history.add(state);
}
} catch (SQLException e) {
Services.loggingService.logWarning("Database error.", e, LocalDateTime.now());
LoggingService.logWarning("Database error.", e, LocalDateTime.now());
}
return history;
}
@ -196,7 +197,7 @@ public class HistoryManager {
headers.add(new FieldState(key, value, checked));
}
} catch (SQLException e) {
Services.loggingService.logWarning("Database error.", e, LocalDateTime.now());
LoggingService.logWarning("Database error.", e, LocalDateTime.now());
}
return headers;
}
@ -229,7 +230,7 @@ public class HistoryManager {
tuples.add(new FieldState(key, value, checked));
}
} catch (SQLException e) {
Services.loggingService.logWarning("Database error.", e, LocalDateTime.now());
LoggingService.logWarning("Database error.", e, LocalDateTime.now());
}
return tuples;
@ -318,7 +319,7 @@ public class HistoryManager {
}
}
} catch (SQLException e) {
Services.loggingService.logWarning("Database error.", e, LocalDateTime.now());
LoggingService.logWarning("Database error.", e, LocalDateTime.now());
} catch (NullPointerException NPE) {
/*
NPE is thrown by containsKey indicating that the key is not present in the database thereby
@ -418,7 +419,7 @@ public class HistoryManager {
}
}
} catch (SQLException e) {
Services.loggingService.logWarning("Database error.", e, LocalDateTime.now());
LoggingService.logWarning("Database error.", e, LocalDateTime.now());
}
}
@ -436,7 +437,7 @@ public class HistoryManager {
statement.executeUpdate();
} catch (SQLException e) {
Services.loggingService.logWarning("Database error.", e, LocalDateTime.now());
LoggingService.logWarning("Database error.", e, LocalDateTime.now());
}
}
}

View file

@ -22,49 +22,49 @@ import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
public class LoggingService {
private Logger logger;
private DateTimeFormatter dateFormat;
private Log log;
private static final Logger logger;
private static final DateTimeFormatter dateFormat;
private static final Log log;
public LoggingService(Level writerLevel) {
this.log = new Log();
this.logger = new Logger(writerLevel);
this.dateFormat = DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm:ss");
static {
log = new Log();
logger = new Logger(Level.INFO);
dateFormat = DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm:ss");
}
public void logSevere(String message, Exception exception, LocalDateTime time) {
public static void logSevere(String message, Exception exception, LocalDateTime time) {
setValues(message, exception, time);
Services.singleExecutor.execute(severeLogger);
}
public void logWarning(String message, Exception exception, LocalDateTime time) {
public static void logWarning(String message, Exception exception, LocalDateTime time) {
setValues(message, exception, time);
Services.singleExecutor.execute(warningLogger);
}
public void logInfo(String message, LocalDateTime time) {
public static void logInfo(String message, LocalDateTime time) {
setValues(message, null, time);
Services.singleExecutor.execute(infoLogger);
}
private void setValues(String message, Exception exception, LocalDateTime time) {
this.log.message = message;
this.log.exception = exception;
this.log.time = dateFormat.format(time);
private static void setValues(String message, Exception exception, LocalDateTime time) {
log.message = message;
log.exception = exception;
log.time = dateFormat.format(time);
}
private Runnable severeLogger = () -> {
this.log.level = Level.SEVERE;
this.logger.log(this.log);
private static Runnable severeLogger = () -> {
log.level = Level.SEVERE;
logger.log(log);
};
private Runnable warningLogger = () -> {
this.log.level = Level.WARNING;
this.logger.log(log);
private static Runnable warningLogger = () -> {
log.level = Level.WARNING;
logger.log(log);
};
private Runnable infoLogger = () -> {
this.log.level = Level.INFO;
this.logger.log(log);
private static Runnable infoLogger = () -> {
log.level = Level.INFO;
logger.log(log);
};
}

View file

@ -19,28 +19,16 @@ package com.rohitawate.everest.misc;
import com.google.common.util.concurrent.MoreExecutors;
import com.rohitawate.everest.controllers.HomeWindowController;
import com.rohitawate.everest.history.HistoryManager;
import com.rohitawate.everest.logging.Level;
import com.rohitawate.everest.logging.LoggingService;
import com.rohitawate.everest.requestmanager.RequestManagersPool;
import java.util.concurrent.Executor;
public class Services {
public static Thread startServicesThread;
public static HistoryManager historyManager;
public static LoggingService loggingService;
public static HomeWindowController homeWindowController;
public static Executor singleExecutor;
public static RequestManagersPool pool;
public static void start() {
startServicesThread = new Thread(() -> {
loggingService = new LoggingService(Level.INFO);
historyManager = new HistoryManager();
singleExecutor = MoreExecutors.directExecutor();
pool = new RequestManagersPool();
});
startServicesThread.start();
static {
historyManager = new HistoryManager();
singleExecutor = MoreExecutors.directExecutor();
}
}

View file

@ -17,6 +17,7 @@
package com.rohitawate.everest.misc;
import com.rohitawate.everest.controllers.codearea.EverestCodeArea;
import com.rohitawate.everest.logging.LoggingService;
import com.rohitawate.everest.settings.Settings;
import javafx.scene.Parent;
@ -45,9 +46,9 @@ public class ThemeManager {
parent.getStylesheets().add(1, themePath);
}
Services.loggingService.logInfo("Theme changed to " + Settings.theme + ".", LocalDateTime.now());
LoggingService.logInfo("Theme changed to " + Settings.theme + ".", LocalDateTime.now());
} else {
Services.loggingService.logInfo(Settings.theme + ": No such theme file found.", LocalDateTime.now());
LoggingService.logInfo(Settings.theme + ": No such theme file found.", LocalDateTime.now());
}
}
}
@ -58,7 +59,7 @@ public class ThemeManager {
parent.getStylesheets().add(themeFile.toURI().toString());
parentNodes.add(parent);
} else {
Services.loggingService.logInfo(Settings.theme + ": No such theme file found.", LocalDateTime.now());
LoggingService.logInfo(Settings.theme + ": No such theme file found.", LocalDateTime.now());
}
}
}
@ -68,7 +69,7 @@ public class ThemeManager {
if (syntaxThemeFile.exists()) {
everestCodeArea.getStylesheets().add(syntaxThemeFile.toURI().toString());
} else {
Services.loggingService.logInfo(Settings.syntaxTheme + ": No such theme file found.", LocalDateTime.now());
LoggingService.logInfo(Settings.syntaxTheme + ": No such theme file found.", LocalDateTime.now());
}
}
}

View file

@ -33,20 +33,9 @@ import javax.ws.rs.client.Invocation.Builder;
import javax.ws.rs.core.Response;
public abstract class RequestManager extends Service<EverestResponse> {
private final Client client;
long initialTime;
long finalTime;
private static final Client client;
EverestRequest request;
EverestResponse response;
Builder requestBuilder;
RequestManager() {
this.client = initClient();
}
private Client initClient() {
Client client;
static {
client = ClientBuilder.newBuilder()
.register(MultiPartFeature.class)
.build();
@ -58,10 +47,15 @@ public abstract class RequestManager extends Service<EverestResponse> {
client.property(ClientProperties.CONNECT_TIMEOUT, Settings.connectionTimeOut);
if (Settings.connectionReadTimeOutEnable)
client.property(ClientProperties.READ_TIMEOUT, Settings.connectionReadTimeOut);
return client;
}
long initialTime;
long finalTime;
EverestRequest request;
EverestResponse response;
Builder requestBuilder;
public void setRequest(EverestRequest request) {
this.request = request;
this.requestBuilder = client.target(request.getTarget().toString()).request();

View file

@ -31,12 +31,12 @@ import java.util.ArrayList;
* returned to the caller. If all the managers in the pool are running,
* a new one is created, added to the pool, and returned.
*/
public class RequestManagersPool {
private ArrayList<GETRequestManager> getManagers;
private ArrayList<DataDispatchRequestManager> dataManagers;
private ArrayList<DELETERequestManager> deleteManagers;
public class RequestManagersFactory {
private static ArrayList<GETRequestManager> getManagers;
private static ArrayList<DataDispatchRequestManager> dataManagers;
private static ArrayList<DELETERequestManager> deleteManagers;
public GETRequestManager get() {
public static GETRequestManager get() {
if (getManagers == null)
getManagers = new ArrayList<>();
@ -53,7 +53,7 @@ public class RequestManagersPool {
return newManager;
}
public DataDispatchRequestManager data() {
public static DataDispatchRequestManager data() {
if (dataManagers == null)
dataManagers = new ArrayList<>();
@ -70,7 +70,7 @@ public class RequestManagersPool {
return newManager;
}
public DELETERequestManager delete() {
public static DELETERequestManager delete() {
if (deleteManagers == null)
deleteManagers = new ArrayList<>();

View file

@ -17,8 +17,8 @@
package com.rohitawate.everest.settings;
import com.fasterxml.jackson.databind.JsonNode;
import com.rohitawate.everest.logging.LoggingService;
import com.rohitawate.everest.misc.EverestUtilities;
import com.rohitawate.everest.misc.Services;
import java.io.File;
import java.io.IOException;
@ -60,7 +60,7 @@ public class SettingsLoader implements Runnable {
Settings.syntaxTheme = EverestUtilities.trimString(setStringSetting(Settings.syntaxTheme, "syntaxTheme"));
Settings.showHistoryRange = setIntegerSetting(Settings.showHistoryRange, "showHistoryRange");
} catch (IOException IOE) {
Services.loggingService.logInfo("Settings file not found. Using defaults.", LocalDateTime.now());
LoggingService.logInfo("Settings file not found. Using defaults.", LocalDateTime.now());
}
}
@ -69,9 +69,9 @@ public class SettingsLoader implements Runnable {
if (value != null) {
defaultValue = value.toString();
Services.loggingService.logInfo("[" + identifier + "]: Loaded: " + defaultValue, LocalDateTime.now());
LoggingService.logInfo("[" + identifier + "]: Loaded: " + defaultValue, LocalDateTime.now());
} else {
Services.loggingService.logInfo("[" + identifier + "]: Not found. Using default value.", LocalDateTime.now());
LoggingService.logInfo("[" + identifier + "]: Not found. Using default value.", LocalDateTime.now());
}
return defaultValue;
@ -82,9 +82,9 @@ public class SettingsLoader implements Runnable {
if (value != null) {
defaultValue = value.asInt();
Services.loggingService.logInfo("[" + identifier + "]: Loaded: " + defaultValue, LocalDateTime.now());
LoggingService.logInfo("[" + identifier + "]: Loaded: " + defaultValue, LocalDateTime.now());
} else {
Services.loggingService.logInfo("[" + identifier + "]: Not found. Using default value.", LocalDateTime.now());
LoggingService.logInfo("[" + identifier + "]: Not found. Using default value.", LocalDateTime.now());
}
return defaultValue;
@ -95,9 +95,9 @@ public class SettingsLoader implements Runnable {
if (value != null) {
defaultValue = value.asBoolean();
Services.loggingService.logInfo("[" + identifier + "]: Loaded: " + defaultValue, LocalDateTime.now());
LoggingService.logInfo("[" + identifier + "]: Loaded: " + defaultValue, LocalDateTime.now());
} else {
Services.loggingService.logInfo("[" + identifier + "]: Not found. Using default value.", LocalDateTime.now());
LoggingService.logInfo("[" + identifier + "]: Not found. Using default value.", LocalDateTime.now());
}
return defaultValue;

View file

@ -322,13 +322,13 @@
}
.visualizerRootLabel {
-fx-font-size: 17px;
-fx-font-size: 16px;
-fx-text-fill: #dedede;
-fx-font-weight: bold;
}
.visualizerKeyLabel {
-fx-font-size: 17px;
-fx-font-size: 16px;
-fx-text-fill: #bababa;
-fx-font-weight: bold;
}
@ -363,7 +363,7 @@
.tree-cell:selected,
.tree-cell:focused {
-fx-background-color: cornflowerblue;
-fx-background-color: darkred;
}
.tree-cell:selected .label {