6.2 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | |||
|---|---|---|---|---|---|---|---|
|
2026-04-16T11:43:16.787826+00:00 | zai-org/GLM-5-FP8 | 1 | 6317dc1ace913c30 |
Documentation: DTS.Common.Import.Parsers
1. Purpose
This module provides parsing infrastructure for importing data files into the system. It defines an abstract base class for parse variants (ParseVariantBase) and concrete implementations of the IParseImport interface (DefaultParseImport and DTSXMLParseImport) that orchestrate file parsing operations. The module acts as a bridge between raw import files and structured ImportObject instances, supporting both generic and XML-specific parsing workflows.
2. Public Interface
ParseVariantBase (Abstract Class)
Implements: IParseVariant
| Member | Signature | Description |
|---|---|---|
FileName |
public string FileName { get; set; } |
Property to store the name of the file being parsed. |
Parse |
public abstract void Parse(ref ImportObject importObject) |
Abstract method that derived classes must implement to perform parsing logic. Receives ImportObject by reference, allowing the object to be modified or replaced. |
DefaultParseImport (Class)
Implements: IParseImport
| Member | Signature | Description |
|---|---|---|
| Constructor | public DefaultParseImport(ImportObject importObject, IEnumerable<IParseVariant> parseVariants) |
Initializes the parser with an ImportObject instance and a collection of IParseVariant implementations. |
Parse |
public ImportObject Parse(IEnumerable<string> importFiles) |
Orchestrates parsing by creating an internal ParseProcessor with the configured variants and files. Returns the processed ImportObject. |
DTSXMLParseImport (Class)
Implements: IParseImport
| Member | Signature | Description |
|---|---|---|
| Constructor | public DTSXMLParseImport(ImportObject importObject, IImportNotification importNotification, Func<bool> isCancelled = null, bool skipNormalizing = false) |
Initializes the XML parser with an ImportObject, notification interface, optional cancellation callback, and optional flag to skip normalization. |
UIItems |
public List<IUIItems> UIItems { get; set; } |
Property for UI items configuration, passed to the internal XMLParseProcessor. |
Parse |
public ImportObject Parse(IEnumerable<string> importFiles) |
Creates an XMLParseProcessor, processes files, then calls AssignLinkedDASSerials to link pseudo-rack hardware. Returns the processed ImportObject. |
Private Methods:
| Method | Description |
|---|---|
AssignLinkedDASSerials(ref ImportObject importObject) |
Iterates over hardware objects, identifies pseudo-racks via IsPseudoRack(), and assigns LinkedDASSerials array to any pseudo-rack whose SerialNumber matches other hardware's ParentDAS value. |
3. Invariants
-
ParseVariantBase.Parse: The
ImportObjectparameter is passed by reference (ref), meaning implementations may modify or replace the object entirely. -
DefaultParseImport: The
_importObjectfield is reassigned after parsing viaparseProcesser.Process(). The same_parseVariantscollection provided at construction is used throughout the instance lifetime. -
DTSXMLParseImport:
_importNotificationis required (no null check visible in source)._isCancelledand_skipNormalizingare optional parameters with default values (nullandfalserespectively).AssignLinkedDASSerialsonly modifies hardware whereIsPseudoRack()returnstrueand matching child hardware exists.
-
Hardware Linking Logic: In
AssignLinkedDASSerials, linked serials are only assigned ifmatches.Any()returns true; otherwise,LinkedDASSerialsis left unchanged (not explicitly cleared).
4. Dependencies
This module depends on:
| Dependency | Used In |
|---|---|
DTS.Common.Import.Interfaces |
All three files (for IParseVariant, IParseImport, ImportObject, IImportNotification) |
DTS.Slice.Users |
DTSXMLParseImport.cs (for IUIItems) |
System.Collections.Generic |
DefaultParseImport.cs, DTSXMLParseImport.cs |
System.Linq |
DefaultParseImport.cs, DTSXMLParseImport.cs |
System.Threading.Tasks |
DefaultParseImport.cs |
System.Text |
DefaultParseImport.cs |
External types referenced (not defined in source):
| Type | Source File | Notes |
|---|---|---|
ImportObject |
All | Core data structure, defined elsewhere |
IParseVariant |
ParseVariantBase.cs |
Interface definition not shown |
IParseImport |
DefaultParseImport.cs, DTSXMLParseImport.cs |
Interface definition not shown |
ParseProcessor |
DefaultParseImport.cs |
Concrete class, definition not shown |
XMLParseProcessor |
DTSXMLParseImport.cs |
Concrete class, definition not shown |
IImportNotification |
DTSXMLParseImport.cs |
Interface definition not shown |
IUIItems |
DTSXMLParseImport.cs |
Interface definition not shown |
5. Gotchas
-
Namespace Inconsistency:
DTSXMLParseImport.csis in namespaceDTS.Common.Importwhile the other two files are inDTS.Common.Import.Parsers. This may cause confusion when locating classes. -
Unused Imports:
System.Threading.TasksandSystem.Textare imported inDefaultParseImport.csbut no async/await or text encoding operations are visible in the source. -
Field Reassignment: Both
DefaultParseImportandDTSXMLParseImportreassign their_importObjectfield duringParse(). If the same instance is used for multipleParse()calls, the originalImportObjectpassed to the constructor will be overwritten. -
Null Handling Not Visible: Neither class validates constructor parameters for null. Behavior with null
importObject,parseVariants, orimportNotificationis undefined from source alone. -
UIItems Property Injection:
DTSXMLParseImport.UIItemsmust be set before callingParse()if UI items are required byXMLParseProcessor. The property is not set in the constructor.