How swiftbytegbr/gmc-daemon works
Main Components
• • Application Entry Point: Represented by the Application.java class. This will be the starting block for initializing the daemon.
• • Command Processing: The “commands” package (e.g. BackupManagementCommands, DaemonManagementCommand, JoinTeamCommand, ServerManagementCommands) handles various control inputs.
• • Node & Server Management: The Node.java class, along with the “server” package (e.g. AsaServer, GameServer), encapsulates functionality related to managing dedicated nodes and game servers.
• • Caching: The “cache” package (CacheModel and GameServerCacheModel) indicates a layer used for temporarily storing state or configuration information to increase responsiveness.
• • Configuration: The “config” package (with classes like GmcPromptProvider) handles how configuration is provided and managed within the daemon.
• • Service Layer: Services like BackupService and FirewallService implement core business logic required for operations such as auto-backup, firewall management, etc.
• • STOMP Messaging: The “stomp” package and its sub-packages (including StompHandler, StompPacketConsumer, and various consumers for backend, node, and server events) manage inter-component communication using the STOMP protocol. This is key since it facilitates the interaction between the daemon and external systems (e.g., the GMC WebPanel) or other nodes.
• • Utilities: The “utils” package supports common operations (e.g., configuration, connection state, node/server utilities) to ease the operation across components.
Relationships and Interactions
• A “Command Dispatcher” component that routes commands from both local input and remote calls (via the WebPanel) to appropriate command handlers.
• How commands interact with the “Service Layer” to perform operations like backups, firewall changes, or server state modifications.
• Caching layer working as a mediator between the commands/services and the server/node state.
• STOMP messaging subsystem:
• External integration points such as the GMC WebPanel (from the README) that communicates with the daemon, likely through the STOMP messaging layer or API endpoints (although the direct web layer is separate, it is integral for management).
Architectural Patterns and Principles
• The design leans towards modularization where responsibilities are clearly defined (command handling, service operations, messaging, and caching).
• There’s a separation of concerns: the command layer handles user inputs; the service layer processes business logic; the messaging subsystem handles communication; and the configuration/cache layers manage state and operational parameters.
• The use of STOMP indicates a messaging or event-driven pattern which is essential for asynchronous communication between distributed components (nodes, servers, and the backend).
Relevant Technologies, Frameworks, and Tools
• Java with Maven as the build system (indicated by pom.xml, mvnw, mvnw.cmd).
• STOMP protocol as seen in the messaging package.
• Potential integration with external services like the GMC WebPanel. Although the panel is hosted independently, its communication with the daemon is critical.
• Dependency management via GitHub workflows (.github directory) ensures integration and deployment practices are in place.