How flypzed/arsw-lab07 works
Project’s Main Components
• Frontend Client:
– Located in src/main/resources/static, with index.html for the main page and JavaScript files (apiclient.js, apimock.js, app.js) handling client-side logic.
• REST API Layer (Controller):
– Found in the package edu.eci.arsw.blueprints.controllers. The BlueprintAPIController handles incoming HTTP requests, orchestrates service calls, and returns responses.
– Includes error handling components, for example, ResourceNotFoundException.
• Service Layer:
– Present in edu.eci.arsw.blueprints.services. The BlueprintsServices class represents the business logic that processes operations before interacting with persistent storage. This layer acts as the intermediary between the API endpoints and backend storage.
• Persistence Layer:
– Represented by the interfaces and classes in edu.eci.arsw.blueprints.persistence, such as BlueprintsPersistence and its implementation InMemoryBlueprintPersistence. This “in-memory” persistence component simulates the database functionality.
• Filtering Component:
– The project also includes a filtering module (edu.eci.arsw.blueprints.filter and its implementations: RedundancyFilter, SubsamplingFilter), which likely processes or modifies blueprint data as needed (perhaps to remove contradictions or reduce data before storage/display).
Relationships and Interactions
– The Frontend Client invokes REST endpoints exposed by the BlueprintAPIController.
– The Controller forwards requests to the Service Layer (BlueprintsServices) to execute the core business logic.
– The Service Layer interacts with the Persistence Layer (using InMemoryBlueprintPersistence) to store, retrieve, or modify blueprint data.
– The Filtering Components are applied (either before persisting data or before sending it back to the client) to ensure data integrity or optimize the results.
– Exception handling components (e.g., ResourceNotFoundException) are incorporated into the REST API to manage error states and display meaningful error messages.
Architectural Patterns and Design Principles
– Separation of Concerns / Layered Architecture: Each layer (frontend, controller, service, persistence) handles a distinct responsibility.
– RESTful API Design: The blueprint API is designed to serve data in a client-server manner.
– In-Memory Data Persistence: Although simplified for demo or testing, the use of InMemoryBlueprintPersistence reflects the pattern of abstracting data access behind an interface, potentially allowing a later swap to a more robust database solution.
– Data Filtering: The implementation of different filtering strategies (RedundancyFilter and SubsamplingFilter) suggests the application uses a modular approach to process data.
Relevant Technologies and Frameworks
– Java (with Maven indicated by pom.xml) is used on the backend.
– Likely Spring Boot, considering the package structure (the main application class BlueprintsAPIApplication) and the convention for serving static resources.
– HTML5 and JavaScript are used for the frontend.
– In-memory storage is employed, with the possibility to extend to persistent storage.
– Next, show the API Controller acting as the gateway to the backend.
– Below, represent the Persistence component (implemented via an in-memory mechanism) that the services interact with.
– Additionally, illustrate the Filtering Component as an auxiliary service provided during data processing.
– Finally, illustrate exception handling paths that feed back error information to the client as needed.