Class ScaffoldApplier
ScaffoldPlan: write out Write-actions to disk and
compose the updated ScaffoldLockfile.
Write actions are executed in order; the applier carefully
creates parent directories and uses
StandardCopyOption.REPLACE_EXISTING so existing files are
atomically replaced.
TierAction.Skip actions are recorded in the returned
lockfile as-is (the existing entry stays put). TierAction.UpToDate
and TierAction.UserManaged actions refresh the
standards-version on model-managed elements but are
otherwise no-ops.
-
Constructor Summary
ConstructorsConstructorDescriptionConstruct withClock.systemUTC().ScaffoldApplier(Clock clock) Construct with an explicit clock. -
Method Summary
Modifier and TypeMethodDescriptionapply(ScaffoldPlan plan, ScaffoldLockfile currentLockfile) Carry out a plan.removeOrphans(List<OrphanEntry> orphans, ScaffoldLockfile lockfile) Remove orphaned scaffold files and drop their lockfile entries.
-
Constructor Details
-
ScaffoldApplier
public ScaffoldApplier()Construct withClock.systemUTC(). -
ScaffoldApplier
Construct with an explicit clock. Tests supply a fixed clock so thegenerated-attimestamp recorded in the updated lockfile is deterministic.- Parameters:
clock- clock used for timestamps written into the lockfile
-
-
Method Details
-
apply
Carry out a plan.- Parameters:
plan- the plan to executecurrentLockfile- the current lockfile (so entries outside the plan's scope are preserved verbatim)- Returns:
- the updated lockfile
- Throws:
ScaffoldException- if any Write fails
-
removeOrphans
Remove orphaned scaffold files and drop their lockfile entries.Run after
apply(ScaffoldPlan, ScaffoldLockfile)on the lockfile thatapplyreturned. For eachOrphanEntry.Disposition.REMOVEorphan the on-disk file is deleted; forREMOVEandOrphanEntry.Disposition.ALREADY_ABSENTorphans the stale lockfile entry is dropped.OrphanEntry.Disposition.SKIP_USER_EDITEDorphans are left entirely alone — file and lockfile entry both stay, so the orphan keeps surfacing until the operator resolves it.- Parameters:
orphans- orphans found byOrphanScannerlockfile- the lockfile to prune (typically the result ofapply(ScaffoldPlan, ScaffoldLockfile))- Returns:
- the lockfile with removed/absent orphan entries dropped
- Throws:
ScaffoldException- if a file deletion fails
-