Class StoreBackedBootstrapStateService
java.lang.Object
com.svenruppert.jsentinel.bootstrap.StoreBackedBootstrapStateService
Bootstrap-state service backed by a
BootstrapStateStore.
Where the legacy BootstrapStateService derives "is the
system uninitialized?" from
AdministratorAccountStore.hasAnyAdministrator(), this
variant treats the bootstrap fact as a first-class persistent
record (with completion instant and tenant scope). The transition
from "required" → "completed" is recorded by
markCompleted() and is idempotent.
Bound to one TenantId + BootstrapMode at
construction. Multi-tenant deployments instantiate one service
per tenant.
-
Constructor Summary
ConstructorsConstructorDescriptionConvenience constructor: binds toTenantId.DEFAULT,BootstrapMode.TRANSIENT_CONSOLEand the system clock.StoreBackedBootstrapStateService(BootstrapStateStore store, TenantId tenant, BootstrapMode mode, Clock clock) Full constructor. -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleanRecords the completion of the initial-admin bootstrap for the configured tenant at the current clock instant.mode()booleanreset()Removes any recorded completion for the configured tenant.state()Returns the persisted bootstrap state for the configured tenant.tenant()
-
Constructor Details
-
StoreBackedBootstrapStateService
Convenience constructor: binds toTenantId.DEFAULT,BootstrapMode.TRANSIENT_CONSOLEand the system clock.- Parameters:
store- backing bootstrap-state store; non-null
-
StoreBackedBootstrapStateService
public StoreBackedBootstrapStateService(BootstrapStateStore store, TenantId tenant, BootstrapMode mode, Clock clock) Full constructor.- Parameters:
store- backing bootstrap-state store; non-nulltenant- tenant scope;nullbecomesTenantId.DEFAULTmode- bootstrap mode; non-null. When set toBootstrapMode.DISABLED,bootstrapRequired()always returnsfalseclock- time source for the completion instant; non-null
-
-
Method Details
-
bootstrapRequired
public boolean bootstrapRequired()- Returns:
truewhen bootstrap is still required, i.e. the mode is notBootstrapMode.DISABLEDand no completion has been recorded for the configured tenant
-
hasAdministrator
public boolean hasAdministrator()- Returns:
truewhen a completion record exists for the configured tenant. Independent ofBootstrapMode
-
state
Returns the persisted bootstrap state for the configured tenant. Absent records are reported asrequired.- Returns:
- current state
-
markCompleted
Records the completion of the initial-admin bootstrap for the configured tenant at the current clock instant. Idempotent: already-completed states are kept as-is so the completion instant of the first transition is preserved.- Returns:
- the persisted state after the call
-
reset
public boolean reset()Removes any recorded completion for the configured tenant. Intended for tests and admin-tooling that need to "re-bootstrap" a tenant (e.g. recovery flows).- Returns:
truewhen a record was removed
-
mode
- Returns:
- the
BootstrapModethis service was configured with
-
tenant
-