Skip to content

Commit

Permalink
Initial bosk hookup
Browse files Browse the repository at this point in the history
  • Loading branch information
prdoyle committed Jul 1, 2023
1 parent dbc132a commit 9ccd505
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 0 deletions.
2 changes: 2 additions & 0 deletions example-chronicle/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ dependencies {
annotationProcessor 'org.mapstruct:mapstruct-processor:1.5.5.Final'
testAnnotationProcessor 'org.mapstruct:mapstruct-processor:1.5.5.Final'

implementation 'io.vena:bosk-mongo:0.0.90'

compileJava {
options.compilerArgs << '-parameters'
options.compilerArgs << '--enable-preview'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package io.vena.chronicle.control;

import io.vena.bosk.Bosk;
import io.vena.bosk.Identifier;
import org.springframework.stereotype.Component;

@Component
public class ControlBosk extends Bosk<ControlState> {
public ControlBosk() {
super(
ControlBosk.class.getSimpleName(),
ControlState.class,
ControlBosk::defaultRoot,
Bosk::simpleDriver);
}

private static ControlState defaultRoot(Bosk<ControlState> bosk) {
return new ControlState(
Identifier.from(ControlBosk.class.getSimpleName()));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package io.vena.chronicle.control;

import io.vena.bosk.Entity;
import io.vena.bosk.Identifier;

public record ControlState(
Identifier id
) implements Entity { }
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package io.vena.chronicle.control;

import jakarta.servlet.Filter;
import jakarta.servlet.FilterChain;
import jakarta.servlet.ServletException;
import jakarta.servlet.ServletRequest;
import jakarta.servlet.ServletResponse;
import java.io.IOException;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

@Component
@RequiredArgsConstructor
public class ReadContextFilter implements Filter {
private final ControlBosk bosk;

@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
try (var __ = bosk.readContext()) {
chain.doFilter(request, response);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package io.vena.chronicle.db;

public record SenderEntity(
String remoteAddr
) { }
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package io.vena.chronicle.dto;

public record SenderDTO(
String remoteAddr
) { }

0 comments on commit 9ccd505

Please sign in to comment.