Class ServerLauncher

java.lang.Object
net.vincent.communidirect.server.ServerLauncher

public class ServerLauncher extends Object
Application entry point and dependency-injection root for the CommuniDirect server.

The constructor wires all components together:

  1. SettingsManager loads (or creates) ~/.communidirect/config.toml.
  2. KeyStoreManager loads the local Ed25519 identity and trusted peer keys.
  3. ServerSocket, ClientHandler and AccessLog are instantiated and held as public fields so that sibling components can cross-reference them.
Call init() to complete binding and start accepting connections.
  • Field Details

    • serverSocket

      public ServerSocket serverSocket
      TCP server socket abstraction used by ClientHandler to accept connections.
    • clientHandler

      public ClientHandler clientHandler
      Handles per-connection decoding and message persistence.
    • accessLog

      public AccessLog accessLog
      Records inbound connection events to the configured access log file.
    • settings

      public SettingsManager settings
      Provides runtime configuration (port, IP, log paths).
    • keyStore

      public KeyStoreManager keyStore
      Holds the local Ed25519 identity and all trusted peer public keys.
  • Constructor Details

    • ServerLauncher

      public ServerLauncher()
      Constructs and wires all server components. Configuration and key loading happen synchronously during construction; any key-store failure is printed to stderr but does not abort startup.
  • Method Details

    • init

      public void init()
      Initialises all components and blocks on the accept loop.

      Execution order:

      1. Configures the access log file path from settings.
      2. Binds the server socket to the configured IP and port.
      3. Starts the blocking ClientHandler accept loop.
      This method does not return under normal operation.
    • main

      public static void main(String[] args)
      Application entry point. Constructs a ServerLauncher and calls init() which blocks indefinitely while accepting connections.
      Parameters:
      args - command-line arguments (currently unused)