deps: Refactor dependencies (#3224)

* remove spring dep
move junit, logging, mockito under dep mgmt

* upgrade anti-corruption-layer deps

* async method invocation

* balking, bloc

* bridge to bytecode

* caching

* callback - cqrs

* component - health check

* hexagonal - metadata mapping

* rest of the patterns

* remove checkstyle, take spotless into use
This commit is contained in:
Ilkka Seppälä
2025-03-29 19:34:27 +02:00
committed by GitHub
parent 371439aeaa
commit 0ca162a55c
1863 changed files with 14408 additions and 17637 deletions
@@ -28,9 +28,8 @@ import java.util.HashMap;
import java.util.Map;
/**
* ApiGateway class acts as a dynamic routing mechanism that forwards client
* requests to the appropriate frontend components based on dynamically
* registered routes.
* ApiGateway class acts as a dynamic routing mechanism that forwards client requests to the
* appropriate frontend components based on dynamically registered routes.
*
* <p>This allows for flexible, runtime-defined routing without hardcoding specific paths.
*/
@@ -43,7 +42,7 @@ public class ApiGateway {
/**
* Registers a route dynamically at runtime.
*
* @param path the path to access the component (e.g., "/products")
* @param path the path to access the component (e.g., "/products")
* @param component the frontend component to be accessed at the given path
*/
public void registerRoute(String path, FrontendComponent component) {
@@ -53,14 +52,14 @@ public class ApiGateway {
/**
* Handles a client request by routing it to the appropriate frontend component.
*
* <p>This method dynamically handles parameters passed with the request, which
* allows the frontend components to respond based on those parameters.
* <p>This method dynamically handles parameters passed with the request, which allows the
* frontend components to respond based on those parameters.
*
* @param path the path for which the request is made (e.g., "/products", "/cart")
* @param params a map of parameters that might influence the data fetching logic
* (e.g., filters, userId, categories, etc.)
* @return the data fetched from the appropriate component or "404 Not Found"
* if the path is not registered
* @param path the path for which the request is made (e.g., "/products", "/cart")
* @param params a map of parameters that might influence the data fetching logic (e.g., filters,
* userId, categories, etc.)
* @return the data fetched from the appropriate component or "404 Not Found" if the path is not
* registered
*/
public String handleRequest(String path, Map<String, String> params) {
if (routes.containsKey(path)) {
@@ -27,18 +27,16 @@ package com.iluwatar.clientsideuicomposition;
import java.util.Map;
/**
* CartFrontend is a concrete implementation of FrontendComponent
* that simulates fetching shopping cart data based on the user.
* CartFrontend is a concrete implementation of FrontendComponent that simulates fetching shopping
* cart data based on the user.
*/
public class CartFrontend extends FrontendComponent {
/**
* Fetches the current state of the shopping cart based on dynamic parameters
* like user ID.
* Fetches the current state of the shopping cart based on dynamic parameters like user ID.
*
* @param params parameters that influence the cart data, e.g., "userId"
* @return a string representing the items in the shopping cart for a given
* user
* @return a string representing the items in the shopping cart for a given user
*/
@Override
protected String getData(Map<String, String> params) {
@@ -28,9 +28,8 @@ import java.util.Map;
import lombok.extern.slf4j.Slf4j;
/**
* ClientSideIntegrator class simulates the client-side integration layer that
* dynamically assembles various frontend components into a cohesive user
* interface.
* ClientSideIntegrator class simulates the client-side integration layer that dynamically assembles
* various frontend components into a cohesive user interface.
*/
@Slf4j
public class ClientSideIntegrator {
@@ -38,19 +37,17 @@ public class ClientSideIntegrator {
private final ApiGateway apiGateway;
/**
* Constructor that accepts an instance of ApiGateway to handle dynamic
* routing.
* Constructor that accepts an instance of ApiGateway to handle dynamic routing.
*
* @param apiGateway the gateway that routes requests to different frontend
* components
* @param apiGateway the gateway that routes requests to different frontend components
*/
public ClientSideIntegrator(ApiGateway apiGateway) {
this.apiGateway = apiGateway;
}
/**
* Composes the user interface dynamically by fetching data from different
* frontend components based on provided parameters.
* Composes the user interface dynamically by fetching data from different frontend components
* based on provided parameters.
*
* @param path the route of the frontend component
* @param params a map of dynamic parameters to influence the data fetching
@@ -28,16 +28,16 @@ import java.util.Map;
import java.util.Random;
/**
* FrontendComponent is an abstract class representing an independent frontend
* component that fetches data dynamically based on the provided parameters.
* FrontendComponent is an abstract class representing an independent frontend component that
* fetches data dynamically based on the provided parameters.
*/
public abstract class FrontendComponent {
public static final Random random = new Random();
/**
* Simulates asynchronous data fetching by introducing a random delay and
* then fetching the data based on dynamic input.
* Simulates asynchronous data fetching by introducing a random delay and then fetching the data
* based on dynamic input.
*
* @param params a map of parameters that may affect the data fetching logic
* @return the data fetched by the frontend component
@@ -54,8 +54,7 @@ public abstract class FrontendComponent {
}
/**
* Abstract method to be implemented by subclasses to return data based on
* parameters.
* Abstract method to be implemented by subclasses to return data based on parameters.
*
* @param params a map of parameters that may affect the data fetching logic
* @return the data for this specific component
@@ -27,8 +27,8 @@ package com.iluwatar.clientsideuicomposition;
import java.util.Map;
/**
* ProductFrontend is a concrete implementation of FrontendComponent
* that simulates fetching dynamic product data.
* ProductFrontend is a concrete implementation of FrontendComponent that simulates fetching dynamic
* product data.
*/
public class ProductFrontend extends FrontendComponent {
@@ -41,8 +41,6 @@ public class ProductFrontend extends FrontendComponent {
@Override
protected String getData(Map<String, String> params) {
String category = params.getOrDefault("category", "all");
return "Product List for category '"
+ category
+ "': [Product 1, Product 2, Product 3]";
return "Product List for category '" + category + "': [Product 1, Product 2, Product 3]";
}
}