Class AdapterBase
- Namespace
- Dynamicweb.DataIntegration.Integration.Adapters
- Assembly
- Dynamicweb.DataIntegration.dll
public abstract class AdapterBase : ConfigurableAddIn, ISource, ISourceReader, IDisposable, INotSource
- Inheritance
-
AdapterBase
- Implements
- Derived
- Inherited Members
- Extension Methods
Constructors
AdapterBase()
public AdapterBase()
AdapterBase(XmlNode)
public AdapterBase(XmlNode xmlNode)
Parameters
xmlNodeXmlNode
Fields
CurrentMapping
protected Mapping? CurrentMapping
Field Value
Name
public string? Name
Field Value
OutputTables
public Dictionary<Table, List<Dictionary<string, object>>> OutputTables
Field Value
source
public ISource? source
Field Value
Properties
FilesFolderName
The name of the Files folder in the current installation of Dynamicweb. Empty when used for tests. Implementations may use this value to resolve resource locations inside the product installation.
public string FilesFolderName { get; set; }
Property Value
Logger
Optional logger instance. Implementations should use this for consistent logging.
public ILogger? Logger { get; set; }
Property Value
OutputSchema
public virtual Schema? OutputSchema { get; }
Property Value
WorkingDirectory
Gets or sets the working directory. When used for testing, all relative paths for standard providers are resolved against this path.
public string WorkingDirectory { get; set; }
Property Value
- string
Base path for resolving relative file paths during tests or runtime.
Methods
CheckCondition(MappingConditional, Dictionary<string, object>)
Evaluate a mapping conditional against a data row.
public virtual bool CheckCondition(MappingConditional mc, Dictionary<string, object> row)
Parameters
mcMappingConditionalMapping conditional to evaluate.
rowDictionary<string, object>Row values keyed by column name.
Returns
- bool
True if the conditional is satisfied for the given row; otherwise false.
CheckMapping(Mapping)
Validate the provided mapping against this source's schema and capabilities.
public virtual List<SchemaComparerResult> CheckMapping(Mapping map)
Parameters
mapMappingMapping to validate.
Returns
- List<SchemaComparerResult>
Collection of SchemaComparerResult describing issues or an empty list if valid.
Close()
Close the provider and release resources (connections, file handles, etc.). Should be safe to call multiple times (idempotent).
public virtual void Close()
CreateParameterNode(Type, string, string)
protected XElement? CreateParameterNode(Type type, string name, string value)
Parameters
Returns
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
GetId()
Return a stable identifier for this provider instance when available. Used by JobSchemaService to persist per-provider schema files.
public string? GetId()
Returns
GetNext()
Gets the next line.
public virtual Dictionary<string, object> GetNext()
Returns
GetNext(Mapping)
public virtual Dictionary<string, object> GetNext(Mapping mapping)
Parameters
mappingMapping
Returns
GetNextInput(Mapping?)
protected Dictionary<string, object> GetNextInput(Mapping? mapping)
Parameters
mappingMapping
Returns
GetOriginalSourceSchema()
Fetch the most recent schema directly from the source (unmodified, live).
This should return a fresh representation of the source structure and may perform expensive I/O. Use it when you explicitly need the authoritative source schema regardless of any cached/persisted schema.
public virtual Schema GetOriginalSourceSchema()
Returns
GetReader(Mapping)
Create and return an ISourceReader for the provided mapping.
The returned reader must be initialized and ready to enumerate rows for the mapping. Implementations are responsible for any resource allocation; callers will close the reader.
public ISourceReader GetReader(Mapping mapping)
Parameters
mappingMappingMapping that configures what/how to read.
Returns
- ISourceReader
An ISourceReader instance.
GetSchema()
Return the live Schema (tables + columns) for this source.
Implementer guidance:
- Return a thread-safe, non-mutating Schema instance (or a defensive copy).
- Prefer cached or lightweight responses to avoid repeated expensive I/O.
- This method should reflect the source structure at the time of the call.
Note: schema access is centralized via GetSchema(ISource?). That service consults the SchemaManagementFeature and may use a persisted schema instead of invoking this method. Call this directly only when you need the live schema.
public virtual Schema GetSchema()
Returns
Initialize()
Initialize the provider. Open transient resources (connections) required for operation.
Avoid heavy or long-running operations here when possible; prefer lazy initialization where appropriate.
public virtual void Initialize()
IsDone()
Determines whether this instance is done reading from the source.
public virtual bool IsDone()
Returns
- bool
trueif this instance is done; otherwise,false.
IsDone(Mapping)
public virtual bool IsDone(Mapping mapping)
Parameters
mappingMapping
Returns
IsDoneInput(Mapping)
protected bool IsDoneInput(Mapping mapping)
Parameters
mappingMapping
Returns
LoadSettings(Job)
Apply runtime settings from the job prior to execution.
Called when a job runs and allows the provider to adjust settings from the job context before any reading/writing occurs.
public virtual void LoadSettings(Job job)
Parameters
jobJobJob containing runtime settings and context.
OverwriteSourceSchemaToOriginal()
Replace the provider's current/cached schema with the latest schema from the source.
Implementations should update any internal schema cache/state so subsequent calls to GetSchema() reflect the original schema returned by GetOriginalSourceSchema().
public virtual void OverwriteSourceSchemaToOriginal()
SaveAsXml(XmlTextWriter)
Persist provider settings to the supplied System.Xml.XmlTextWriter.
Implementations should write their configuration elements but must not close or dispose the writer.
public virtual void SaveAsXml(XmlTextWriter textWriter)
Parameters
textWriterXmlTextWriterXml writer to write settings into.
Serialize()
Serialize provider settings for use by AddinSelectors.
Output must be of the format <xxx>yyy</xxx>, where xxx is the parameter name (as defined by the decoration) and yyy is the value.
public virtual string Serialize()
Returns
- string
XML fragment describing configured addin parameters.
UpdateSourceSettings(ISource)
Update this instance's settings to match the provided source.
Used to copy settings between provider instances (for example when restoring from saved configuration).
public virtual void UpdateSourceSettings(ISource source)
Parameters
sourceISourceSource instance to copy settings from.
ValidateSourceSettings()
Validate the source configuration.
Return an empty string for a valid configuration; otherwise return a human-readable error/validation message describing the problem.
public virtual string ValidateSourceSettings()
Returns
- string
Empty string if valid; otherwise a validation error message.