MineTrustConnectorSDK.Extensibility

.NET extensibility API which provides support for extending and customising the MineTrust Connector Service.

Overview

The MineTrust Connector component is designed to be extensible, so that data operations can be customised to suit customers' specific needs. MineTrust Connector leverages the Datamine.Extensibility.Common framework in order to provide a pluggable architecture.

Installation

The MineTrustConnector Extensibility SDK for .NET is distributed by Datamine Software Ltd as a NuGet package. Please contact your local Datamine representative in order to obtain access.

Writing an Extension

Upon startup, MineTrust Connector searches its working directory for .NET assemblies that are decorated with the ExtensionAssemblyAttribute attribute.

The main extensibility points of MineTrust Connector are located within the MineTrustConnectorSDK.Extensibility component. Therefore, the first step in writing an extension module must be to install this package:

Install-Package MineTrustConnectorSDK.Extensibility

Then decorate the assembly with the ExtensionAssemblyAttribute attribute:

AssemblyInfo.cs

using Datamine.Extensibility.Common;
[assembly: ExtensionAssembly]

Customisable Components

There are two main flavours of customisation which are available within MineTrust Connector. First is the 'standard' customisation of the startup sequence of the service, which is supported natively by the Datamine.Extensibility.Common framework. One simply implements the ConfigureServices method on the IExtension interface, which is then called during startup:

Startup.cs

using Datamine.Extensibility.Common;
...

public class Startup : IExtension
{
    public void ConfigureServices(HostBuilderContext context, IServiceCollection services)
    {
        ... startup logic here ...
    }
}

The second flavour of extension is via inheritance of the base classes that are provided directly within the Datamine.MineTrustConnector.Service.Extensibility namespace.

An example of such an implementation may look as follows:

CustomFileTaggingService.cs

using Datamine.MineTrustConnector.Service.Extensibility;
using Datamine.MineTrustConnector.Service.Extensibility.Abstractions;
...

public class CustomFileTaggingService(IMineTrustClientFactory clientFactory, IRemoteFolderSystem remoteFolderSystem, ILogger<FileTaggingService> logger) : FileTaggingService(clientFactory, remoteFolderSystem, logger)
{
    protected override IDictionary<string, string>? ResolveTags(PackageConfiguration packageConfiguration, string maybeRelativePath)
    {
        var result = base.ResolveTags(packageConfiguration, maybeRelativePath) ?? new Dictionary<string, string>();

        // Simple example just adds the length of the file name as a tag
        result["FileNameLength"] = maybeRelativePath.Length;

        return result;
    }
}

Custom component implementations may be enabled for execution against specific files during MineTrust Connector's execution cycle by registering their namespace-qualified type names within the Package Configuration:

mypackage.json

{
  "Enabled": true,
  "DisplayName": "MyPackage",
  ...
  "Include": [
    {
      "File": "**/*.txt",
      "Extensions": [
        "MyExtensionLibrary.CustomFileTaggingService"
      ]
    }
  ],
  ...
}

Change Log

1.6.x

Package configuration schema extended to support File arrays (breaking change to SDK class)

1.5.x

Includes functionality to query the local tag cache directly via the Connector SDK Additional dependency on SQLite in order to effect this Introduced ITagManager mechanism to extensibility SDK

1.4.x

Breaking change to tag processing to allow tags to be more 'flexible' (SDATA-131)

1.3.x

Target framework consolidation

1.2.x

BREAKING CHANGE: Replaced FileSystemService interface with async-enabled counterpart

1.1.x

Added native .NET 6.0 support

1.0.x

Baseline version of 'Production' MineTrust Connector SDK