Adapter SDK

The OT Backup Adapter SDK is used to build custom sequence steps. A step is a small .NET class that can be added to a backup or restore sequence, for example to export a project, copy files, call a robot controller API, or restore data to a device.

This page is for integrators and adapter developers who need to extend OT Backup with custom functionality.

flowchart LR
  A[Adapter assembly] --> B[Step class]
  B --> C[Step attributes]
  B --> D[Parameters]
  B --> E[Execute]
  E --> F[Progress + Job log]
  E --> G[Outputs + Storage]
  B --> H[Sequence editor]

Where this fits in the application

Custom steps appear in the sequence editor, where users can add them to backup and restore sequences.

Concept Meaning
Adapter project A .NET class library containing one or more SDK step classes.
Step One unit of work in a backup or restore sequence.
Step parameter A value the user configures in the sequence editor.
Template step The step definition shown to users before it is added to a sequence.

For day-to-day sequence configuration, see Configuring Backup and Restore Sequences.


Access

This SDK documentation is part of the new Markdown documentation site under Docs. It is portable with the rest of the Documentation/ folder and replaces the old generated SDK documentation.

Action Policy Required claim
Open this SDK documentation from Docs None None

Creating a step

Every custom step should:

  1. Reference SDK/SDK.csproj or the published OT Backup SDK package.
  2. Inherit from StepBase.
  3. Add a [Step] attribute.
  4. Add one or more [StepParameter] attributes if the step needs user input.
  5. Implement Execute(CancellationToken cancellationToken).
  6. Report progress and useful job log messages.
  7. Return 0 when the step succeeds.
using OTBackup.Common.Entities;
using OTBackup.SDK;

[Step(
    Name = "Example Export",
    DisplayName = "Example Export",
    CompactDisplayName = "Export",
    Path = "Examples",
    Icon = "upload",
    Documentation = "Exports data from the target system.",
    Usage = StepUsage.Backup)]
[StepParameter(
    Name = "TargetPath",
    Type = StepParameterType.Target,
    DefaultValue = "",
    Description = "Where the export should be stored")]
public sealed class ExampleExportStep : StepBase
{
    public ExampleExportStep(StepSettings settings) : base(settings)
    {
    }

    public override async Task<int> Execute(CancellationToken cancellationToken)
    {
        Progress(0, "Starting export");

        string targetPath = GetParameterValue("TargetPath");
        Log($"Exporting to {targetPath}");

        await Task.Delay(1000, cancellationToken);

        Progress(100, "Export complete");
        SaveOutput("exportPath", targetPath);

        return 0;
    }
}

Step metadata

The [Step] attribute controls how the step appears in the sequence editor.

Property Purpose
Name Stable, unique step identity. It is persisted in sequences and used to find the step at runtime. Do not change it after release. It is planned to be renamed to Id in a future breaking release, after clients migrate to the new sequence format.
DisplayName Full human-readable label shown in the template list and sequence editor. It can change without affecting existing sequences.
CompactDisplayName Compact human-readable label used for steps in the hierarchy view. It is not an identifier and does not need to be unique.
Path Category path in the template step tree, for example Siemens/TIA Portal.
Icon MudBlazor icon name or SVG string shown in the UI.
Documentation Short help text shown from the Show documentation action in the sequence editor.
Ports Network requirements shown in the sequence editor.
Usage Where the step can be used: backup, restore, or both.

Use a clear Path so users can find the step. Use Documentation and Ports to help integrators understand what the step needs before a job runs.

Use a stable, descriptive Name such as Vendor Device Export, rather than a short action such as Export. DisplayName and CompactDisplayName are presentation metadata; they may be refined in later adapter versions.


Step parameters

Use [StepParameter] to define values users configure in the sequence editor.

Property Purpose
Name Stable parameter identity. It is used by GetParameterValue and persisted with the sequence, so do not rename it after release.
DisplayName Human-readable label shown in the sequence editor. It can change without affecting saved sequences.
DefaultValue Initial value when the step is added to a sequence.
Type How the parameter is rendered and resolved.
Options Semicolon-separated options for choice parameters.
ValidationRules Validation rules such as required and in:Full;Incremental. The in and notIn rules accept commas or semicolons as separators; individual values cannot contain either character.
Advanced Shows the parameter under Advanced parameters.
Description Short help text displayed beside the parameter.

Parameter types:

Type Use for
Text Plain text, paths, names, IDs or values.
Account Credentials selected from Configuration → Accounts.
Source A source file/folder/storage location.
Target A target file/folder/storage location.
Flag Boolean checkbox.
SingleChoice One selected option from a list.
MultiChoice One or more selected options from a list.
[StepParameter(
    Name = "Mode",
    Type = StepParameterType.SingleChoice,
    Options = "Full;Incremental",
    DefaultValue = "Full",
    Description = "Backup mode")]

Saved sequence compatibility

OT Backup stores only the configurable runtime state of a sequence: each step and parameter identity, the selected worker, parameter values, and parameter results. When a sequence is opened or run, OT Backup resolves that state against the current adapter definitions to supply display labels, types, options, descriptions, and validation rules.

This allows display metadata and defaults to evolve without changing existing sequences. Keep step and parameter Name values stable. If a parameter has been removed from an adapter definition, an existing saved value is preserved as a legacy parameter so it can be reviewed during migration.


Reading parameters at runtime

StepBase gives the step helper methods for reading configured values:

Method Use
GetParameterValue(name) Read a required parameter. Throws if the parameter is missing.
TryGetParameterValue(name, defaultValue) Read an optional parameter.
GetParameterResult(name, resultType) Read resolved data from complex parameters such as accounts or storage.
CreateNetworkCredentialsFromParameter(name) Create credentials from an Account parameter.
TryCreateNetworkCredentialsFromParameter(name) Create credentials only if an account was selected.
GetStorageValues(name) Read resolved storage path and credentials.
CreateStorageFromParameter(name) Create an IStorage instance from a Source/Target parameter.
CreateStorageFromPath(path, user, credential) Create file-system storage directly from a path and optional credentials.

Prefer the helper methods over parsing parameter values yourself.

Storage options

StorageConfig.Options is a System.Text.Json.Nodes.JsonObject for storage-specific settings. It defaults to an empty object; a null options value is normalized to an empty object. Each storage implementation defines the keys it understands; options are copied, including nested objects, when creating child storage instances.

FTP supports these string-valued options:

Key Values Default
ConnectionMode Active, Passive Active
TransferType Binary, ASCII Binary
{
    "Options": {
        "ConnectionMode": "Passive",
        "TransferType": "ASCII"
    }
}

The two FTP options are independent. Unsupported values fail when creating FTP storage. Other storage implementations currently preserve options without interpreting them.

Options replaces the previous StorageConfig.ConfigMode string. Custom adapters using that property must update their initializers and rebuild against the updated Common/SDK assemblies; legacy mode strings are not migrated.


Progress, logs and output

Use progress and logging so users can follow the job from the equipment details dialog and the Jobs page.

Method Purpose
Progress(percentage, message) Updates the visible job status.
Log(message) Adds a message to the job log.
Log(message, exception) Adds a message and exception details to the job log.
LogAndProgress(percentage, message) Logs and updates progress at the same time.
SaveOutput(key, value) Saves output values that later steps can use.

Guidelines:

  • Report meaningful milestones: start, major phases and completion.
  • Pass the CancellationToken to long-running or async operations.
  • Avoid logging secrets, passwords, tokens or sensitive file contents.
  • Throw or return an error instead of hiding failures.

Revert behavior

Override Revert(CancellationToken cancellationToken) if the step can safely undo its work after a later step fails.

public override Task Revert(CancellationToken cancellationToken)
{
    Log("Reverting exported files");
    return Task.CompletedTask;
}

If reverting fails, throw an exception so the job result shows what happened.


Storage and Backup Storage

Source and Target parameters can use the application's configured Backup Storage. When a parameter uses Backup Storage, CreateStorageFromParameter creates storage using the configured type/path/account. Otherwise it creates file-system storage from the parameter path.

This lets adapter steps work with backup storage without needing to know whether the installation uses a local path, network share or another supported storage type.

See also:


Packaging and discovery

In this repository, adapter projects follow the naming convention Adapters.[Vendor].[Name] and are placed under Adapters/.

At runtime, TEE loads adapter assemblies from its Adapters/ output folder and discovers classes decorated with [Step] that inherit from StepBase.

For an adapter to be available to users:

  1. Build or publish the adapter assembly.
  2. Make sure the DLL is placed in the TEE Adapters/ folder.
  3. Restart or reload the TEE process as required by the installation.
  4. Open the sequence editor and confirm the step appears under its configured Path.

Before handing a custom step to users:

  • The class inherits from StepBase.
  • The class has a clear [Step] attribute.
  • Parameters have useful names, defaults and descriptions.
  • Advanced-only settings are marked with Advanced = true.
  • The step reports progress and writes useful job log entries.
  • Long-running work respects the CancellationToken.
  • Required network ports are declared in Ports.
  • Secrets are not logged.
  • The step has been tested in a real backup/restore sequence.

See Also

An error has occurred. This app may no longer respond until reloaded. Reload 🗙