5.3 KiB
5.3 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | |||
|---|---|---|---|---|---|---|---|
|
2026-04-16T02:06:24.270866+00:00 | Qwen/Qwen3-Coder-Next-FP8 | 1 | 6317dc1ace913c30 |
Parsers
Documentation: Import Parsing Module
1. Purpose
This module provides foundational infrastructure and concrete implementations for parsing import files into a structured ImportObject. It defines an extensible parsing pipeline via the IParseImport interface, with base abstractions (ParseVariantBase) for variant-specific parsing logic and two concrete import processors: DefaultParseImport (generic, variant-driven parsing) and DTSXMLParseImport (XML-specific parsing with UI integration, cancellation support, and post-processing for DAS-linked hardware). The module serves as the core engine for transforming raw file inputs into domain objects used throughout the DTS import workflow.
2. Public Interface
ParseVariantBase (abstract class)
string FileName { get; set; }
Gets or sets the name of the file being parsed by this variant. Set by the caller beforeParseis invoked.abstract void Parse(ref ImportObject importObject)
Parses the file (identified byFileName) and mutates the providedImportObjectby adding or updating its contents. Must be implemented by derived classes.
DefaultParseImport (concrete class)
DefaultParseImport(ImportObject importObject, IEnumerable<IParseVariant> parseVariants)
Constructor. Initializes the parser with a targetImportObjectand a sequence ofIParseVariantimplementations to apply.ImportObject Parse(IEnumerable<string> importFiles)
Processes each file inimportFilesusing the configuredIParseVariants via aParseProcessor. Returns the mutated_importObject.
Note: The sameImportObjectinstance passed to the constructor is returned (though mutated internally).
DTSXMLParseImport (concrete class)
DTSXMLParseImport(ImportObject importObject, IImportNotification importNotification, Func<bool> isCancelled = null, bool skipNormalizing = false)
Constructor. Initializes the XML parser with a targetImportObject, notification sink, optional cancellation delegate, and flag to skip normalization.List<IUIItems> UIItems { get; set; }
Gets or sets UI-related items (e.g., progress indicators, messages) to be used by the underlying processor.ImportObject Parse(IEnumerable<string> importFiles)
Processes XML files viaXMLParseProcessor, applies post-processing (AssignLinkedDASSerials), and returns the mutated_importObject.
Note:UIItemsis assigned to the processor before processing.
AssignLinkedDASSerials (private method in DTSXMLParseImport)
void AssignLinkedDASSerials(ref ImportObject importObject)
Post-processesimportObject.Hardware()to populateLinkedDASSerialsfor pseudo-rack hardware: for each pseudo-rack (IsPseudoRack() == true), collects all hardware items whoseParentDASmatches the rack’sSerialNumber, and stores their serials inLinkedDASSerials.
3. Invariants
ParseVariantBase.Parsemust mutateimportObjectin-place (viaref), not replace it.FileNamemust be set on eachIParseVariantinstance before callingParse(ref ImportObject)(enforced by caller, not by class).DTSXMLParseImport.Parsealways callsAssignLinkedDASSerialsafter processing, ensuringLinkedDASSerialsis populated for pseudo-rack hardware.DefaultParseImportdoes not modify theimportFilessequence; it only iterates over it.DTSXMLParseImportsupports cancellation via the_isCancelleddelegate (behavior depends onXMLParseProcessorimplementation, not visible here).
4. Dependencies
- Depends on:
DTS.Common.Import.Interfacesnamespace (IParseImport,IParseVariant,IImportNotification,IUIItems).DTS.Slice.Usersnamespace (forIImportNotification,IUIItems).ImportObjecttype (used throughout; definition not provided here).- Internal types:
ParseProcessor,XMLParseProcessor(referenced but not documented here).
- Depended on by:
- Unknown from source alone. Likely consumed by higher-level import orchestration (e.g., UI layers, batch import services).
5. Gotchas
DefaultParseImportreuses the sameImportObjectinstance passed to its constructor; callers must be aware that the returned object is the same reference, not a copy.DTSXMLParseImport.AssignLinkedDASSerialsonly processes hardware whereIsPseudoRack()returnstrue; non-rack hardware is skipped.DTSXMLParseImportdoes not validateimportFilesfor XML format—assumes correctness (handled byXMLParseProcessor).UIItemsmust be set onDTSXMLParseImportbefore callingParseto be effective (assigned to processor insideParse).skipNormalizingflag behavior is not visible in this module—depends onXMLParseProcessorimplementation.AssignLinkedDASSerialsuses LINQ query materialization (as string[] ?? matches.ToArray()) but does not guard against nullHardware()—potentialNullReferenceExceptionifimportObject.Hardware()returnsnull.