The following was discovered as part of building this project:
- The original package name 'com.basktpay.dfs-api' is invalid and this project uses 'com.basktpay.dfsapi' instead.
For further reference, please consider the following sections:
The application is developed to perform the read and write operation of the internal shared file.
GET - http://localhost:8080/file
POST - http://localhost:8080/file?app_key={api.key}
Implemented the basic HTML and JavaScript page to handle GET and POST operations. For the write operation, the API key is implemented with basic authentication, and it is configured in the application.properties file. The file path and file name are also configured in application.properties.
The SharedFile class is a component responsible for managing a shared file within the DFS API application. It facilitates concurrent read and write operations on the shared file, ensuring data integrity and reliability. This class is a crucial part of the distributed file system architecture implemented in the application.
The primary purpose of the SharedFile class is to: Read: Retrieve the content of the shared file. Write: Add new data to the shared file asynchronously, ensuring smooth and efficient operations.
Synchronous file reading. Asynchronous file writing with a dedicated writer thread. Graceful shutdown mechanism for clean application termination.
File Reading: Supports synchronous reading of the shared file's content. File Writing: Asynchronously writes data to the shared file, ensuring minimal impact on application performance. Error Handling: Detects and handles file-related errors, providing robustness to the system.
Implemented the circuit breaker mechanism for the write operation.
Wrote JUnit tests for the controller class and shared file class. Integration tests were created to check the endpoints.