Skip to content

Commit b71bfaa

Browse files
committed
Rename spring-boot-3 to spring-boot.
It was a mistake to put the Spring version number in the library name.
1 parent 109a589 commit b71bfaa

File tree

20 files changed

+264
-47
lines changed

20 files changed

+264
-47
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ A read context is intended to be coarse-grained, for example covering an entire
9494
giving you "snapshot-at-start" semantics and protecting you from race conditions.
9595
It is an antipattern to use many small read contexts during the course of a single operation.
9696

97-
If you're using Spring Boot 3, you can bring in `bosk-spring-boot-3`
97+
If you're using Spring Boot 3, you can bring in `bosk-spring-boot`
9898
and set the `bosk.web.maintenance-path` property to get an immediate HTTP REST API to view and edit your state tree.
9999

100100
To modify state programmatically, use the `BoskDriver` interface:

bosk-spring-boot-3/README.md

Lines changed: 2 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,5 @@
11
## bosk-spring-boot-3
22

3-
This is the subproject for the published `bosk-spring-boot-3` library for
4-
Spring Boot support.
3+
This library is an older name for the `bosk-spring-boot` library.
54

6-
It offers the features described below.
7-
8-
### Automatic read context
9-
10-
[`ReadContextFilter`](src/main/java/works/bosk/spring/boot/ReadContextFilter.java)
11-
opens a _read context_ automatically for every `GET`, `HEAD`, and `OPTIONS` request.
12-
In many cases, this is sufficient that the application need never open its own read contexts,
13-
except for `POST` operations that are acting like a `GET` with a body,
14-
or background operations executed on a separate thread.
15-
16-
This feature is enabled by default, and can be disabled by setting `bosk.web.read-context` to `false`.
17-
(Note, though, that if you have a situation where you need more control over read contexts,
18-
you can consider using `Bosk.supersedingReadContext()` rather than turning off automatic read contexts globally.)
19-
20-
### Maintenance endpoints
21-
22-
The [`MaintenanceEndpoints`](src/main/java/works/bosk/spring/boot/MaintenanceEndpoints.java) component
23-
registers HTTP endpoints giving direct `GET`, `PUT`, and `DELETE` access to the bosk state in JSON form.
24-
The endpoints have a prefix based on the `bosk.web.maintenance-path` setting,
25-
followed by the path of the node within the bosk state.
26-
They are intended for troubleshooting, manual operations,
27-
or integrating with external systems that need full control over the bosk state.
28-
29-
The endpoints also support ETags via `If-Match` and `If-None-Match` headers,
30-
which exposes a limited ability to do conditional updates.
31-
Nodes participating in this feature must have a field called `revision` of type `Identifier`.
32-
Using the `If-` headers on such a node has the following effects:
33-
34-
- `If-None-Match: *`: if the node already exists, no action is taken.
35-
- `If-Match: {ID}`: if the node does not exist, or its `revision` field has a different value, no action is taken.
5+
This library is deprecated for removal. Please use `bosk-spring-boot` instead.

bosk-spring-boot-3/build.gradle

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11

22
plugins {
3-
id 'bosk.development'
43
id 'bosk.maven-publish'
5-
id 'com.github.spotbugs' version '6.1.2'
4+
}
5+
6+
dependencies {
7+
api project(':bosk-spring-boot')
68
}
79

810
java {
@@ -19,14 +21,16 @@ compileTestJava {
1921
options.release = null
2022
}
2123

22-
dependencies {
23-
api project(":bosk-jackson")
24-
implementation 'org.springframework.boot:spring-boot-starter-web:3.4.3'
25-
annotationProcessor "org.springframework.boot:spring-boot-configuration-processor:3.4.3"
26-
testImplementation project(":bosk-testing")
27-
testImplementation project(":lib-testing")
28-
}
29-
3024
repositories {
3125
mavenCentral()
3226
}
27+
28+
publishing {
29+
publications {
30+
mavenJava(MavenPublication) {
31+
description = '''
32+
This library has been renamed. Please use bosk-spring-boot instead.
33+
'''.stripIndent().trim()
34+
}
35+
}
36+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
package works.bosk.annotations;
2+
3+
import java.lang.annotation.Retention;
4+
import java.lang.annotation.Target;
5+
6+
import static java.lang.annotation.ElementType.FIELD;
7+
import static java.lang.annotation.ElementType.PARAMETER;
8+
import static java.lang.annotation.RetentionPolicy.RUNTIME;
9+
10+
/**
11+
* On a field of a <code>StateTreeNode</code>, indicates that implicit references
12+
* enclosed by that field should be constructed using the supplied path string as a prefix.
13+
*
14+
* <p>
15+
* For example:
16+
*
17+
* <pre>
18+
* public class MyDTO implements StateTreeNode {
19+
* &#064;DeserializationPath("a/b/c")
20+
* MyObject field;
21+
* }
22+
*
23+
* public record MyObject(
24+
* &#064;Self Reference&lt;MyObject> self,
25+
* Optional&lt;MyObject> nested
26+
* ) extends Entity {}
27+
* </pre>
28+
*
29+
* If we deserialize an instance <code>x</code> of <code>MyDTO</code>, then
30+
* the reference <code>x.field.self</code> will have a path of <code>"a/b/c"</code>,
31+
* and <code>x.field.nested.get().self</code> will have a path of <code>"a/b/c/nested"</code>.
32+
*
33+
* <p>
34+
* If the path contains parameters, their values will be taken from the
35+
* binding environment on the
36+
* <code>DeserializationScope</code>, which can be set using
37+
* <code>StateTreeSerializer.overlayScope</code>.
38+
*/
39+
@Retention(RUNTIME)
40+
@Target({ FIELD, PARAMETER })
41+
public @interface DeserializationPath {
42+
String value();
43+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package works.bosk.annotations;
2+
3+
import java.lang.annotation.Retention;
4+
import java.lang.annotation.Target;
5+
6+
import static java.lang.annotation.ElementType.FIELD;
7+
import static java.lang.annotation.ElementType.PARAMETER;
8+
import static java.lang.annotation.RetentionPolicy.RUNTIME;
9+
10+
/**
11+
* Marks a <code>Reference</code> parameter in an <code>Entity</code> constructor to indicate that the
12+
* reference should point to an enclosing entity of the entity itself, as defined by
13+
* <code>Reference.enclosingReference</code>.
14+
*
15+
* <p>
16+
* Enclosing references are not serialized, and are created automatically during deserialization.
17+
*
18+
* @author Patrick Doyle
19+
*/
20+
@Retention(RUNTIME)
21+
@Target({ FIELD, PARAMETER })
22+
public @interface Enclosing {
23+
24+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package works.bosk.annotations;
2+
3+
import java.lang.annotation.Retention;
4+
import java.lang.annotation.Target;
5+
6+
import static java.lang.annotation.ElementType.METHOD;
7+
import static java.lang.annotation.RetentionPolicy.RUNTIME;
8+
9+
/**
10+
* Marks a method to be registered as a hook
11+
* for an object passed to <code>Bosk.registerHooks</code>.
12+
*/
13+
@Retention(RUNTIME)
14+
@Target(METHOD)
15+
public @interface Hook {
16+
/**
17+
* The scope of the hook for this method.
18+
*/
19+
String value();
20+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package works.bosk.annotations;
2+
3+
import java.lang.annotation.Retention;
4+
import java.lang.annotation.Target;
5+
import java.util.Optional;
6+
7+
import static java.lang.annotation.ElementType.FIELD;
8+
import static java.lang.annotation.RetentionPolicy.RUNTIME;
9+
10+
/**
11+
* Marks a static final field in a <code>StateTreeNode</code> to indicate that it can be
12+
* used as a default value for a given field, for backward compatibility with external
13+
* systems that don't yet support the field.
14+
*
15+
* <p>
16+
* This is not meant to be used just to supply default values for optional fields;
17+
* that should be achieved by declaring the field {@link Optional}
18+
* and calling {@link Optional#orElse} when the field is used.
19+
* Rather, this is meant to be used <em>temporarily</em> with newly added fields
20+
* to support systems that are not yet aware of those fields.
21+
*
22+
* <p>
23+
* The existence of this annotation anywhere in a bosk state tree could add overhead
24+
* to all bosk updates, even for unrelated parts of the state tree, so it's best to
25+
* remove this once it's no longer needed.
26+
*
27+
* @author Patrick Doyle
28+
*/
29+
@Retention(RUNTIME)
30+
@Target({ FIELD })
31+
public @interface Polyfill {
32+
/**
33+
* The names of the fields for which we're supplying a default value.
34+
*/
35+
String[] value();
36+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package works.bosk.annotations;
2+
3+
import java.lang.annotation.Retention;
4+
import java.lang.annotation.Target;
5+
6+
import static java.lang.annotation.ElementType.METHOD;
7+
import static java.lang.annotation.RetentionPolicy.RUNTIME;
8+
9+
/**
10+
* For an interface passed to <code>Bosk.buildReferences</code>,
11+
* this supplies the path string to be used to create the reference.
12+
*/
13+
@Retention(RUNTIME)
14+
@Target(METHOD)
15+
public @interface ReferencePath {
16+
String value();
17+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package works.bosk.annotations;
2+
3+
import java.lang.annotation.Retention;
4+
import java.lang.annotation.Target;
5+
6+
import static java.lang.annotation.ElementType.FIELD;
7+
import static java.lang.annotation.ElementType.PARAMETER;
8+
import static java.lang.annotation.RetentionPolicy.RUNTIME;
9+
10+
/**
11+
* Marks a <code>Reference</code> parameter in an <code>Entity</code> constructor to indicate that the
12+
* reference should point to the entity itself.
13+
*
14+
* <p>
15+
* Self-references are not serialized, and are created automatically during deserialization.
16+
*
17+
* @author Patrick Doyle
18+
*/
19+
@Retention(RUNTIME)
20+
@Target({ FIELD, PARAMETER })
21+
public @interface Self {
22+
23+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package works.bosk.annotations;
2+
3+
import java.lang.annotation.Retention;
4+
import java.lang.annotation.Target;
5+
6+
import static java.lang.annotation.ElementType.FIELD;
7+
import static java.lang.annotation.RetentionPolicy.RUNTIME;
8+
9+
@Retention(RUNTIME)
10+
@Target({ FIELD }) // TODO: Also METHOD
11+
public @interface VariantCaseMap {
12+
}

0 commit comments

Comments
 (0)