WireModel
Orchestrates model wireup: builds reference-name and ownership back-references across the entity registry of the current ModelScope maintained by MetamodelEntity.
Call reset at the start of each stigCheckModel invocation (to drop entities from a previous Gradle-daemon run), then wireAll once entities have been constructed (typically after class-loading) and before any rule that consults referenceName or owner* fields.
Both methods operate on whichever scope is current on the calling thread — usually the process-global default scope, but a live-source materializer (e.g. the IDEA plugin) can isolate its work in a per-file scope via ModelScope.with { … }.
Wireup proceeds in three phases:
Kt-facade sweep. For each distinct declaring class observed in the registry, walks its
staticMetamodelEntity-typed fields and stampsentity.referenceName = field.name. This captures the Kotlin variable name for top-levelvals (which compile to static fields on the file-facade class) and for Kotlinobjectmembers. Source-materialized entities have no captured declaring class and are skipped here — theirreferenceNamemust be set directly via MetamodelEntity.bindToSource before wireAll is called.Declared-child sweep. Walks model fields declared by consumer subclasses and binds their Kotlin property names and owning classes. This covers context/interface trees such as service members and method parameters in addition to the work-product containers. A follow-up pass then handles
Port/TopicPortspecifically: their inherited relation fields sit inside this package, so the generic walk does not discoverserviceInterface/topic— the follow-up pass builds a compound reference from each port's own (by-then-resolved) name instead.Container sweep. Walks every registered container (
Analysis,InterfacePointAnalysis,Requirements,Tests) and callswireChildren(), which stamps bothreferenceNameand the appropriateowner*back-reference on the container's declared children. Runs last so that a container's property name overrides the top-level binding name when an entity is aliased to both.
Functions
Infers the shared Viewpoint from a fully-qualified class name, based on package-name conventions used by STIG models: *.context.* / *.requirements.* / *.design.* / *.analysis.* / *.tests.*. Returns null for class names that don't match any convention (most library and JVM classes).
Clears the current ModelScope's entity registry. In the compiled / Gradle / CLI path this is the process-global default scope (ModelScope.global). The IDE plugin typically isolates its work with ModelScope.with(…) and lets the scope be GC'd rather than calling this directly.