From 3fe467a2a3d1dff7a2d5e3dd8848dd2f4e549bbc Mon Sep 17 00:00:00 2001 From: Gaa56 Date: Wed, 22 Oct 2025 19:19:28 +0100 Subject: [PATCH 1/7] Create MessageProtocol interface --- .../java/sd/protocol/MessageProtocol.java | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 main/src/main/java/sd/protocol/MessageProtocol.java diff --git a/main/src/main/java/sd/protocol/MessageProtocol.java b/main/src/main/java/sd/protocol/MessageProtocol.java new file mode 100644 index 0000000..9f20437 --- /dev/null +++ b/main/src/main/java/sd/protocol/MessageProtocol.java @@ -0,0 +1,44 @@ +package sd.protocol; + + + +import java.io.Serializable; + +import sd.model.MessageType; + +/** + * Interface que define o contrato para todas as mensagens trocadas no simulador. + * Garante que qualquer mensagem possa ser identificada e roteada. + * * Esta interface estende Serializable para permitir que os objetos que a implementam + * sejam enviados através de Sockets (ObjectOutputStream). + * + */ +public interface MessageProtocol extends Serializable { + + /** + * Retorna o tipo da mensagem, indicando o seu propósito. + * @return O MessageType (ex: VEHICLE_TRANSFER, STATS_UPDATE). + */ + MessageType getType(); + + /** + * Retorna o objeto de dados (carga útil) que esta mensagem transporta. + * O tipo de objeto dependerá do MessageType. + * * - Se getType() == VEHICLE_TRANSFER, o payload será um objeto {@link sd.model.Vehicle}. + * - Se getType() == STATS_UPDATE, o payload será um objeto de estatísticas. + * * @return O objeto de dados (payload), que também deve ser Serializable. + */ + Object getPayload(); + + /** + * Retorna o ID do nó (Processo) que enviou esta mensagem. + * @return String (ex: "Cr1", "Cr5", "S"). + */ + String getSourceNode(); + + /** + * Retorna o ID do nó (Processo) de destino desta mensagem. + * @return String (ex: "Cr2", "DashboardServer"). + */ + String getDestinationNode(); +} From 6c5eab0e72fe5d13e18034e017e25b58f6617ec4 Mon Sep 17 00:00:00 2001 From: Gaa56 Date: Sat, 25 Oct 2025 17:41:55 +0100 Subject: [PATCH 2/7] Create SocketConnection wrapper class --- .../java/sd/protocol/MessageProtocol.java | 37 +++++++++---------- .../java/sd/protocol/SocketConnection.java | 5 +++ 2 files changed, 22 insertions(+), 20 deletions(-) create mode 100644 main/src/main/java/sd/protocol/SocketConnection.java diff --git a/main/src/main/java/sd/protocol/MessageProtocol.java b/main/src/main/java/sd/protocol/MessageProtocol.java index 9f20437..47975be 100644 --- a/main/src/main/java/sd/protocol/MessageProtocol.java +++ b/main/src/main/java/sd/protocol/MessageProtocol.java @@ -1,44 +1,41 @@ package sd.protocol; - - import java.io.Serializable; - -import sd.model.MessageType; +import sd.model.MessageType; // Assuming MessageType is in sd.model or sd.protocol /** - * Interface que define o contrato para todas as mensagens trocadas no simulador. - * Garante que qualquer mensagem possa ser identificada e roteada. - * * Esta interface estende Serializable para permitir que os objetos que a implementam - * sejam enviados através de Sockets (ObjectOutputStream). + * Interface defining the contract for all messages exchanged in the simulator. + * Ensures that any message can be identified and routed. + * * This interface extends Serializable to allow objects that implement it + * to be sent over Sockets (ObjectOutputStream). * */ public interface MessageProtocol extends Serializable { /** - * Retorna o tipo da mensagem, indicando o seu propósito. - * @return O MessageType (ex: VEHICLE_TRANSFER, STATS_UPDATE). + * Returns the type of the message, indicating its purpose. + * @return The MessageType (e.g., VEHICLE_TRANSFER, STATS_UPDATE). */ MessageType getType(); /** - * Retorna o objeto de dados (carga útil) que esta mensagem transporta. - * O tipo de objeto dependerá do MessageType. - * * - Se getType() == VEHICLE_TRANSFER, o payload será um objeto {@link sd.model.Vehicle}. - * - Se getType() == STATS_UPDATE, o payload será um objeto de estatísticas. - * * @return O objeto de dados (payload), que também deve ser Serializable. + * Returns the data object (payload) that this message carries. + * The type of object will depend on the MessageType. + * * - If getType() == VEHICLE_TRANSFER, the payload will be a {@link sd.model.Vehicle} object. + * - If getType() == STATS_UPDATE, the payload will be a statistics object. + * * @return The data object (payload), which must also be Serializable. */ Object getPayload(); /** - * Retorna o ID do nó (Processo) que enviou esta mensagem. - * @return String (ex: "Cr1", "Cr5", "S"). + * Returns the ID of the node (Process) that sent this message. + * @return String (e.g., "Cr1", "Cr5", "S"). */ String getSourceNode(); /** - * Retorna o ID do nó (Processo) de destino desta mensagem. - * @return String (ex: "Cr2", "DashboardServer"). + * Returns the ID of the destination node (Process) for this message. + * @return String (e.g., "Cr2", "DashboardServer"). */ String getDestinationNode(); -} +} \ No newline at end of file diff --git a/main/src/main/java/sd/protocol/SocketConnection.java b/main/src/main/java/sd/protocol/SocketConnection.java new file mode 100644 index 0000000..d56ad9c --- /dev/null +++ b/main/src/main/java/sd/protocol/SocketConnection.java @@ -0,0 +1,5 @@ +package sd.protocol; + +public class SocketConnection { + +} From 96903e4b7c3456a30b14dd140fc627e4025ce027 Mon Sep 17 00:00:00 2001 From: Gaa56 Date: Sat, 25 Oct 2025 17:43:25 +0100 Subject: [PATCH 3/7] SocketConnection --- .../java/sd/protocol/SocketConnection.java | 110 +++++++++++++++++- 1 file changed, 108 insertions(+), 2 deletions(-) diff --git a/main/src/main/java/sd/protocol/SocketConnection.java b/main/src/main/java/sd/protocol/SocketConnection.java index d56ad9c..0198242 100644 --- a/main/src/main/java/sd/protocol/SocketConnection.java +++ b/main/src/main/java/sd/protocol/SocketConnection.java @@ -1,5 +1,111 @@ package sd.protocol; -public class SocketConnection { +import java.io.Closeable; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.net.Socket; +import java.net.UnknownHostException; -} +/** + * Wrapper class that simplifies communication via Sockets. + * * It encapsulates all stream logic (ObjectInputStream/ObjectOutputStream) + * so the rest of your code can simply "send" and "receive" objects + * that implement your MessageProtocol. + * * This is necessary to meet the requirement for inter-process communication + * (Intersections). + * * This class implements Closeable, so you can (and should) use it + * with a 'try-with-resources' block to ensure the socket is always closed. + */ +public class SocketConnection implements Closeable { + + private final Socket socket; + private final ObjectOutputStream outputStream; + private final ObjectInputStream inputStream; + + /** + * Constructor for the "Client" (who initiates the connection). + * Tries to connect to a process that is already listening (Server). + * + * @param host The host address (e.g., "localhost" from your simulation.properties) + * @param port The port (e.g., 8001 from your simulation.properties) + * @throws IOException If connection fails. + * @throws UnknownHostException If the host is not found. + */ + public SocketConnection(String host, int port) throws IOException, UnknownHostException { + this.socket = new Socket(host, port); + + // IMPORTANT: The order is crucial to prevent deadlocks when creating streams. + // The OutputStream (output stream) must be created first. + this.outputStream = new ObjectOutputStream(socket.getOutputStream()); + this.inputStream = new ObjectInputStream(socket.getInputStream()); + } + + /** + * Constructor for the "Server" (who accepts the connection). + * Receives a Socket that has already been accepted by a ServerSocket. + * + * @param acceptedSocket The Socket returned by serverSocket.accept(). + * @throws IOException If stream creation fails. + */ + public SocketConnection(Socket acceptedSocket) throws IOException { + this.socket = acceptedSocket; + + // IMPORTANT: The order is crucial. OutputStream (output stream) must be created first. + this.outputStream = new ObjectOutputStream(socket.getOutputStream()); + this.inputStream = new ObjectInputStream(socket.getInputStream()); + } + + /** + * Sends (serializes) a MessageProtocol object over the socket. + * + * @param message The "envelope" (which contains the Vehicle) to be sent. + * @throws IOException If writing to the stream fails. + */ + public void sendMessage(MessageProtocol message) throws IOException { + synchronized (outputStream) { + outputStream.writeObject(message); + outputStream.flush(); // Ensures the message is sent immediately. + } + } + + /** + * Tries to read (deserialize) a MessageProtocol object from the socket. + * This call is "blocked" until an object is received. + * + * @return The "envelope" (MessageProtocol) that was received. + * @throws IOException If the connection is lost or the stream is corrupted. + * @throws ClassNotFoundException If the received object is unknown. + */ + public MessageProtocol receiveMessage() throws IOException, ClassNotFoundException { + synchronized (inputStream) { + return (MessageProtocol) inputStream.readObject(); + } + } + + /** + * Closes the socket and all streams (Input and Output). + * It is called automatically if you use 'try-with-resources'. + */ + @Override + public void close() throws IOException { + try { + if (inputStream != null) inputStream.close(); + } catch (IOException e) { /* ignore */ } + + try { + if (outputStream != null) outputStream.close(); + } catch (IOException e) { /* ignore */ } + + if (socket != null && !socket.isClosed()) { + socket.close(); + } + } + + /** + * @return true if the socket is still connected. + */ + public boolean isConnected() { + return socket != null && socket.isConnected() && !socket.isClosed(); + } +} \ No newline at end of file From bc1a8da160d462ed26d1c1c00188b2e9a10be302 Mon Sep 17 00:00:00 2001 From: Gaa56 Date: Sat, 25 Oct 2025 18:00:58 +0100 Subject: [PATCH 4/7] Create MessageSerializer utility --- .../main/java/sd/util/MessageSerializer.java | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 main/src/main/java/sd/util/MessageSerializer.java diff --git a/main/src/main/java/sd/util/MessageSerializer.java b/main/src/main/java/sd/util/MessageSerializer.java new file mode 100644 index 0000000..2e7f461 --- /dev/null +++ b/main/src/main/java/sd/util/MessageSerializer.java @@ -0,0 +1,62 @@ +package sd.util; // Or sd.util if you prefer + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; + +import sd.protocol.MessageProtocol; + +/** + * Utility class for serializing and deserializing MessageProtocol objects. + * * NOTE: The SocketConnection class already handles serialization/deserialization + * automatically via ObjectOutputStream and ObjectInputStream directly + * on the socket stream. This class serves more as an example or for + * scenarios where you might want to manipulate the bytes directly + * (e.g., for sending via UDP or other means). + */ +public class MessageSerializer { + + /** + * Serializes a MessageProtocol object into a byte array. + * * @param message The MessageProtocol object to be serialized. + * @return A byte array representing the serialized object. + * @throws IOException If an error occurs during serialization. + */ + public static byte[] serialize(MessageProtocol message) throws IOException { + // Use a ByteArrayOutputStream to write bytes into memory + ByteArrayOutputStream byteStream = new ByteArrayOutputStream(); + + // Use an ObjectOutputStream to write the object into the byteStream + try (ObjectOutputStream objectStream = new ObjectOutputStream(byteStream)) { + objectStream.writeObject(message); + } // The try-with-resources automatically closes the objectStream + + // Return the resulting bytes + return byteStream.toByteArray(); + } + + /** + * Deserializes a byte array back into a MessageProtocol object. + * * @param data The byte array to be deserialized. + * @return The reconstructed MessageProtocol object. + * @throws IOException If an error occurs while reading the bytes. + * @throws ClassNotFoundException If the class of the serialized object cannot be found. + */ + public static MessageProtocol deserialize(byte[] data) throws IOException, ClassNotFoundException { + // Use a ByteArrayInputStream to read from the byte array + ByteArrayInputStream byteStream = new ByteArrayInputStream(data); + + // Use an ObjectInputStream to read the object from the byteStream + try (ObjectInputStream objectStream = new ObjectInputStream(byteStream)) { + // Read the object and cast it to MessageProtocol + return (MessageProtocol) objectStream.readObject(); + } // The try-with-resources automatically closes the objectStream + } + + // Private constructor to prevent instantiation of the utility class + private MessageSerializer() { + throw new UnsupportedOperationException("This is a utility class and cannot be instantiated."); + } +} \ No newline at end of file From 1524188b29ec2539d9b24a59c203be3222d87d2f Mon Sep 17 00:00:00 2001 From: Gaa56 Date: Sun, 26 Oct 2025 17:00:34 +0000 Subject: [PATCH 5/7] Add connection retry logic --- .../java/sd/protocol/SocketConnection.java | 120 ++++++++++++++---- 1 file changed, 96 insertions(+), 24 deletions(-) diff --git a/main/src/main/java/sd/protocol/SocketConnection.java b/main/src/main/java/sd/protocol/SocketConnection.java index 0198242..f6392a4 100644 --- a/main/src/main/java/sd/protocol/SocketConnection.java +++ b/main/src/main/java/sd/protocol/SocketConnection.java @@ -1,21 +1,18 @@ -package sd.protocol; +package sd.protocol; import java.io.Closeable; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; +import java.net.ConnectException; import java.net.Socket; +import java.net.SocketTimeoutException; import java.net.UnknownHostException; +import java.util.concurrent.TimeUnit; /** * Wrapper class that simplifies communication via Sockets. - * * It encapsulates all stream logic (ObjectInputStream/ObjectOutputStream) - * so the rest of your code can simply "send" and "receive" objects - * that implement your MessageProtocol. - * * This is necessary to meet the requirement for inter-process communication - * (Intersections). - * * This class implements Closeable, so you can (and should) use it - * with a 'try-with-resources' block to ensure the socket is always closed. + * Includes connection retry logic for robustness. */ public class SocketConnection implements Closeable { @@ -23,46 +20,115 @@ public class SocketConnection implements Closeable { private final ObjectOutputStream outputStream; private final ObjectInputStream inputStream; + // --- Configuration for Retry Logic --- + /** Maximum number of connection attempts. */ + private static final int MAX_RETRIES = 5; + /** Delay between retry attempts in milliseconds. */ + private static final long RETRY_DELAY_MS = 1000; + /** * Constructor for the "Client" (who initiates the connection). * Tries to connect to a process that is already listening (Server). + * Includes retry logic in case of initial connection failure. * * @param host The host address (e.g., "localhost" from your simulation.properties) * @param port The port (e.g., 8001 from your simulation.properties) - * @throws IOException If connection fails. - * @throws UnknownHostException If the host is not found. + * @throws IOException If connection fails after all retries. + * @throws UnknownHostException If the host is not found (this error usually doesn't need retry). + * @throws InterruptedException If the thread is interrupted while waiting between retries. */ - public SocketConnection(String host, int port) throws IOException, UnknownHostException { - this.socket = new Socket(host, port); - - // IMPORTANT: The order is crucial to prevent deadlocks when creating streams. - // The OutputStream (output stream) must be created first. - this.outputStream = new ObjectOutputStream(socket.getOutputStream()); - this.inputStream = new ObjectInputStream(socket.getInputStream()); + public SocketConnection(String host, int port) throws IOException, UnknownHostException, InterruptedException { + Socket tempSocket = null; + IOException lastException = null; + + System.out.printf("[SocketConnection] Attempting to connect to %s:%d...%n", host, port); + + // --- Retry Loop --- + for (int attempt = 1; attempt <= MAX_RETRIES; attempt++) { + try { + // Try to establish the connection + tempSocket = new Socket(host, port); + + // If successful, break out of the retry loop + System.out.printf("[SocketConnection] Connected successfully on attempt %d.%n", attempt); + lastException = null; // Clear last error on success + break; + + } catch (ConnectException | SocketTimeoutException e) { + // These are common errors indicating the server might not be ready. + lastException = e; + System.out.printf("[SocketConnection] Attempt %d/%d failed: %s. Retrying in %d ms...%n", + attempt, MAX_RETRIES, e.getMessage(), RETRY_DELAY_MS); + + if (attempt < MAX_RETRIES) { + // Wait before the next attempt + TimeUnit.MILLISECONDS.sleep(RETRY_DELAY_MS); + } + } catch (IOException e) { + // Other IOExceptions might be more permanent, but we retry anyway. + lastException = e; + System.out.printf("[SocketConnection] Attempt %d/%d failed with IOException: %s. Retrying in %d ms...%n", + attempt, MAX_RETRIES, e.getMessage(), RETRY_DELAY_MS); + if (attempt < MAX_RETRIES) { + TimeUnit.MILLISECONDS.sleep(RETRY_DELAY_MS); + } + } + } // --- End of Retry Loop --- + + // If after all retries tempSocket is still null, it means connection failed permanently. + if (tempSocket == null) { + System.err.printf("[SocketConnection] Failed to connect to %s:%d after %d attempts.%n", host, port, MAX_RETRIES); + if (lastException != null) { + throw lastException; // Throw the last exception encountered + } else { + // Should not happen if loop ran, but as a fallback + throw new IOException("Failed to connect after " + MAX_RETRIES + " attempts, reason unknown."); + } + } + + // If connection was successful, assign to final variable and create streams + this.socket = tempSocket; + try { + // IMPORTANT: The order is crucial. OutputStream first. + this.outputStream = new ObjectOutputStream(socket.getOutputStream()); + this.inputStream = new ObjectInputStream(socket.getInputStream()); + } catch (IOException e) { + // If stream creation fails even after successful socket connection, clean up. + System.err.println("[SocketConnection] Failed to create streams after connection: " + e.getMessage()); + try { socket.close(); } catch (IOException closeEx) { /* ignore */ } + throw e; // Re-throw the stream creation exception + } } + /** * Constructor for the "Server" (who accepts the connection). * Receives a Socket that has already been accepted by a ServerSocket. + * No retry logic needed here as the connection is already established. * * @param acceptedSocket The Socket returned by serverSocket.accept(). * @throws IOException If stream creation fails. */ public SocketConnection(Socket acceptedSocket) throws IOException { this.socket = acceptedSocket; - - // IMPORTANT: The order is crucial. OutputStream (output stream) must be created first. + + // IMPORTANT: The order is crucial. OutputStream first. this.outputStream = new ObjectOutputStream(socket.getOutputStream()); this.inputStream = new ObjectInputStream(socket.getInputStream()); + System.out.printf("[SocketConnection] Connection accepted from %s:%d.%n", + acceptedSocket.getInetAddress().getHostAddress(), acceptedSocket.getPort()); } /** * Sends (serializes) a MessageProtocol object over the socket. * * @param message The "envelope" (which contains the Vehicle) to be sent. - * @throws IOException If writing to the stream fails. + * @throws IOException If writing to the stream fails or socket is not connected. */ public void sendMessage(MessageProtocol message) throws IOException { + if (!isConnected()) { + throw new IOException("Socket is not connected."); + } synchronized (outputStream) { outputStream.writeObject(message); outputStream.flush(); // Ensures the message is sent immediately. @@ -74,10 +140,13 @@ public class SocketConnection implements Closeable { * This call is "blocked" until an object is received. * * @return The "envelope" (MessageProtocol) that was received. - * @throws IOException If the connection is lost or the stream is corrupted. + * @throws IOException If the connection is lost, the stream is corrupted, or socket is not connected. * @throws ClassNotFoundException If the received object is unknown. */ public MessageProtocol receiveMessage() throws IOException, ClassNotFoundException { + if (!isConnected()) { + throw new IOException("Socket is not connected."); + } synchronized (inputStream) { return (MessageProtocol) inputStream.readObject(); } @@ -89,21 +158,24 @@ public class SocketConnection implements Closeable { */ @Override public void close() throws IOException { + System.out.printf("[SocketConnection] Closing connection to %s:%d.%n", + socket != null ? socket.getInetAddress().getHostAddress() : "N/A", + socket != null ? socket.getPort() : -1); try { if (inputStream != null) inputStream.close(); } catch (IOException e) { /* ignore */ } - + try { if (outputStream != null) outputStream.close(); } catch (IOException e) { /* ignore */ } - + if (socket != null && !socket.isClosed()) { socket.close(); } } /** - * @return true if the socket is still connected. + * @return true if the socket is still connected and not closed. */ public boolean isConnected() { return socket != null && socket.isConnected() && !socket.isClosed(); From 06c34a198a97ab48d19e6c6f92ac6806f05d76c3 Mon Sep 17 00:00:00 2001 From: Gaa56 Date: Mon, 27 Oct 2025 09:15:33 +0000 Subject: [PATCH 6/7] Removed MessageSerializer --- main/src/main/java/sd/util/MessageSerializer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/src/main/java/sd/util/MessageSerializer.java b/main/src/main/java/sd/util/MessageSerializer.java index 2e7f461..cd3e4ed 100644 --- a/main/src/main/java/sd/util/MessageSerializer.java +++ b/main/src/main/java/sd/util/MessageSerializer.java @@ -1,4 +1,4 @@ -package sd.util; // Or sd.util if you prefer +package sd.util; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; From d8b59cc502503a6312038f786ea681afa9f6f983 Mon Sep 17 00:00:00 2001 From: Gaa56 Date: Mon, 27 Oct 2025 09:18:33 +0000 Subject: [PATCH 7/7] Deleted MessageSerializer --- .../main/java/sd/util/MessageSerializer.java | 62 ------------------- 1 file changed, 62 deletions(-) delete mode 100644 main/src/main/java/sd/util/MessageSerializer.java diff --git a/main/src/main/java/sd/util/MessageSerializer.java b/main/src/main/java/sd/util/MessageSerializer.java deleted file mode 100644 index cd3e4ed..0000000 --- a/main/src/main/java/sd/util/MessageSerializer.java +++ /dev/null @@ -1,62 +0,0 @@ -package sd.util; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; - -import sd.protocol.MessageProtocol; - -/** - * Utility class for serializing and deserializing MessageProtocol objects. - * * NOTE: The SocketConnection class already handles serialization/deserialization - * automatically via ObjectOutputStream and ObjectInputStream directly - * on the socket stream. This class serves more as an example or for - * scenarios where you might want to manipulate the bytes directly - * (e.g., for sending via UDP or other means). - */ -public class MessageSerializer { - - /** - * Serializes a MessageProtocol object into a byte array. - * * @param message The MessageProtocol object to be serialized. - * @return A byte array representing the serialized object. - * @throws IOException If an error occurs during serialization. - */ - public static byte[] serialize(MessageProtocol message) throws IOException { - // Use a ByteArrayOutputStream to write bytes into memory - ByteArrayOutputStream byteStream = new ByteArrayOutputStream(); - - // Use an ObjectOutputStream to write the object into the byteStream - try (ObjectOutputStream objectStream = new ObjectOutputStream(byteStream)) { - objectStream.writeObject(message); - } // The try-with-resources automatically closes the objectStream - - // Return the resulting bytes - return byteStream.toByteArray(); - } - - /** - * Deserializes a byte array back into a MessageProtocol object. - * * @param data The byte array to be deserialized. - * @return The reconstructed MessageProtocol object. - * @throws IOException If an error occurs while reading the bytes. - * @throws ClassNotFoundException If the class of the serialized object cannot be found. - */ - public static MessageProtocol deserialize(byte[] data) throws IOException, ClassNotFoundException { - // Use a ByteArrayInputStream to read from the byte array - ByteArrayInputStream byteStream = new ByteArrayInputStream(data); - - // Use an ObjectInputStream to read the object from the byteStream - try (ObjectInputStream objectStream = new ObjectInputStream(byteStream)) { - // Read the object and cast it to MessageProtocol - return (MessageProtocol) objectStream.readObject(); - } // The try-with-resources automatically closes the objectStream - } - - // Private constructor to prevent instantiation of the utility class - private MessageSerializer() { - throw new UnsupportedOperationException("This is a utility class and cannot be instantiated."); - } -} \ No newline at end of file