This commit introduces comprehensive AlbumType entity management following
the established repository pattern used for other entities like SamplingRate
and AlbumArt.
Key components implemented:
Model Layer:
- AlbumType entity with id and value fields
- JPA annotations for database persistence
- Complete getters and setters
Repository Layer:
- AlbumTypeRepository with EntityManager-based operations
- Full transaction management with proper rollback handling
- Methods: save, findAll, findById, update, deleteById
Service Layer:
- AlbumTypeService with business logic and validation
- Input validation for null/empty value fields
- ID validation for all operations requiring entity lookup
- Comprehensive logging using Log4j2
Mapper Layer:
- AlbumTypeMapper for bidirectional entity/protobuf conversion
- Null safety checks and validation
- Proper handling of optional ID field
Action Handlers:
- CreateAlbumTypeHandler (albumtype.create)
- GetAlbumTypeHandler (albumtype.getAll)
- GetAlbumTypeByIdHandler (albumtype.getById)
- UpdateAlbumTypeHandler (albumtype.update)
- DeleteAlbumTypeHandler (albumtype.delete)
- HTTP status code handling: 200 (success), 400 (validation),
404 (not found), 500 (server error)
Protocol Buffers:
- Complete proto definition with AlbumTypeMessages
- All CRUD message definitions (Create, Get, GetById, Update, Delete)
Service Registration:
- AlbumTypeRepository initialized with EntityManagerFactory
- AlbumTypeService registered with ServiceLocator for dependency injection
- Ensures all AlbumType action handlers can resolve dependencies
The implementation follows best practices with proper error handling,
logging, validation, and consistency with existing codebase patterns.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit completes the AlbumArt feature integration by registering
the service with the dependency injection system and updating repository
ignore rules.
Service Registration:
- Initialize AlbumArtRepository with EntityManagerFactory
- Create AlbumArtService instance with repository dependency
- Register AlbumArtService with ServiceLocator for handler injection
- Ensures all AlbumArt action handlers can resolve dependencies
The service follows the established initialization pattern used by other
entities (SamplingRate, BitDepth, BitRate, etc.) ensuring consistency
across the application architecture.
Repository Configuration:
- Add src/scripts/* to .gitignore for local script files
- Add local-repo/ to .gitignore for local Maven repository cache
- Prevents accidental commits of development artifacts and dependencies
These changes complete the AlbumArt feature, making it fully operational
and accessible through the action handler system.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit introduces comprehensive AlbumArt entity management following
the established repository pattern used for other entities like SamplingRate.
Key components implemented:
Model Layer:
- AlbumArt entity with id and filepath fields
- JPA annotations for database persistence
Repository Layer:
- AlbumArtRepository with EntityManager-based operations
- Full transaction management with proper rollback handling
- Methods: save, findAll, findById, update, deleteById
Service Layer:
- AlbumArtService with business logic and validation
- Input validation for null/empty filepath values
- ID validation for all operations requiring entity lookup
- Comprehensive logging using Log4j2
Mapper Layer:
- AlbumArtMapper for bidirectional entity/protobuf conversion
- Null safety checks and validation
- Proper handling of optional ID field
Action Handlers:
- CreateAlbumArtHandler (albumart.create)
- GetAlbumArtHandler (albumart.getAll)
- GetAlbumArtByIdHandler (albumart.getById)
- UpdateAlbumArtHandler (albumart.update)
- DeleteAlbumArtHandler (albumart.delete)
- HTTP status code handling: 200 (success), 400 (validation),
404 (not found), 500 (server error)
Protocol Buffers:
- Fixed java_outer_classname from "BitDepthMessages" to "AlbumArtMessages"
- All CRUD message definitions (Create, Get, GetById, Update, Delete)
The implementation follows best practices with proper error handling,
logging, validation, and consistency with existing codebase patterns.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Enhance input validation and code quality in the SamplingRate service:
- Add null check for id parameter in updateSamplingRate() method to prevent
potential NullPointerException when calling repository.findById()
- Standardize indentation throughout the updateSamplingRate() method body,
improving code readability and consistency with project style guidelines
This complements the previous validation improvements by ensuring all
method parameters are properly validated before use, creating a more
defensive and robust API surface.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit addresses potential runtime exceptions and improves input validation:
- Replace Optional.of() with Optional.ofNullable() in SamplingRateRepository.findById()
to properly handle cases where no sampling rate is found, preventing NullPointerException
- Add null validation for id parameter in SamplingRateService.deleteSamplingRate()
to ensure proper error handling before repository operations
- Clean up code formatting in updateSamplingRate() validation block
These changes enhance the robustness of the sampling rate management feature
by preventing NPEs and providing clearer error messages for invalid inputs.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
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>
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>
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>
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>
- 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.
- 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.
- 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.
- Add validation to ensure classes annotated with `@Action` implement `ActionHandler`, throwing `IllegalArgumentException` for mismatches.
- Fix minor formatting issue in `@Action` annotation for `GetGenreByIdHandler`.
- 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.
- 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.
- 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.
- Ensure non-null and non-empty values for `hibernate.dialect`, `database.driver`, and `connectionUrl`.
- Throw `IllegalStateException` when required properties are missing.
- 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.
- 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.
- 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.
- 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.