Commit Graph

60 Commits

Author SHA1 Message Date
Gustavo Henrique Miranda 1dd2542656
Merge pull request #19 from gmbrax/fix/Fix-artist-proto-mismatch
Feature/Implement-BitRate-Management
2025-12-05 21:55:31 -03:00
Gustavo Henrique Santos Souza de Miranda c787eba20e Fix field name casing in UpdateArtistResponse proto message
Change field name from 'Artist' to 'artist' to follow protobuf naming conventions, which require lowercase field names with underscores for word separation.

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-05 21:48:46 -03:00
Gustavo Henrique Santos Souza de Miranda 2294a57ffd Implement bit-rate management feature
Add complete CRUD functionality for bit-rate management following the same pattern as bit-depth:
  - Create BitRate entity model with JPA annotations
  - Implement BitRateRepository with full CRUD operations
  - Add BitRateService with validation and business logic
  - Create BitRateMapper for protobuf/entity conversion
  - Implement action handlers: Create, GetAll, GetById, Update, Delete
  - Define bitrate.proto protobuf message definitions
  - Register BitRateService in DelegateActionManager

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

  Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-05 20:43:04 -03:00
Gustavo Henrique Miranda 8c8b8ec765
Merge pull request #17 from gmbrax/fix/Fix-Repeated-return-on-CreateBitDepthHandler
Remove duplicate `newBuilder` call in `CreateBitDepthHandler`
2025-12-05 18:12:32 -03:00
Gustavo Henrique Santos Souza de Miranda 92b4b21e60 Remove duplicate `TransportProtocol.Response.newBuilder()` call in `CreateBitDepthHandler`. 2025-12-05 17:02:02 -03:00
Gustavo Henrique Miranda 026a3aefa4
Merge pull request #15 from gmbrax/feature/implement-bitdepth-management
Implement BitDepth Management with CRUD Operations
2025-12-05 04:55:14 -03:00
Gustavo Henrique Miranda 93c458d856
Update src/main/java/com/mediamanager/service/delegate/handler/bitdepth/UpdateBitDepthHandler.java
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2025-12-05 04:54:40 -03:00
Gustavo Henrique Miranda cd4b35f3c9
Update src/main/java/com/mediamanager/service/delegate/handler/bitdepth/CreateBitDepthHandler.java
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2025-12-05 04:54:29 -03:00
Gustavo Henrique Santos Souza de Miranda 2d77358d50 Implement BitDepth Management with CRUD Operations
- Add `BitDepth` entity with JPA annotations and database mapping.
- Create repository, service, and delegate handlers for BitDepth CRUD operations: `bitdepth.create`, `bitdepth.getAll`, `bitdepth.getById`, `bitdepth.update`, `bitdepth.delete`.
- Introduce Protobuf definitions for BitDepth messages.
- Register BitDepth service and handlers in `DelegateActionManager`.
- Create `BitDepthMapper` to map between Protobuf and entity models.
- Enhance error handling and logging for BitDepth operations.
2025-12-03 03:15:39 -03:00
Gustavo Henrique Miranda 9aadb7283c
Merge pull request #14 from gmbrax/feature/Implement-composer-management
Implement Composer Management with CRUD Operations
2025-12-01 00:46:57 -03:00
Gustavo Henrique Miranda 371a2dd85c
Merge branch 'develop' into feature/Implement-composer-management 2025-12-01 00:46:31 -03:00
Gustavo Henrique Miranda 4ac7ca4557
Merge pull request #13 from gmbrax/feature/Implement-artist-management
Implement Artist Management with CRUD Operations
2025-12-01 00:44:19 -03:00
Gustavo Henrique Santos Souza de Miranda db4217bec4 Implement Composer Management with CRUD Operations
- Add `Composer` entity with JPA annotations and database mapping.
- Create repository, service, and delegate handlers for Composer CRUD operations: `create_composer`, `get_composers`, `get_composer_by_id`, `update_composer`, `delete_composer`.
- Introduce Protobuf definitions for Composer messages.
- Register Composer service and handlers in `DelegateActionManager`.
- Add `ComposerMapper` to map between Protobuf and entity models.
- Enhance error handling and logging for Composer operations.
2025-12-01 00:16:57 -03:00
Gustavo Henrique Santos Souza de Miranda 51a46c37e5 Rename `DeleteArtistHandle` to `DeleteArtistHandler` for consistency and update related references. Clean up Protobuf comment in `UpdateArtistResponse`. 2025-11-30 17:33:25 -03:00
Gustavo Henrique Santos Souza de Miranda 0df4b31a4d Fix logging messages in `ArtistRepository` for clarity
- Correct references from "genre" to "artist" in logging statements.
- Remove unused `Genre` import for cleanup.
2025-11-30 12:59:57 -03:00
Gustavo Henrique Miranda 3c42fd9735
Update src/main/java/com/mediamanager/mapper/ArtistMapper.java
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2025-11-30 12:54:18 -03:00
Gustavo Henrique Santos Souza de Miranda 0a61f1f2fa Implement Artist Management with CRUD Operations
- Add `Artist` entity with JPA annotations and database mapping.
- Create repository, service, and delegate handlers for Artist CRUD operations.
- Register handlers (`artist.create`, `artist.getAll`, `artist.getById`, `artist.update`, `artist.delete`) in `DelegateActionManager`.
- Introduce Protobuf definitions for Artist messages.
- Update `initializeServices` in `DelegateActionManager` for Artist service support.
- Add null-safe ID handling in `ArtistMapper` to prevent potential NPEs.
2025-11-30 12:46:50 -03:00
Gustavo Henrique Miranda fecb0288d3
Merge pull request #12 from gmbrax/feature/auto-handler-scanner
Feature/auto handler scanner
2025-11-29 20:37:26 -03:00
Gustavo Henrique Santos Souza de Miranda 5ce8f4ca2a Improve `DelegateActionManager` error handling for invalid handlers
- Add validation to ensure classes annotated with `@Action` implement `ActionHandler`, throwing `IllegalArgumentException` for mismatches.
- Fix minor formatting issue in `@Action` annotation for `GetGenreByIdHandler`.
2025-11-29 15:33:08 -03:00
Gustavo Henrique Miranda a5bd6e2c39
Update src/main/java/com/mediamanager/service/delegate/DelegateActionManager.java
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2025-11-29 09:52:54 -03:00
Gustavo Henrique Santos Souza de Miranda f87d6b1b53 Refactor `DelegateActionManager` for dynamic handler registration
- Replace manual handler registration with automatic scanning and registration of handlers annotated with `@Action`.
- Introduce `ServiceLocator` to enable dependency injection for dynamically instantiated handlers.
- Add `initializeServices` to centralize service initialization and registration.
- Enhance error handling and logging for handler instantiation and registration processes.
2025-11-29 08:26:58 -03:00
Gustavo Henrique Santos Souza de Miranda b715bb1bd3 Add `@Action` annotation and `ServiceLocator` for improved handler registration
- Introduce `@Action` annotation to simplify action handler identification and tagging.
- Add `ServiceLocator` for dynamic service registration and retrieval.
- Annotate handlers (`CreateGenreHandler`, `GetGenreHandler`, `UpdateGenreHandler`, `DeleteGenreHandler`, etc.) with corresponding actions.
2025-11-29 07:54:46 -03:00
Gustavo Henrique Miranda 9c3a1126a7
Merge pull request #11 from gmbrax/feature/implement-genre-management
Implement Genre Management with CRUD Operations
2025-11-29 06:09:44 -03:00
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