Commit Graph
62 Commits
Author SHA1 Message Date
Gustavo Henrique Mirandaandcoderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> 4fa147282f Update src/main/java/com/mediamanager/service/samplingrate/SamplingRateService.java
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2025-12-06 22:07:39 -03:00
Gustavo Henrique Santos Souza de MirandaandClaude Sonnet 4.5 5ff972ebcb Fix message name casing in SamplingRate proto definition
Standardize the naming convention by changing `GetSamplingRateByIDRequest`
to `GetSamplingRateByIdRequest`, using "Id" instead of "ID" for consistency
with other proto message names across the codebase. Updated the corresponding
handler to reference the corrected message name.

This aligns with the established naming pattern and improves code consistency
following the same convention applied in other proto definitions.

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-06 02:55:36 -03:00
Gustavo Henrique Santos Souza de MirandaandClaude Sonnet 4.5 5aeb54516c Implement sampling rate management with full CRUD operations
This commit introduces comprehensive sampling rate management functionality
to the MediaManager system, following the established patterns from BitDepth
and BitRate implementations.

Core Components Added:
- SamplingRate entity model with JPA annotations for database persistence
- SamplingRateRepository with full CRUD operations (save, findAll, findById, update, deleteById)
- SamplingRateService business logic layer with validation and error handling
- SamplingRateMapper for bidirectional entity-protobuf conversions

Protocol Buffers:
- Defined samplingrate.proto with complete message specifications
- SamplingRate message structure (id, value)
- Request/Response pairs for all CRUD operations (Create, GetAll, GetById, Update, Delete)
- Fixed typo in UpdateSamplingRateRequest (valeu -> value)

Action Handlers:
- CreateSamplingRateHandler: Validates and creates new sampling rate entries
- GetSamplingRateHandler: Retrieves all sampling rates from the database
- GetSamplingRateByIdHandler: Fetches individual sampling rates with 404 handling
- UpdateSamplingRateHandler: Updates existing sampling rates with validation
- DeleteSamplingRateHandler: Removes sampling rates with success confirmation

Integration:
- Registered SamplingRateService in DelegateActionManager
- All handlers follow the @Action annotation pattern for automatic discovery
- Consistent error handling with appropriate HTTP status codes (400, 404, 500)

This implementation provides a complete foundation for managing audio sampling
rates within the media management system, enabling clients to perform all
standard CRUD operations through the established protocol buffer interface.

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-06 02:41:48 -03:00
Gustavo Henrique Santos Souza de MirandaandClaude Sonnet 4.5 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 Mirandaandcoderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> 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 Mirandaandcoderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> 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 Mirandaandcoderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> 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 Mirandaandcoderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> 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
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