-
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
30 changed files
with
208 additions
and
238 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
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
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
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
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
68 changes: 68 additions & 0 deletions
68
libs/storage/src/main/java/smecalculus/bezmen/configuration/EdgeSide.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,68 @@ | ||
package smecalculus.bezmen.configuration; | ||
|
||
import com.typesafe.config.Optional; | ||
import jakarta.validation.constraints.NotBlank; | ||
import jakarta.validation.constraints.NotNull; | ||
import lombok.Data; | ||
import lombok.ToString; | ||
import smecalculus.bezmen.validation.ValueOfEnum; | ||
|
||
public abstract class EdgeSide { | ||
|
||
@Data | ||
public static class StorageProps { | ||
|
||
@NotNull | ||
StorageProtocolProps protocol; | ||
|
||
@NotNull | ||
StateMappingProps mapping; | ||
} | ||
|
||
@Data | ||
public static class StorageProtocolProps { | ||
|
||
@ValueOfEnum(StorageProtocolMode.class) | ||
String mode; | ||
|
||
@Optional | ||
H2Props h2; | ||
|
||
@Optional | ||
PostgresProps postgres; | ||
} | ||
|
||
@Data | ||
public static class StateMappingProps { | ||
|
||
@ValueOfEnum(StateMappingMode.class) | ||
private String mode; | ||
} | ||
|
||
@Data | ||
public static class PostgresProps { | ||
|
||
@NotBlank | ||
String url; | ||
|
||
@NotBlank | ||
String username; | ||
|
||
@NotBlank | ||
@ToString.Exclude | ||
String password; | ||
} | ||
|
||
@Data | ||
public static class H2Props { | ||
|
||
@NotBlank | ||
String url; | ||
|
||
@NotBlank | ||
String username; | ||
|
||
@NotBlank | ||
String password; | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
libs/storage/src/main/java/smecalculus/bezmen/configuration/EdgeSideEg.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,30 @@ | ||
package smecalculus.bezmen.configuration; | ||
|
||
import static smecalculus.bezmen.configuration.StateMappingMode.SPRING_DATA; | ||
import static smecalculus.bezmen.configuration.StorageProtocolMode.H2; | ||
|
||
import smecalculus.bezmen.configuration.EdgeSide.StateMappingProps; | ||
import smecalculus.bezmen.configuration.EdgeSide.StorageProps; | ||
import smecalculus.bezmen.configuration.EdgeSide.StorageProtocolProps; | ||
|
||
public abstract class EdgeSideEg { | ||
|
||
public static StorageProps storageProps() { | ||
var propsEdge = new StorageProps(); | ||
propsEdge.setMapping(stateMappingProps()); | ||
propsEdge.setProtocol(storageProtocolProps()); | ||
return propsEdge; | ||
} | ||
|
||
public static StateMappingProps stateMappingProps() { | ||
var propsEdge = new StateMappingProps(); | ||
propsEdge.setMode(SPRING_DATA.name()); | ||
return propsEdge; | ||
} | ||
|
||
public static StorageProtocolProps storageProtocolProps() { | ||
var propsEdge = new StorageProtocolProps(); | ||
propsEdge.setMode(H2.name()); | ||
return propsEdge; | ||
} | ||
} |
8 changes: 0 additions & 8 deletions
8
libs/storage/src/main/java/smecalculus/bezmen/configuration/H2Props.java
This file was deleted.
Oops, something went wrong.
17 changes: 0 additions & 17 deletions
17
libs/storage/src/main/java/smecalculus/bezmen/configuration/H2PropsEdge.java
This file was deleted.
Oops, something went wrong.
9 changes: 0 additions & 9 deletions
9
libs/storage/src/main/java/smecalculus/bezmen/configuration/PostgresProps.java
This file was deleted.
Oops, something went wrong.
19 changes: 0 additions & 19 deletions
19
libs/storage/src/main/java/smecalculus/bezmen/configuration/PostgresPropsEdge.java
This file was deleted.
Oops, something went wrong.
25 changes: 25 additions & 0 deletions
25
libs/storage/src/main/java/smecalculus/bezmen/configuration/ServerSide.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,25 @@ | ||
package smecalculus.bezmen.configuration; | ||
|
||
import lombok.Builder; | ||
import lombok.NonNull; | ||
import lombok.ToString; | ||
|
||
public abstract class ServerSide { | ||
|
||
@Builder | ||
public record StorageProps(@NonNull StorageProtocolProps protocolProps, @NonNull StateMappingProps mappingProps) {} | ||
|
||
@Builder | ||
public record StorageProtocolProps( | ||
@NonNull StorageProtocolMode protocolMode, H2Props h2Props, PostgresProps postgresProps) {} | ||
|
||
@Builder | ||
public record StateMappingProps(@NonNull StateMappingMode mappingMode) {} | ||
|
||
@Builder | ||
public record H2Props(@NonNull String url, @NonNull String username, @NonNull String password) {} | ||
|
||
@Builder | ||
public record PostgresProps( | ||
@NonNull String url, @NonNull String username, @NonNull @ToString.Exclude String password) {} | ||
} |
51 changes: 51 additions & 0 deletions
51
libs/storage/src/main/java/smecalculus/bezmen/configuration/ServerSideEg.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,51 @@ | ||
package smecalculus.bezmen.configuration; | ||
|
||
import static smecalculus.bezmen.configuration.StateMappingMode.SPRING_DATA; | ||
import static smecalculus.bezmen.configuration.StorageProtocolMode.H2; | ||
|
||
import smecalculus.bezmen.configuration.ServerSide.H2Props; | ||
import smecalculus.bezmen.configuration.ServerSide.PostgresProps; | ||
import smecalculus.bezmen.configuration.ServerSide.StateMappingProps; | ||
import smecalculus.bezmen.configuration.ServerSide.StorageProps; | ||
import smecalculus.bezmen.configuration.ServerSide.StorageProtocolProps; | ||
|
||
public abstract class ServerSideEg { | ||
public static StorageProps.Builder storageProps() { | ||
return StorageProps.builder() | ||
.protocolProps(storageProtocolProps().build()) | ||
.mappingProps(stateMappingProps().build()); | ||
} | ||
|
||
public static StorageProps.Builder storageProps(StateMappingMode mappingMode, StorageProtocolMode protocolMode) { | ||
return storageProps() | ||
.protocolProps(storageProtocolProps(protocolMode).build()) | ||
.mappingProps(stateMappingProps(mappingMode).build()); | ||
} | ||
|
||
public static StateMappingProps.Builder stateMappingProps() { | ||
return StateMappingProps.builder().mappingMode(SPRING_DATA); | ||
} | ||
|
||
public static StateMappingProps.Builder stateMappingProps(StateMappingMode mode) { | ||
return stateMappingProps().mappingMode(mode); | ||
} | ||
|
||
public static StorageProtocolProps.Builder storageProtocolProps() { | ||
return StorageProtocolProps.builder() | ||
.protocolMode(H2) | ||
.h2Props(H2Props.builder() | ||
.url("jdbc:h2:mem:bezmen;DB_CLOSE_DELAY=-1") | ||
.username("sa") | ||
.password("sa") | ||
.build()) | ||
.postgresProps(PostgresProps.builder() | ||
.url("jdbc:postgresql://localhost:5432/bezmen") | ||
.username("bezmen") | ||
.password("bezmen") | ||
.build()); | ||
} | ||
|
||
public static StorageProtocolProps.Builder storageProtocolProps(StorageProtocolMode mode) { | ||
return storageProtocolProps().protocolMode(mode); | ||
} | ||
} |
7 changes: 0 additions & 7 deletions
7
libs/storage/src/main/java/smecalculus/bezmen/configuration/StateMappingProps.java
This file was deleted.
Oops, something went wrong.
11 changes: 0 additions & 11 deletions
11
libs/storage/src/main/java/smecalculus/bezmen/configuration/StateMappingPropsEdge.java
This file was deleted.
Oops, something went wrong.
23 changes: 0 additions & 23 deletions
23
libs/storage/src/main/java/smecalculus/bezmen/configuration/StateMappingPropsEg.java
This file was deleted.
Oops, something went wrong.
7 changes: 0 additions & 7 deletions
7
libs/storage/src/main/java/smecalculus/bezmen/configuration/StorageProps.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.