forked from boskworks/bosk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
64 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
example-chronicle/src/main/java/io/vena/chronicle/control/ControlBosk.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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())); | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
example-chronicle/src/main/java/io/vena/chronicle/control/ControlState.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 { } |
23 changes: 23 additions & 0 deletions
23
example-chronicle/src/main/java/io/vena/chronicle/control/ReadContextFilter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
example-chronicle/src/main/java/io/vena/chronicle/db/SenderEntity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package io.vena.chronicle.db; | ||
|
||
public record SenderEntity( | ||
String remoteAddr | ||
) { } |
5 changes: 5 additions & 0 deletions
5
example-chronicle/src/main/java/io/vena/chronicle/dto/SenderDTO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package io.vena.chronicle.dto; | ||
|
||
public record SenderDTO( | ||
String remoteAddr | ||
) { } |