Interface ModelAdapter
- All Known Implementing Classes:
GitConfigAdapter, MavenSettingsAdapter, PomModelAdapter
public interface ModelAdapter
Plan-time adapter for a single model-managed file type.
Where TierHandler operates on raw bytes and hashes,
ModelAdapter understands the structure of its file
— Maven settings.xml, POMs, git config — and plans
per-element changes. The adapter knows how to:
- parse the current content (or build an empty document);
- consult
ManifestEntry.extras()forensure/never-touchdirectives specific to this model; - compute an updated document and return it as
TierAction.Writebytes, together with the list ofManagedElemententries the lockfile should record; - or return
TierAction.UpToDate/TierAction.Skipwhen no change is needed or the user has diverged from a previously-installed element.
Adapters are pure — they must not touch disk.
-
Method Summary
Modifier and TypeMethodDescriptionModel name this adapter handles, matchingManifestEntry.model()(e.g.plan(ManifestEntry entry, Path resolvedDest, byte[] currentContent, LockfileEntry priorEntry, String currentStandardsVersion) Plan a single model-managed entry.
-
Method Details
-
modelName
String modelName()Model name this adapter handles, matchingManifestEntry.model()(e.g."maven-settings-4").- Returns:
- the model name; never
null
-
plan
ModelPlanResult plan(ManifestEntry entry, Path resolvedDest, byte[] currentContent, LockfileEntry priorEntry, String currentStandardsVersion) Plan a single model-managed entry.- Parameters:
entry- the manifest entry; must haveScaffoldTier.MODEL_MANAGEDtier andmodel()equal tomodelName()resolvedDest- absolute destination path (placeholders already expanded)currentContent- bytes currently on disk atresolvedDest, ornullif no file existspriorEntry- lockfile entry from the last publish, ornullif never appliedcurrentStandardsVersion- thestandards-versionof the current manifest; stamped on newly-installed elements so drift can be reasoned about later- Returns:
- a
ModelPlanResultwith both aTierActionand the element-level provenance for the lockfile - Throws:
ScaffoldException- if the document cannot be parsed or the ensure-rules are malformed
-