diff --git a/src/main/java/com/rohitawate/everest/Main.java b/src/main/java/com/rohitawate/everest/Main.java index 8624ce2..a58a16e 100644 --- a/src/main/java/com/rohitawate/everest/Main.java +++ b/src/main/java/com/rohitawate/everest/Main.java @@ -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(); diff --git a/src/main/java/com/rohitawate/everest/controllers/BodyTabController.java b/src/main/java/com/rohitawate/everest/controllers/BodyTabController.java index 23cdd9e..65c7d47 100644 --- a/src/main/java/com/rohitawate/everest/controllers/BodyTabController.java +++ b/src/main/java/com/rohitawate/everest/controllers/BodyTabController.java @@ -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()); } } diff --git a/src/main/java/com/rohitawate/everest/controllers/DashboardController.java b/src/main/java/com/rohitawate/everest/controllers/DashboardController.java index 7e83be0..2617f76 100644 --- a/src/main/java/com/rohitawate/everest/controllers/DashboardController.java +++ b/src/main/java/com/rohitawate/everest/controllers/DashboardController.java @@ -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; } diff --git a/src/main/java/com/rohitawate/everest/controllers/FormDataTabController.java b/src/main/java/com/rohitawate/everest/controllers/FormDataTabController.java index de9256b..0832171 100644 --- a/src/main/java/com/rohitawate/everest/controllers/FormDataTabController.java +++ b/src/main/java/com/rohitawate/everest/controllers/FormDataTabController.java @@ -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()); } } diff --git a/src/main/java/com/rohitawate/everest/controllers/HeaderTabController.java b/src/main/java/com/rohitawate/everest/controllers/HeaderTabController.java index 6c604f3..c6bff2c 100644 --- a/src/main/java/com/rohitawate/everest/controllers/HeaderTabController.java +++ b/src/main/java/com/rohitawate/everest/controllers/HeaderTabController.java @@ -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()); } } diff --git a/src/main/java/com/rohitawate/everest/controllers/HistoryItemController.java b/src/main/java/com/rohitawate/everest/controllers/HistoryItemController.java index d5c737b..c58f53d 100644 --- a/src/main/java/com/rohitawate/everest/controllers/HistoryItemController.java +++ b/src/main/java/com/rohitawate/everest/controllers/HistoryItemController.java @@ -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 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); } } diff --git a/src/main/java/com/rohitawate/everest/controllers/search/SearchablePaneController.java b/src/main/java/com/rohitawate/everest/controllers/search/SearchablePaneController.java index 4081999..2e2bfbb 100644 --- a/src/main/java/com/rohitawate/everest/controllers/search/SearchablePaneController.java +++ b/src/main/java/com/rohitawate/everest/controllers/search/SearchablePaneController.java @@ -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 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 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; diff --git a/src/main/java/com/rohitawate/everest/controllers/state/DashboardState.java b/src/main/java/com/rohitawate/everest/controllers/state/DashboardState.java index 4ba1674..bc72fb1 100644 --- a/src/main/java/com/rohitawate/everest/controllers/state/DashboardState.java +++ b/src/main/java/com/rohitawate/everest/controllers/state/DashboardState.java @@ -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!"; diff --git a/src/main/java/com/rohitawate/everest/history/HistoryManager.java b/src/main/java/com/rohitawate/everest/history/HistoryManager.java index 6c0a610..5fd0624 100644 --- a/src/main/java/com/rohitawate/everest/history/HistoryManager.java +++ b/src/main/java/com/rohitawate/everest/history/HistoryManager.java @@ -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()); } } } diff --git a/src/main/java/com/rohitawate/everest/logging/LoggingService.java b/src/main/java/com/rohitawate/everest/logging/LoggingService.java index 707fc03..360c728 100644 --- a/src/main/java/com/rohitawate/everest/logging/LoggingService.java +++ b/src/main/java/com/rohitawate/everest/logging/LoggingService.java @@ -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); }; } diff --git a/src/main/java/com/rohitawate/everest/misc/Services.java b/src/main/java/com/rohitawate/everest/misc/Services.java index 1455db0..32f0bc4 100644 --- a/src/main/java/com/rohitawate/everest/misc/Services.java +++ b/src/main/java/com/rohitawate/everest/misc/Services.java @@ -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(); } } diff --git a/src/main/java/com/rohitawate/everest/misc/ThemeManager.java b/src/main/java/com/rohitawate/everest/misc/ThemeManager.java index eb0475c..b604765 100644 --- a/src/main/java/com/rohitawate/everest/misc/ThemeManager.java +++ b/src/main/java/com/rohitawate/everest/misc/ThemeManager.java @@ -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()); } } } diff --git a/src/main/java/com/rohitawate/everest/requestmanager/RequestManager.java b/src/main/java/com/rohitawate/everest/requestmanager/RequestManager.java index 1abf333..01cf109 100644 --- a/src/main/java/com/rohitawate/everest/requestmanager/RequestManager.java +++ b/src/main/java/com/rohitawate/everest/requestmanager/RequestManager.java @@ -33,20 +33,9 @@ import javax.ws.rs.client.Invocation.Builder; import javax.ws.rs.core.Response; public abstract class RequestManager extends Service { - 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 { 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(); diff --git a/src/main/java/com/rohitawate/everest/requestmanager/RequestManagersPool.java b/src/main/java/com/rohitawate/everest/requestmanager/RequestManagersFactory.java similarity index 86% rename from src/main/java/com/rohitawate/everest/requestmanager/RequestManagersPool.java rename to src/main/java/com/rohitawate/everest/requestmanager/RequestManagersFactory.java index e9d1204..d5fdade 100644 --- a/src/main/java/com/rohitawate/everest/requestmanager/RequestManagersPool.java +++ b/src/main/java/com/rohitawate/everest/requestmanager/RequestManagersFactory.java @@ -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 getManagers; - private ArrayList dataManagers; - private ArrayList deleteManagers; +public class RequestManagersFactory { + private static ArrayList getManagers; + private static ArrayList dataManagers; + private static ArrayList 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<>(); diff --git a/src/main/java/com/rohitawate/everest/settings/SettingsLoader.java b/src/main/java/com/rohitawate/everest/settings/SettingsLoader.java index 02ee4b7..329024d 100644 --- a/src/main/java/com/rohitawate/everest/settings/SettingsLoader.java +++ b/src/main/java/com/rohitawate/everest/settings/SettingsLoader.java @@ -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; diff --git a/src/main/resources/css/Adreana.css b/src/main/resources/css/Adreana.css index 4653930..7e2646d 100644 --- a/src/main/resources/css/Adreana.css +++ b/src/main/resources/css/Adreana.css @@ -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 {