How h-mdm/hmdm-server works
Principal Components
• Core Server Application: Represented by the “server” module—it contains the main entry point (HMDMApplication.java), the REST resource controllers (all the endpoints under /rest/resource and JSON models), the web app static files (AngularJS-based UI in server/src/main/webapp/app) and web.xml configuration.
• Common Library: The “common” module holds shared functionality including authentication (local and JWT hints in “auth”), event handling, persistence (DAO and mappers), utilities and Guice modules for dependency injection. This core library provides foundational services for all modules.
• Security & JWT Module: The “jwt” module clearly implements JWT-based security (with filters and token provider classes) so include this as a specialized security component that integrates with the core authentication in “common.”
• Notification Module: The “notification” module implements push and MQTT-based notifications (e.g., classes like MqttEnvelope, PushSender, and the corresponding Guice modules) which are used to trigger device notifications.
• REST API & Web UI: The REST API endpoints within “server” provide the interface for mobile apps and the web panel. Also highlight the front-end components (AngularJS controllers, views, and assets under webapp) that the administrators interact with.
• Installation & External Configuration: Represent supplementary components such as installation scripts, Liquibase configuration (across common, notification, plugins, and server directories), and external SQL scripts. The installer scripts (hmdm_install.sh, init-plugin.sh) and liquibase changelogs are key elements of deployment and configuration.
Relationships and Interactions
• The core “common” layer underpins all modules including authentication, event processing, data persistence, and utility services. All service and persistence modules in “server”, “jwt”, and “notification” (and those within plugins) are built on top of these common libraries.
• The JWT module is tightly coupled to the authentication flow, intercepting API requests via filters and providing tokens.
• The Notification module dispatches alerts and push messages, using MQTT and REST interfaces for delivery.
• The Plugin modules integrate with the core system to provide extended features (audit logs, device information, device logs, messaging, push notifications, etc.). They are dynamically loaded/configured using Guice modules and Liquibase migration scripts.
• Data persistence is managed by various DAO and Mapper classes that interact with a central database (which you may represent as a backend repository) via SQL configuration and connection pooling (configured in Liquibase modules).
Architectural Patterns and Design Principles
• Plugin and Extensibility: Highlight the plugin architecture (each plugin as an independent module that conforms to a common Plugin interface) that allows custom functionality to be added without modifying the core.
• RESTful API: Illustrate that the front-end and mobile apps communicate via standardized REST endpoints.
• Security Layer: Clearly mark out the security layer (JWT filtering, authentication) that protects the API endpoints.
• Data Persistence: Represent a dedicated data access layer (DAO and domain objects) that interacts with the underlying database.
Technologies, Frameworks, and External Services
• Java as the programming language with Maven for build management.
• Apache Tomcat (as implied by the “server” directory and web.xml configuration) for servlet container deployment.
• Guice is used for dependency injection.
• Liquibase for managing database changes via changelog files.
• Web technologies include AngularJS-based client-side components.
• MQTT (and possibly other push notification protocols) for handling device notifications.
• JWT for stateless security mechanisms.