Commit Graph
37 Commits
Author SHA1 Message Date
Gustavo Henrique Santos Souza de Miranda f70c1e1d94 Switch from EntityManager to EntityManagerFactory across repositories, managers, and services for improved resource management and thread safety. 2025-11-29 03:02:49 -03:00
Gustavo Henrique Santos Souza de Miranda 32fff9c725 Add null-safe ID handling in GenreMapper and fix minor logging format in IPCManager
- Ensure `GenreMapper` sets ID only if it's non-null and valid (> 0) to prevent potential NPEs.
- Adjust logging format in `IPCManager` for consistent indentation.
2025-11-29 02:50:07 -03:00
Gustavo Henrique Santos Souza de Miranda 7b61b2071e Implement Genre Management with CRUD Operations
- Add `Genre` entity with JPA annotations and database mapping.
- Create repository, service, and delegate handlers for Genre CRUD operations.
- Register handlers (`create_genre`, `get_genres`, `get_genre_by_id`, `update_genre`, `delete_genre`) in `DelegateActionManager`.
- Introduce Protobuf definitions for Genre messages.
- Update `DatabaseManager` to expose `EntityManager`.
- Enhance `DelegateActionManager` constructor to use `EntityManager` for handler initialization.
2025-11-28 23:33:27 -03:00
Gustavo Henrique Miranda ba53d4d8c4 Merge pull request #10 from gmbrax/refactor/add-hibernate-and-reflection-dependency
Remove `Media` entity and integrate Hibernate ORM into `DatabaseManager`:
2025-11-28 00:38:21 -03:00
Gustavo Henrique Santos Souza de Miranda 081a1f1ed4 Add exception handling for entity scanning in DatabaseManager
- Wrap entity scanning in a try-catch block to handle potential exceptions.
- Log descriptive error messages and throw a runtime exception for failure cases.
- Warn if no `@Entity` classes are found during the scan.
2025-11-27 19:20:22 -03:00
Gustavo Henrique Santos Souza de Miranda e395e21e8c Add validation for required Hibernate configuration properties in DatabaseManager
- Ensure non-null and non-empty values for `hibernate.dialect`, `database.driver`, and `connectionUrl`.
- Throw `IllegalStateException` when required properties are missing.
2025-11-27 19:08:11 -03:00
Gustavo Henrique Santos Souza de Miranda 412a590a98 Add exception handling for Hibernate initialization in DatabaseManager
- Wrap Hibernate setup in a try-catch block.
- Log errors during initialization failure with descriptive messages.
- Throw a runtime exception if setup fails to ensure proper error propagation.
2025-11-27 19:04:44 -03:00
Gustavo Henrique Santos Souza de Miranda bc0199312f Add null and open-state checks for EntityManager and EntityManagerFactory closure
- Ensure safe closure of `EntityManager` and `EntityManagerFactory`.
- Add logging for successful closure and error handling during exceptions.
2025-11-27 18:55:43 -03:00
Gustavo Henrique Santos Souza de Miranda 4ae1e3075d Remove Media entity and integrate Hibernate ORM into DatabaseManager:
- Deleted `Media` class and its annotations.
- Added Hibernate ORM initialization in `DatabaseManager`, including dynamic entity scanning and configuration.
- Updated `pom.xml` to include dependencies for Hibernate community dialects and Reflections.
2025-11-27 18:40:08 -03:00
Gustavo Henrique Miranda fc09c4e257 Merge pull request #9 from gmbrax/fix/fix-unsecure-postgres-version
Fix the pom.xml
2025-11-24 22:19:31 -03:00
Gustavo Henrique Santos Souza de Miranda 53004a3730 Fix the pom.xml to alter the postgres dependency to a safer version due a CVE in the 42.7.5 then it was bumped t0 42.7.7 2025-11-24 21:59:35 -03:00
Gustavo Henrique Miranda 7e154eb01c Merge pull request #7 from gmbrax/feature/IPC-Unix-Socket
Feature/ipc unix socket
2025-11-22 23:41:12 -03:00
Gustavo Henrique Miranda 24fadf9474 Merge pull request #6 from gmbrax/feature/add-SQLite-Implementation
Feature/add sq lite implementation
2025-11-22 23:37:31 -03:00
Gustavo Henrique Santos Souza de Miranda 269780d8cf Add CloseHandler to support graceful connection termination.
- Extend `test.proto` with `CloseCommand` and `CloseResponse` messages.
- Introduce `CloseHandler` to process "close" actions and respond with connection termination notice.
- Update `DelegateActionManager` to register `CloseHandler`.
- Refactor `IPCManager` to handle "close" response headers and terminate client connections gracefully.
2025-11-22 23:27:04 -03:00
Gustavo Henrique Santos Souza de Miranda 6576b54057 - Add HeartbeatHandler and enhance EchoHandler for Protocol Buffers support.
- Extend `test.proto` schema with heartbeat and echo message definitions.
- Register `HeartbeatHandler` in `DelegateActionManager`.
- Refactor Log4j2 configuration to standardize log levels.
- Optimize client wait time in `IPCManager` for reduced latency.
2025-11-22 02:29:28 -03:00
Gustavo Henrique Santos Souza de Miranda 2704be31bc Fix logging library dependency in pom.xml: replace log4j-slf4j2-impl with log4j-slf4j-impl. 2025-11-21 18:19:38 -03:00
Gustavo Henrique Santos Souza de Miranda dc4b6cbdfa Add SQLite support with SqliteDatabaseManager and application mode handling:
- Created `SqliteDatabaseManager` for SQLite database initialization and management.
- Refactored `DatabaseManager` into an abstract class to support different database implementations.
- Introduced `ApplicationMode` enum to switch between `local` and `server` modes.
- Updated `MediaManagerApplication` to handle `runtype` configuration and initialize SQLite in `local` mode.
- Updated `config.properties.example` with new `runtype` property.
- Added SQLite JDBC dependency to `pom.xml`.
2025-11-21 18:03:20 -03:00
Gustavo Henrique Miranda 77259308c6 Merge pull request #5 from gmbrax/feature/IPC-Unix-Socket
Feature/ipc unix socket
2025-11-20 09:16:50 -03:00
Gustavo Henrique Santos Souza de Miranda a0ad10b1bc Integrate DelegateActionManager for request handling and refactor IPC:
- Replaced `SimpleProtocol` with `TransportProtocol` in `IPCManager`.
- Added `DelegateActionManager` to route requests to handlers, starting with `EchoHandler`.
- Updated `MediaManagerApplication` to initialize and manage `DelegateActionManager`.
- Extended Protocol Buffers schema with `Request` and `Response` definitions.
- Enhanced logging for request processing and redesigned response flow.
2025-11-17 07:21:52 -03:00
Gustavo Henrique Santos Souza de Miranda 23b6d54674 Add Protocol Buffers support to IPCManager and Maven build:
- Created `messages.proto` to define `TextMessage` schema.
- Integrated Protocol Buffers Java library into Maven dependencies.
- Configured Maven plugins for Protocol Buffers compilation and generated source management.
- Implemented message serialization and deserialization in `IPCManager`.
- Enhanced client handling to process and respond with Protocol Buffers messages.
2025-11-15 01:54:31 -03:00
Gustavo Henrique Miranda 3998b18671 Merge pull request #4 from gmbrax/feature/IPC-Unix-Socket
feature/IPC-Unix-Socket
2025-11-14 22:40:49 -03:00
Gustavo Henrique Santos Souza de Miranda 3854635185 Remove the unused checkUnixSocketExists method from IPCManager. 2025-11-14 19:52:53 -03:00
Gustavo Henrique Santos Souza de Miranda f1071dca03 Enhance IPCManager with non-blocking server support and improved connection handling:
- Configured UNIX domain socket for non-blocking mode to prevent indefinite blocking on `accept()`.
- Introduced connection loop with thread pool for client handling.
- Added `ClientHandler` to process client communications.
- Implemented proper resource cleanup during shutdown.
- Improved logging for socket initialization, client handling, and shutdown.
2025-11-14 06:22:35 -03:00
Gustavo Henrique Santos Souza de Miranda 73d1753935 Add IPCManager for UNIX domain socket communication:
- Introduced `IPCManager` class to handle IPC using UNIX domain sockets.
- Updated `MediaManagerApplication` to initialize and manage `IPCManager` during startup and shutdown.
- Enhanced logging for IPC initialization and cleanup.
- Updated `config.properties.example` with `ipc.socket.path` property.
2025-11-13 20:45:37 -03:00
Gustavo Henrique Miranda 81e38ce9ae Merge pull request #3 from gmbrax/fix/Fix-exir-log-messages
Improve logging, shutdown behavior, and build configuration:
2025-11-13 17:18:47 -03:00
Gustavo Henrique Santos Souza de Miranda b7ff9d1e16 Improve logging, shutdown behavior, and build configuration:
- Enabled `immediateFlush` for log appenders and disabled `shutdownHook` in Log4j2 configuration.
- Enhanced shutdown hook with graceful Log4j2 termination and extended delay for log flushing.
- Improved database connection closure logging in `DatabaseManager`.
- Integrated Maven Shade Plugin to create executable JARs with all dependencies.
2025-11-13 17:10:23 -03:00
Gustavo Henrique Santos Souza de Miranda b0c45bf657 Refactor code for clarity and consistent formatting:
- Added missing braces in the shutdown hook.
- Removed unnecessary empty lines.
- Streamlined `try` block indentation in `loadConfiguration()`.
2025-11-13 05:58:57 -03:00
Gustavo Henrique Miranda ed2f197c60 Merge pull request #2 from gmbrax/feature/Database-Connector
Feature/database connector
2025-11-13 05:52:25 -03:00
Gustavo Henrique Miranda 01f12c4e15 Merge branch 'develop' into feature/Database-Connector 2025-11-13 05:50:00 -03:00
Gustavo Henrique Miranda 8c291867ce Merge pull request #1 from gmbrax/fix/fix-continous-run
Improve shutdown hook and application lifecycle logging:
2025-11-13 05:47:47 -03:00
Gustavo Henrique Santos Souza de Miranda 65e1493007 Improve shutdown hook and application lifecycle logging:
- Added graceful shutdown messages.
- Handled `InterruptedException` to ensure proper shutdown behavior.
- Included clear prompts for application status.
2025-11-13 05:40:01 -03:00
Gustavo Henrique Santos Souza de Miranda 3bb0423167 Enhance DatabaseManager with logging, validation, and cleanup
- Added detailed logging for database initialization and connection handling.
- Implemented configuration validation and sanity checks during initialization.
- Introduced `close()` method to properly release database resources.
- Updated `MediaManagerApplication` to invoke `DatabaseManager.close()` on shutdown.
- Updated `.gitignore` to exclude sensitive configuration files while allowing example files.
2025-11-13 04:43:05 -03:00
Gustavo Henrique Santos Souza de Miranda 22476abb27 Add DatabaseManager class and initialize database connection
- Introduced `DatabaseManager` class to manage database connections.
- Updated `MediaManagerApplication` to initialize `DatabaseManager` using configuration properties.
2025-11-13 03:59:31 -03:00
Gustavo Henrique Santos Souza de Miranda 885d5c95a4 Replace application.properties with config.properties:
- Renamed configuration file to `config.properties` for consistency.
- Updated `MediaManagerApplication` to load the new configuration file.
- Adjusted references in `README.md` and `.gitignore`.
2025-11-13 03:25:33 -03:00
Gustavo Henrique Santos Souza de MirandaandClaude 86da601ad6 Remove .idea folder from repository and update .gitignore
- Remove IntelliJ IDEA configuration files from version control
- Update .gitignore to exclude .idea/ folder

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-13 02:31:46 -03:00
Gustavo Henrique Santos Souza de Miranda 386f9fdf33 Add GPLv3 license to project: included COPYING file with full license text. 2025-11-13 02:28:26 -03:00
Gustavo Henrique Santos Souza de Miranda f66cfa6ea4 Initialize MediaManager-Core project with essential setup:
- Added `.gitignore` for common IDE and build artifacts.
- Configured `pom.xml` with dependencies: PostgreSQL, Hibernate, HikariCP, Log4j 2, Jackson, JUnit 5.
- Created `Media` entity with JPA annotations.
- Added `application.properties` for database and IPC configuration.
- Configured Log4j 2 with console and rolling file appenders.
- Provided `README.md` with setup instructions.
- Included `MediaManagerApplication` class as a starting point.
2025-11-13 02:24:11 -03:00