MineTrustConnectorSDK.CPP
MTConnectorSDK Namespace Reference

Classes

struct  IncludeConfiguration
struct  PackageConfiguration
struct  PackageMetrics
struct  PackageFileChange
struct  ConfigSchemaItem
struct  ConfigSchema
struct  LocalTagRecord
struct  LocalFileRecord
struct  MTConnectorEvent
struct  ServerRegistration
struct  PackageSummary

Typedefs

using RegistrationWrapper = std::unique_ptr<RegistrationWrapperImpl, void(*)(RegistrationWrapperImpl*)>

Enumerations

enum class  LogEvent {
  AllFilesUpToDate = 1000 , SyncStarted = 1001 , SyncCompleted = 1002 , ReplicationStarted = 1003 ,
  ReplicationComplete = 1004 , VersionLocked = 1005 , PackageDisabled = 1006 , ProcessOwnedLockRemoved = 1007 ,
  PackageVersionCreated = 1008 , PackageDeleted = 1009 , PackageArchived = 1010 , PackageRestored = 1011 ,
  FileUploaded = 1100 , FileDownloaded = 1101 , FileUpdatedLocally = 1102 , FileUpdatedOnServer = 1103 ,
  FileRemovedOnServer = 1104 , FileReplicated = 1105 , FileDiscarded = 1106 , FileCheckedOut = 1107 ,
  FileCheckedIn = 1108 , FileUncheckedOut = 1109 , FileChangesDiscarded = 1110 , FileVersionsCleanedUp = 1111 ,
  FileUploadInProgress = 1112 , FileDownloadInProgress = 1113 , PreparingFileUpload = 1114 , FileNoLongerExists = 1115 ,
  FileCheckedOutElsewhere = 1116 , Initialising = 2000 , ConnectionEstablished = 2001 , ConnectionLost = 2002 ,
  GracefulShutdown = 2003 , ServiceError = 2004 , ServerRegistered = 2005 , AccessTokenSuccess = 2006 ,
  PackageEnabled = 2007 , ServiceUIDMismatch = 2008 , PackageAutoEnableUndetermined = 2009 , ClientCompatibilityError = 2010 ,
  PackagePreviouslyDeleted = 2011 , SSLErrorDetected = 2012 , GeneralSyncError = 4000 , GeneralReplicationError = 4001 ,
  Unauthorized = 4002 , PackageConfigurationNotFound = 4003 , AccessTokenRequired = 4004 , ServerRegistrationFailed = 4005 ,
  LockPackageFailed = 4006 , UnlockPackageFailed = 4007 , EnablePackageFailed = 4008 , UpdateLocalFailed = 4009 ,
  UpdateServerFailed = 4010 , PackageValidationFailed = 4011 , FileConflict = 4012 , CreateVersionFailed = 4013 ,
  PackageDeletionFailed = 4014 , PrintDiagnosticsFailed = 4015 , AccessForbidden = 4016 , PackageAccessDenied = 4017
}
enum class  PackageFileChangeType { Added = 0 , Modified = 1 , Deleted = 2 }
enum class  RegisterServerResultCodes { Success = 0 , ServerAlreadyRegistered = 1 , GeneralError = 2 , IncompatibleClient = 3 }
enum class  EnablePackageResultCodes {
  Success = 0 , PackageConfigurationNotFound = 1 , PackageAlreadyEnabled = 2 , PackagePreviouslyDeleted = 3 ,
  ServerURLNotValid = 4 , InsufficientPermissions = 5 , GeneralError = 6 , IncompatibleClient = 7
}
enum class  CreateVersionResultCodes {
  Success = 0 , PackageConfigurationNotFound = 1 , InsufficientPermissions = 2 , GeneralError = 3 ,
  IncompatibleClient = 4
}
enum class  LockPackageResultCodes {
  Success = 0 , PackageConfigurationNotFound = 1 , PackageAlreadyLocked = 2 , FilesCheckedOutElsewhere = 3 ,
  ProcessNotFound = 4 , PackageNotEnabled = 5 , PackageProcessing = 6 , InsufficientPermissions = 7 ,
  GeneralError = 8 , IncompatibleClient = 9
}
enum class  UnlockPackageResultCodes {
  Success = 0 , PackageConfigurationNotFound = 1 , PackageNotLocked = 2 , GeneralError = 3 ,
  IncompatibleClient = 4
}
enum class  SyncNowResultCodes {
  Success = 0 , PackageConfigurationNotFound = 1 , PackageNotEnabled = 2 , PackageLocked = 3 ,
  GeneralError = 4 , IncompatibleClient = 5
}
enum class  UpdateServerResultCodes {
  Success = 0 , PackageConfigurationNotFound = 1 , LocalFileNotFound = 2 , ServerFileNotFound = 3 ,
  ServerFileCheckedOut = 4 , GeneralError = 5 , IncompatibleClient = 6
}
enum class  UpdateLocalResultCodes {
  Success = 0 , PackageConfigurationNotFound = 1 , LocalFileNotFound = 2 , ServerFileNotFound = 3 ,
  GeneralError = 4 , IncompatibleClient = 5
}
enum class  PrintDiagnosticsResultCodes { Success = 0 , GeneralError = 1 , IncompatibleClient = 2 }

Functions

MT_CONNECTOR_EXPORT bool LoadPackageConfiguration (const std::string &packageUID, PackageConfiguration &instance)
MT_CONNECTOR_EXPORT bool SavePackageConfiguration (const PackageConfiguration &instance)
MT_CONNECTOR_EXPORT RegisterServerResultCodes RegisterServer (const std::string &serverURL, bool showUI=false)
MT_CONNECTOR_EXPORT concurrency::task< RegisterServerResultCodes > RegisterServerTask (const std::string &serverURL, bool showUI=false, concurrency::cancellation_token cancel=concurrency::cancellation_token::none())
MT_CONNECTOR_EXPORT EnablePackageResultCodes EnablePackage (const std::string &packageUID, const std::string &localRoot="", const std::string &serverURL="", bool showUI=false)
MT_CONNECTOR_EXPORT concurrency::task< EnablePackageResultCodes > EnablePackageTask (const std::string &packageUID, const std::string &localRoot="", const std::string &serverURL="", bool showUI=false, concurrency::cancellation_token cancel=concurrency::cancellation_token::none())
MT_CONNECTOR_EXPORT CreateVersionResultCodes CreateVersion (const std::string &packageUID, const std::string &comment="", bool showUI=false)
MT_CONNECTOR_EXPORT concurrency::task< CreateVersionResultCodes > CreateVersionTask (const std::string &packageUID, const std::string &comment="", bool showUI=false, concurrency::cancellation_token cancel=concurrency::cancellation_token::none())
MT_CONNECTOR_EXPORT LockPackageResultCodes LockPackage (const std::string &packageUID, const int &ownerProcess=0, bool showUI=false)
MT_CONNECTOR_EXPORT concurrency::task< LockPackageResultCodes > LockPackageTask (const std::string &packageUID, const int &ownerProcess=0, bool showUI=false, concurrency::cancellation_token cancel=concurrency::cancellation_token::none())
MT_CONNECTOR_EXPORT UnlockPackageResultCodes UnlockPackage (const std::string &packageUID, bool discardChanges=false, bool showUI=false)
MT_CONNECTOR_EXPORT concurrency::task< UnlockPackageResultCodes > UnlockPackageTask (const std::string &packageUID, bool discardChanges=false, bool showUI=false, concurrency::cancellation_token cancel=concurrency::cancellation_token::none())
MT_CONNECTOR_EXPORT SyncNowResultCodes SyncNow (const std::string &packageUID, bool showUI=false)
MT_CONNECTOR_EXPORT concurrency::task< SyncNowResultCodes > SyncNowTask (const std::string &packageUID, bool showUI=false, concurrency::cancellation_token cancel=concurrency::cancellation_token::none())
MT_CONNECTOR_EXPORT UpdateServerResultCodes UpdateServer (const std::string &packageUID, const std::string &filePath, bool showUI=false)
MT_CONNECTOR_EXPORT concurrency::task< UpdateServerResultCodes > UpdateServerTask (const std::string &packageUID, const std::string &filePath, bool showUI=false, concurrency::cancellation_token cancel=concurrency::cancellation_token::none())
MT_CONNECTOR_EXPORT UpdateLocalResultCodes UpdateLocal (const std::string &packageUID, const std::string &filePath, bool showUI=false)
MT_CONNECTOR_EXPORT concurrency::task< UpdateLocalResultCodes > UpdateLocalTask (const std::string &packageUID, const std::string &filePath, bool showUI=false, concurrency::cancellation_token cancel=concurrency::cancellation_token::none())
MT_CONNECTOR_EXPORT PrintDiagnosticsResultCodes PrintDiagnostics (bool showUI=false)
MT_CONNECTOR_EXPORT concurrency::task< PrintDiagnosticsResultCodes > PrintDiagnosticsTask (bool showUI=false, concurrency::cancellation_token cancel=concurrency::cancellation_token::none())
MT_CONNECTOR_EXPORT std::vector< std::string > ListServerURLs ()
MT_CONNECTOR_EXPORT std::vector< ServerRegistration > ListServerRegistrations ()
MT_CONNECTOR_EXPORT bool GetServerRegistrationForServerURL (const std::string &serverUrl, ServerRegistration &instance)
MT_CONNECTOR_EXPORT bool GetServerRegistrationForServiceUID (const std::string &serviceUID, ServerRegistration &instance)
MT_CONNECTOR_EXPORT std::vector< PackageSummary > GetAvailablePackages (const ServerRegistration &registration)
MT_CONNECTOR_EXPORT std::vector< PackageConfiguration > ListServerConfigurations ()
MT_CONNECTOR_EXPORT std::vector< PackageConfiguration > ListPackageConfigurations ()
MT_CONNECTOR_EXPORT std::vector< PackageConfiguration > FindPackageConfigurations (const std::string &jsonPath, const std::string &testValue, bool negate=false)
MT_CONNECTOR_EXPORT std::vector< LocalTagRecord > FindTags (const std::string &tagNameFilter="", const std::string &tagValueFilter="", const std::string &serviceUID="", bool fuzzyMatch=false)
MT_CONNECTOR_EXPORT std::vector< LocalFileRecord > FindFiles (const std::string &tagName, const std::string &tagValue, const std::string &serviceUID="", bool fuzzyMatch=false)
MT_CONNECTOR_EXPORT std::vector< LocalFileRecord > FindFiles (const std::unordered_map< std::string, std::string > &tagCriteria, const std::string &serviceUID="", bool fuzzyMatch=false)
MT_CONNECTOR_EXPORT std::vector< LocalFileRecord > FindFiles (const std::string &tagName, const std::string &tagValue, const std::string &fileNamePattern, const std::string &serviceUID="", bool fuzzyMatch=false)
MT_CONNECTOR_EXPORT std::vector< LocalFileRecord > FindFiles (const std::unordered_map< std::string, std::string > &tagCriteria, const std::string &fileNamePattern, const std::string &serviceUID="", bool fuzzyMatch=false)
MT_CONNECTOR_EXPORT std::vector< LocalFileRecord > EvaluateFilter (const std::string &filter, const std::string &packageUID="", const std::string &serviceUID="")
MT_CONNECTOR_EXPORT std::vector< std::string > GetAccessiblePackages (const std::string &serviceUID="")
MT_CONNECTOR_EXPORT std::vector< std::string > GetInaccessiblePackages (const std::string &serviceUID="")
MT_CONNECTOR_EXPORT std::vector< std::string > GetDeletedPackages (const std::string &serviceUID="")
MT_CONNECTOR_EXPORT std::vector< std::string > GetArchivedPackages (const std::string &serviceUID="")
MT_CONNECTOR_EXPORT PackageMetrics LoadPackageMetrics (const std::string &packageUID, const std::string &serviceUID="")
MT_CONNECTOR_EXPORT std::unique_ptr< std::vector< PackageFileChange > > GetPackageChanges (const std::string &packageUID)
MT_CONNECTOR_EXPORT ConfigSchema LoadConfigSchema (const std::string &root)
MT_CONNECTOR_EXPORT std::vector< std::string > GetPermittedValues (const std::string &configPath)
MT_CONNECTOR_EXPORT bool IsMineTrustConnectorInstalled ()
MT_CONNECTOR_EXPORT bool IsMineTrustConnectorRunning ()
MT_CONNECTOR_EXPORT RegistrationWrapper RegisterEvents (std::function< void(const MTConnectorEvent &)> callback, const std::list< LogEvent > &eventIDs={})
MT_CONNECTOR_EXPORT std::vector< std::string > EnumerateLocalContents (const std::string &packageUID)
MT_CONNECTOR_EXPORT std::vector< std::string > EnumerateLocalFilesByTag (const std::string &packageUID, const std::string &tagName, const std::string &tagValue)
MT_CONNECTOR_EXPORT bool IsInScope (const std::string &packageUID, const std::string &localFilePath)
MT_CONNECTOR_EXPORT void IncludeInPackage (PackageConfiguration &instance, const std::string &localFilePath, std::function< void(IncludeConfiguration &)> configureInclusion)
MT_CONNECTOR_EXPORT void ExcludeFromPackage (PackageConfiguration &instance, const std::string &localFilePath)
MT_CONNECTOR_EXPORT void TagFile (PackageConfiguration &instance, const std::string &localFilePath, const std::string &tagName, const std::string &tagValue)
MT_CONNECTOR_EXPORT void RemoveTag (PackageConfiguration &instance, const std::string &localFilePath, const std::string &tagName)
MT_CONNECTOR_EXPORT concurrency::task< void > ReceiveFiles (const std::vector< LocalFileRecord > &selection, std::function< void(const std::vector< LocalFileRecord > &)> filesReceivedCallback, concurrency::cancellation_token cancel=concurrency::cancellation_token::none())
MT_CONNECTOR_EXPORT concurrency::task< void > SendFiles (const std::vector< LocalFileRecord > &selection, std::function< PackageConfiguration(const LocalFileRecord &)> packageSelectionCallback, concurrency::cancellation_token cancel=concurrency::cancellation_token::none())

Detailed Description

Exposes MineTrustConnector SDK functionality to a native C++ application via a C++/CLI wrapper. This allows the native application to interact with the MineTrust Connector service, enabling features such as loading and saving package configurations, finding tags and files, evaluating filters, and receiving events from the service.

Typedef Documentation

◆ RegistrationWrapper

using MTConnectorSDK::RegistrationWrapper = std::unique_ptr<RegistrationWrapperImpl, void(*)(RegistrationWrapperImpl*)>

Internal handle returned when registering event callbacks.

Enumeration Type Documentation

◆ CreateVersionResultCodes

Return codes for CreateVersion() and their meaning

Enumerator
Success 

0 = Success

PackageConfigurationNotFound 

1 = Occurs when the requested package configuration was not found on the local server

InsufficientPermissions 

2 = Occurs when the user does not have sufficient permissions to create a version of the specified package

GeneralError 

3 = A general error occurred

IncompatibleClient 

4 = The client does not meet the version requirements of the server

◆ EnablePackageResultCodes

Return codes for EnablePackage() and their meaning

Enumerator
Success 

0 = Success

PackageConfigurationNotFound 

1 = Occurs when the requested package configuration was not found on the local server

PackageAlreadyEnabled 

2 = The package with the specified package UID is already enabled

PackagePreviouslyDeleted 

3 = A package with the specified package UID was previously deleted from the server

ServerURLNotValid 

4 = Occurs when the specified package UID is not present within the MineTrust endpoint, or if the corresponding package was previously enabled for a different MineTrust endpoint

InsufficientPermissions 

5 = The authenticated user does not have sufficient permissions to access the specified package

GeneralError 

6 = A general error occurred

IncompatibleClient 

7 = The client does not meet the version requirements of the server

◆ LockPackageResultCodes

Return codes for LockPackage() and their meaning

Enumerator
Success 

0 = Success

PackageConfigurationNotFound 

1 = Occurs when the requested package configuration was not found on the local server

PackageAlreadyLocked 

2 = Occurs when the specified package was already locked locally

FilesCheckedOutElsewhere 

3 = Occurs when the package cannot be locked because one or more files were checked out by another user

ProcessNotFound 

4 = Occurs when an OwnerProcess PID was specified, but no matching process was found

PackageNotEnabled 

5 = Occurs when a package cannot be locked because it is not currently enabled for sync

PackageProcessing 

6 = Occurs when a package cannot be locked because it is currently being processed by MT Connector

InsufficientPermissions 

7 = Occurs when the user does not have sufficient permissions to create a version of the specified package

GeneralError 

8 = A general error occurred

IncompatibleClient 

9 = The client does not meet the version requirements of the server

Examples
NativeApp.cpp.

◆ LogEvent

enum class MTConnectorSDK::LogEvent
strong

Enumeration of the log event IDs and formats that are shared by both the Dashboard and Service components

Enumerator
AllFilesUpToDate 

This event indicates that, on the last execution cycle for a particular package, all files were processed with no further changes required

SyncStarted 

Event raised whenever sync starts for a particular package

SyncCompleted 

Event raised whenever sync completes for a particular package

ReplicationStarted 

Event raised whenever replication starts for a particular package

ReplicationComplete 

Event raised whenever replication completes for a particular package

VersionLocked 

Event which indicates that the corresponding package has been successfully locked to the desired version

PackageDisabled 

Event which indicates that execution is currently paused for the corresponding package, due to its configuration being disabled

ProcessOwnedLockRemoved 

Event which indicates that a version lock owned by a particular process has been automatically removed

PackageVersionCreated 

Event which indicates that a package version has been created

PackageDeleted 

Event which indicates that a package configuration has been deleted

PackageArchived 

Event which indicates that a package configuration has been archived

PackageRestored 

Event which indicates that a package configuration has been restored

FileUploaded 

Event raised whenever a new file is uploaded to the MineTrust Server

FileDownloaded 

Event raised whenever a new file is downloaded from the MineTrust Server

FileUpdatedLocally 

Event raised whenever a file has been overwritten locally from the server copy

FileUpdatedOnServer 

Event raised whenever a file has been overwritten on the server from the local copy

FileRemovedOnServer 

Event raised whenever a file has been removed on the server

FileReplicated 

Event raised whenever a file has been replicated from the target package version

FileDiscarded 

Event raised whenever a local file is discarded as a result of checking out a version or reverting local changes

FileCheckedOut 

Event raised whenever a file is checked out from the server

FileCheckedIn 

Event raised whenever a file is checked in to the server

FileUncheckedOut 

Event raised whenever a file checkout is reverted

FileChangesDiscarded 

Event raised whenever changes to a local file are discarded as a result of checking out a version or reverting local changes

FileVersionsCleanedUp 

Event raised whenever old versions of a file are cleaned up following the evaluation of a RetentionPolicy.

FileUploadInProgress 

Event raised for a large file upload which is currently in progress

FileDownloadInProgress 

Event raised for a large file download which is currently in progress

PreparingFileUpload 

Event raised when a large file is being prepared for upload

FileNoLongerExists 

Event raised when MineTrust Connector attempts to download a file from the server but discovers that the file no longer exists (e.g. it was deleted since we enumerated package contents)

FileCheckedOutElsewhere 

Event raised when MineTrust Connector attempts to check out a file which is currently checked out by another user

Initialising 

Event indicates that the service is initialising

ConnectionEstablished 

Event indicates that a connection to MT Server has been successfully established

ConnectionLost 

Event indicates that a connection to MT Server has been lost

GracefulShutdown 

Event indicates that the service has exited gracefully

ServiceError 

Event indicates that the service has exited with an error

ServerRegistered 

Event indicates that a new server has been registered

AccessTokenSuccess 

Event indicates that an access token was successfully obtained

PackageEnabled 

Event indicates that a package has been enabled by the service

ServiceUIDMismatch 

Event indicating that the MineTrust ServiceUID for the corresponding endpoint did not match the value expected by the package configuration

PackageAutoEnableUndetermined 

Event indicating that the auto-enable property for the corresponding package could not be determined

ClientCompatibilityError 

Event indicating that the service encountered an error due to a client compatibility issue

PackagePreviouslyDeleted 

Event indicating that the service attempted to enable a package which was previously deleted on the server

SSLErrorDetected 

Event indicating that a client SSL error was detected. We only raise this event in development environments when client SSL validation is not already being suppressed

GeneralSyncError 

Event indicates that a general sync error has occurred (service will continue to execute)

GeneralReplicationError 

Event indicates that a general replication error has occurred (service will continue to execute)

Unauthorized 

Event indicates that an authentication error occurred as a result of authorization failure

PackageConfigurationNotFound 

Event indicates that a package configuration was missing

AccessTokenRequired 

Event indicates that the service requires interactive authentication in order to provide an access token (previously DeviceCodeRequired, but we are no longer using Device Code Flow due to limitations with MSAL and B2C. Instead we have implemented our own Authorization Code Flow)

ServerRegistrationFailed 

Event indicates that registration of a new MineTrust Server failed

LockPackageFailed 

Event indicates that locking of the specified package failed

UnlockPackageFailed 

Event indicates that unlocking of the specified package failed

EnablePackageFailed 

Event indicates that enabling of the specified package failed

UpdateLocalFailed 

Event indicates that the service failed to resolve a file conflict by updating the local file

UpdateServerFailed 

Event indicates that the service failed to resolve a file conflict by updating the server file

PackageValidationFailed 

Event indicates that validation has failed for a particular package

FileConflict 

Event indicating that attempting to synchronise a file resulted in a conflict

CreateVersionFailed 

Event indicates that creation of a package version failed

PackageDeletionFailed 

Event indicates that deletion of a package configuration failed

PrintDiagnosticsFailed 

Event indicates that service diagnostics could not be retrieved

AccessForbidden 

Event indicates that access to the requested MineTrust resource was forbidden

PackageAccessDenied 

Event indicates that a package was automatically disabled due to insufficient permissions

◆ PackageFileChangeType

Describes how a local package file has changed.

Enumerator
Added 

The file was added locally.

Modified 

The local file contents were modified.

Deleted 

The file was deleted locally.

◆ PrintDiagnosticsResultCodes

Return codes for PrintDiagnostics() and their meaning

Enumerator
Success 

0 = Success

GeneralError 

1 = A general error occurred

IncompatibleClient 

2 = The client does not meet the version requirements of the server

◆ RegisterServerResultCodes

Return codes for RegisterServer() and their meaning

Enumerator
Success 

0 = Success

ServerAlreadyRegistered 

1 = Server with this URL is already registered

GeneralError 

2 = A general error occurred

IncompatibleClient 

3 = The client does not meet the version requirements of the server

◆ SyncNowResultCodes

Return codes for SyncNow() and their meaning

Enumerator
Success 

0 = Success

PackageConfigurationNotFound 

1 = Occurs when the requested package configuration was not found on the local server

PackageNotEnabled 

2 = Occurs when the specified package is not currently enabled for execution

PackageLocked 

3 = Occurs when the specified package cannot be synced because it is currently locked locally

GeneralError 

4 = A general error occurred

IncompatibleClient 

5 = The client does not meet the version requirements of the server

Examples
NativeApp.cpp.

◆ UnlockPackageResultCodes

Return codes for UnlockPackage() and their meaning

Enumerator
Success 

0 = Success

PackageConfigurationNotFound 

1 = Occurs when the requested package configuration was not found on the local server

PackageNotLocked 

2 = Occurs when no package lock was found for the specified package

GeneralError 

3 = A general error occurred

IncompatibleClient 

4 = The client does not meet the version requirements of the server

◆ UpdateLocalResultCodes

Return codes for UpdateLocal() and their meaning

Enumerator
Success 

0 = Success

PackageConfigurationNotFound 

1 = Occurs when the requested package configuration was not found on the local server

LocalFileNotFound 

2 = Occurs when the specified file is not found locally

ServerFileNotFound 

3 = Occurs when the specified file is not found on the server

GeneralError 

4 = A general error occurred

IncompatibleClient 

5 = The client does not meet the version requirements of the server

◆ UpdateServerResultCodes

Return codes for UpdateServer() and their meaning

Enumerator
Success 

0 = Success

PackageConfigurationNotFound 

1 = Occurs when the requested package configuration was not found on the local server

LocalFileNotFound 

2 = Occurs when the specified file is not found locally

ServerFileNotFound 

3 = Occurs when the specified file is not found on the server

ServerFileCheckedOut 

4 = Occurs when the server file cannot be updated because it has been checked out by another user

GeneralError 

5 = A general error occurred

IncompatibleClient 

6 = The client does not meet the version requirements of the server

Function Documentation

◆ CreateVersion()

MT_CONNECTOR_EXPORT CreateVersionResultCodes MTConnectorSDK::CreateVersion ( const std::string & packageUID,
const std::string & comment = "",
bool showUI = false )

Creates a new version of the specified package, capturing all file versions as they currently exist for that package within MineTrust

◆ CreateVersionTask()

MT_CONNECTOR_EXPORT concurrency::task< CreateVersionResultCodes > MTConnectorSDK::CreateVersionTask ( const std::string & packageUID,
const std::string & comment = "",
bool showUI = false,
concurrency::cancellation_token cancel = concurrency::cancellation_token::none() )

Asynchronous counterpart of CreateVersion()

Warning
Care should be exercised when exercising cancellation if showUI is enabled - cancelling the invocation kills the underlying process, which may cause interactive windows to become unresponsive

◆ EnablePackage()

MT_CONNECTOR_EXPORT EnablePackageResultCodes MTConnectorSDK::EnablePackage ( const std::string & packageUID,
const std::string & localRoot = "",
const std::string & serverURL = "",
bool showUI = false )

Enables the package configuration for the specified package UID for synchronisation on the local machine. A local registration for the specified ServerURL is created if it doesn't already exist

◆ EnablePackageTask()

MT_CONNECTOR_EXPORT concurrency::task< EnablePackageResultCodes > MTConnectorSDK::EnablePackageTask ( const std::string & packageUID,
const std::string & localRoot = "",
const std::string & serverURL = "",
bool showUI = false,
concurrency::cancellation_token cancel = concurrency::cancellation_token::none() )

Asynchronous counterpart of EnablePackage()

Warning
Care should be exercised when exercising cancellation if showUI is enabled - cancelling the invocation kills the underlying process, which may cause interactive windows to become unresponsive

◆ EnumerateLocalContents()

MT_CONNECTOR_EXPORT std::vector< std::string > MTConnectorSDK::EnumerateLocalContents ( const std::string & packageUID)

Enumerates the contents of this package with respect to the local machine.

Examples
NativeApp.cpp.

◆ EnumerateLocalFilesByTag()

MT_CONNECTOR_EXPORT std::vector< std::string > MTConnectorSDK::EnumerateLocalFilesByTag ( const std::string & packageUID,
const std::string & tagName,
const std::string & tagValue )

Enumerates the contents of this package with respect to the local machine, filtering by those results which matched the specified tag criterion.

Examples
NativeApp.cpp.

◆ EvaluateFilter()

MT_CONNECTOR_EXPORT std::vector< LocalFileRecord > MTConnectorSDK::EvaluateFilter ( const std::string & filter,
const std::string & packageUID = "",
const std::string & serviceUID = "" )

Evaluates the specified filter string against the backing tag cache, returning an enumeration of the records which result from the specified query. The query evaluation can optionally be scoped to a single packageUID (where a corresponding tag value is expected). The destination tag cache can be optionally controlled via the serviceUID and profile parameters, otherwise the defaults are used.

Examples
NativeApp.cpp.

◆ ExcludeFromPackage()

MT_CONNECTOR_EXPORT void MTConnectorSDK::ExcludeFromPackage ( PackageConfiguration & instance,
const std::string & localFilePath )

Modifies the Include and Exclude manifests of the package configuration so that the specified local file is excluded from the package. Note that this method does not implicitly evaluate the package against the local file system.

◆ FindFiles() [1/4]

MT_CONNECTOR_EXPORT std::vector< LocalFileRecord > MTConnectorSDK::FindFiles ( const std::string & tagName,
const std::string & tagValue,
const std::string & fileNamePattern,
const std::string & serviceUID = "",
bool fuzzyMatch = false )

Finds all LocalFileRecord instances corresponding to the specified tag criteria, filtered to files matching the specified fileNamePattern. Fuzzy matching of the tagValue is supported via the fuzzyMatch switch (with the fileNamePattern always supporting fuzzy matching regardless of the switch, since it would be less intuitive otherwise). Passing an empty string to tagName will look for files matching top-level tags.

◆ FindFiles() [2/4]

MT_CONNECTOR_EXPORT std::vector< LocalFileRecord > MTConnectorSDK::FindFiles ( const std::string & tagName,
const std::string & tagValue,
const std::string & serviceUID = "",
bool fuzzyMatch = false )

Finds all LocalFileRecord instances corresponding to the specified tag criteria. Fuzzy matching of the tagValue is supported via the fuzzyMatch switch. Passing an empty string to tagName will look for files matching top-level tags.

Examples
NativeApp.cpp.

◆ FindFiles() [3/4]

MT_CONNECTOR_EXPORT std::vector< LocalFileRecord > MTConnectorSDK::FindFiles ( const std::unordered_map< std::string, std::string > & tagCriteria,
const std::string & fileNamePattern,
const std::string & serviceUID = "",
bool fuzzyMatch = false )

Finds all LocalFileRecord instances corresponding to the specified tag criteria, filtered to files matching the specified fileNamePattern. Fuzzy matching of values in the tagCriteria is supported via the fuzzyMatch switch (with the fileNamePattern always supporting fuzzy matching regardless of the switch, since it would be less intuitive otherwise). Passing an empty string as a key in the tagCriteria will look for files matching top-level tags.

◆ FindFiles() [4/4]

MT_CONNECTOR_EXPORT std::vector< LocalFileRecord > MTConnectorSDK::FindFiles ( const std::unordered_map< std::string, std::string > & tagCriteria,
const std::string & serviceUID = "",
bool fuzzyMatch = false )

Finds all LocalFileRecord instances corresponding to the specified tag criteria. Fuzzy matching of values in the tagCriteria is supported via the fuzzyMatch switch. Passing an empty string as a key in the tagCriteria will look for files matching top-level tags.

◆ FindPackageConfigurations()

MT_CONNECTOR_EXPORT std::vector< PackageConfiguration > MTConnectorSDK::FindPackageConfigurations ( const std::string & jsonPath,
const std::string & testValue,
bool negate = false )

Finds all package configurations for which the specified jsonPath evaluates to the test value provided, returning their respective UIDs. Json paths are evaluated according to the popular specification laid out in https://goessner.net/articles/JsonPath/ Optionally invert the truth result for each package configuration by specifying the negate switch.

Deprecated
Use GetAvailablePackages() instead, then filter the result. See the deprecation note on ListPackageConfigurations() for the shape caveats that apply equally here.
Deprecated
Use GetAvailablePackages() instead.
Examples
NativeApp.cpp.

◆ FindTags()

MT_CONNECTOR_EXPORT std::vector< LocalTagRecord > MTConnectorSDK::FindTags ( const std::string & tagNameFilter = "",
const std::string & tagValueFilter = "",
const std::string & serviceUID = "",
bool fuzzyMatch = false )

Finds all LocalTagRecord instances in the local cache which optionally match the specified filter.

The tagNameFilter and tagValueFilter parameters supports the following syntaxes:

  • 'MapType': Return all tag records corresponding to the 'MapType' tag
  • 'Map*' (with fuzzyMatch enabled): Return all tag records whose parent tag starts with 'Map'
  • '*Type' (with fuzzyMatch enabled): Return all tag records whose parent tag ends with 'Type'
  • 'PackageConfiguration\DisplayName': Enumerate all hierarchical tag values for 'PackageConfiguration' -> 'DisplayName'
  • 'PackageConfiguration\*' (with fuzzyMatch enabled): Return all tag records whose parent tag is within the 'PackageConfiguration' hierarchy
  • %null%: Return only 'top-level' tags (i.e. tags with no parent tag folder)

The default value for tagNameFilter - an empty string - will return all tag records, including top-level tags.

Examples
NativeApp.cpp.

◆ GetAccessiblePackages()

MT_CONNECTOR_EXPORT std::vector< std::string > MTConnectorSDK::GetAccessiblePackages ( const std::string & serviceUID = "")

Gets the packages which are known to be accessible to the current user in MineTrust. Caller can optionally specify the destination MineTrust endpoint.

Examples
NativeApp.cpp.

◆ GetArchivedPackages()

MT_CONNECTOR_EXPORT std::vector< std::string > MTConnectorSDK::GetArchivedPackages ( const std::string & serviceUID = "")

Returns an enumeration of all the package UIDs which have previously been marked as archived within MineTrust. Caller can optionally specify the destination MineTrust endpoint.

Examples
NativeApp.cpp.

◆ GetAvailablePackages()

MT_CONNECTOR_EXPORT std::vector< PackageSummary > MTConnectorSDK::GetAvailablePackages ( const ServerRegistration & registration)

Gets the packages available on the MineTrust server corresponding to the specified registration, populated entirely from the local SQLite tag cache without a network round-trip.

Examples
NativeApp.cpp.

◆ GetDeletedPackages()

MT_CONNECTOR_EXPORT std::vector< std::string > MTConnectorSDK::GetDeletedPackages ( const std::string & serviceUID = "")

Returns an enumeration of all the package UIDs which have previously been marked as deleted within MineTrust. Caller can optionally specify the destination MineTrust endpoint.

Examples
NativeApp.cpp.

◆ GetInaccessiblePackages()

MT_CONNECTOR_EXPORT std::vector< std::string > MTConnectorSDK::GetInaccessiblePackages ( const std::string & serviceUID = "")

Gets the packages which are known to be inaccessible to the current user in MineTrust. Caller can optionally specify the destination MineTrust endpoint.

Examples
NativeApp.cpp.

◆ GetPackageChanges()

MT_CONNECTOR_EXPORT std::unique_ptr< std::vector< PackageFileChange > > MTConnectorSDK::GetPackageChanges ( const std::string & packageUID)

Compares the current local package contents with the snapshot created when the package was locked. Returns nullptr while the local lock snapshot is unavailable or the package configuration is missing. A non-null empty vector means no files have changed.

◆ GetPermittedValues()

MT_CONNECTOR_EXPORT std::vector< std::string > MTConnectorSDK::GetPermittedValues ( const std::string & configPath)

Gets all permitted config values at the specified path, as defined by the local config schema.

Examples
NativeApp.cpp.

◆ GetServerRegistrationForServerURL()

MT_CONNECTOR_EXPORT bool MTConnectorSDK::GetServerRegistrationForServerURL ( const std::string & serverUrl,
ServerRegistration & instance )

Gets the server registration for the specified server URL. Returns a value indicating whether a matching registration was found.

Examples
NativeApp.cpp.

◆ GetServerRegistrationForServiceUID()

MT_CONNECTOR_EXPORT bool MTConnectorSDK::GetServerRegistrationForServiceUID ( const std::string & serviceUID,
ServerRegistration & instance )

Gets the server registration for the specified service UID. Returns a value indicating whether a matching registration was found.

◆ IncludeInPackage()

MT_CONNECTOR_EXPORT void MTConnectorSDK::IncludeInPackage ( PackageConfiguration & instance,
const std::string & localFilePath,
std::function< void(IncludeConfiguration &)> configureInclusion )

Modifies the Include and Exclude manifests of the package configuration so that the specified local file is included in the package. Optionally supplies a parameter to configure the IncludeConfiguration of the corresponding manifest entry. Note that this method does not implicitly evaluate the package against the local file system.

Examples
NativeApp.cpp.

◆ IsInScope()

MT_CONNECTOR_EXPORT bool MTConnectorSDK::IsInScope ( const std::string & packageUID,
const std::string & localFilePath )

Determines whether or not the specified local file is in the scope of the package configuration.

◆ IsMineTrustConnectorInstalled()

MT_CONNECTOR_EXPORT bool MTConnectorSDK::IsMineTrustConnectorInstalled ( )

Determines whether MineTrust Connector is installed on the system. Only available on Windows platforms.

Examples
NativeApp.cpp.

◆ IsMineTrustConnectorRunning()

MT_CONNECTOR_EXPORT bool MTConnectorSDK::IsMineTrustConnectorRunning ( )

Determines whether MineTrust Connector is running. Note that this mechanism will detect any running instance of MineTrust Connector (regardless of whether it is controlled by SCM)

Examples
NativeApp.cpp.

◆ ListPackageConfigurations()

MT_CONNECTOR_EXPORT std::vector< PackageConfiguration > MTConnectorSDK::ListPackageConfigurations ( )

Lists the package UIDs of all available package configurations on the local machine.

Deprecated
Use GetAvailablePackages() instead. This function enumerates the union of on-disk and tag-cache-derived package configurations for backwards compatibility. Note that GetAvailablePackages() is scoped per-server (via a ServerRegistration) and returns PackageSummary rather than PackageConfiguration - cache-derived entries here carry mostly-default client-side fields (Include, Exclude, LocalRoot, Filter, TargetVersion, ExclusiveCheckOut, Owner), the same caveat that applies to ListServerConfigurations().
Deprecated
Use GetAvailablePackages() instead.

◆ ListServerConfigurations()

MT_CONNECTOR_EXPORT std::vector< PackageConfiguration > MTConnectorSDK::ListServerConfigurations ( )

Lists all available server configurations on the local machine.

Deprecated
Use ListServerRegistrations() instead. This method returns a synthesised PackageConfiguration for backwards compatibility with client-side fields (Enabled, LocalRoot, Filter, TargetVersion, ExclusiveCheckOut, Owner) left at their defaults.
Deprecated
Use ListServerRegistrations() instead.

◆ ListServerRegistrations()

MT_CONNECTOR_EXPORT std::vector< ServerRegistration > MTConnectorSDK::ListServerRegistrations ( )

Lists all server registrations on the local machine.

Examples
NativeApp.cpp.

◆ ListServerURLs()

MT_CONNECTOR_EXPORT std::vector< std::string > MTConnectorSDK::ListServerURLs ( )

Lists the server URLs from all available server configurations on the local machine.

◆ LoadConfigSchema()

MT_CONNECTOR_EXPORT ConfigSchema MTConnectorSDK::LoadConfigSchema ( const std::string & root)

Gets the configuration schema defined at the specified config root. If no config root is specified then the entire local config schema is produced.

◆ LoadPackageConfiguration()

MT_CONNECTOR_EXPORT bool MTConnectorSDK::LoadPackageConfiguration ( const std::string & packageUID,
PackageConfiguration & instance )

Loads the package configuration with the specified packageUID into the specified instance. Returns a value indicating whether the operation was successful or not.

Examples
NativeApp.cpp.

◆ LoadPackageMetrics()

MT_CONNECTOR_EXPORT PackageMetrics MTConnectorSDK::LoadPackageMetrics ( const std::string & packageUID,
const std::string & serviceUID = "" )

Gets the metrics for the specified package. Package metrics are defined for packages which are enabled and have a valid LocalRoot property. For packages in which metrics are not defined, the default metrics instance is entirely populated by -1. Note that the resolution of the expected package contents is calculated with respect to the local tag cache, whose contents may differ from the actual file(s) present on MineTrust.

Examples
NativeApp.cpp.

◆ LockPackage()

MT_CONNECTOR_EXPORT LockPackageResultCodes MTConnectorSDK::LockPackage ( const std::string & packageUID,
const int & ownerProcess = 0,
bool showUI = false )

Obtains an exclusive lock on the specified local package. Creates a version marker within MineTrust as a baseline, then performs an exclusive check out of all files within this version

Examples
NativeApp.cpp.

◆ LockPackageTask()

MT_CONNECTOR_EXPORT concurrency::task< LockPackageResultCodes > MTConnectorSDK::LockPackageTask ( const std::string & packageUID,
const int & ownerProcess = 0,
bool showUI = false,
concurrency::cancellation_token cancel = concurrency::cancellation_token::none() )

Asynchronous counterpart of LockPackage()

Warning
Care should be exercised when exercising cancellation if showUI is enabled - cancelling the invocation kills the underlying process, which may cause interactive windows to become unresponsive
Examples
NativeApp.cpp.

◆ PrintDiagnostics()

MT_CONNECTOR_EXPORT PrintDiagnosticsResultCodes MTConnectorSDK::PrintDiagnostics ( bool showUI = false)

Instructs MineTrust Connector to print the MineTrust HTTP Client diagnostic info to its local log file

◆ PrintDiagnosticsTask()

MT_CONNECTOR_EXPORT concurrency::task< PrintDiagnosticsResultCodes > MTConnectorSDK::PrintDiagnosticsTask ( bool showUI = false,
concurrency::cancellation_token cancel = concurrency::cancellation_token::none() )

Asynchronous counterpart of PrintDiagnostics()

Warning
Care should be exercised when exercising cancellation if showUI is enabled - cancelling the invocation kills the underlying process, which may cause interactive windows to become unresponsive

◆ ReceiveFiles()

MT_CONNECTOR_EXPORT concurrency::task< void > MTConnectorSDK::ReceiveFiles ( const std::vector< LocalFileRecord > & selection,
std::function< void(const std::vector< LocalFileRecord > &)> filesReceivedCallback,
concurrency::cancellation_token cancel = concurrency::cancellation_token::none() )

Processes the incoming file records as a set of files to 'receive' from MineTrust. Received files are either located from their corresponding, locally synced package, or are otherwise temporarily synced from MineTrust and passed back as their temporary file locations. File records received in this manner are guaranteed to be populated by their LocalFilePath property, and temporary files may not persist after the callback has been invoked.

Examples
NativeApp.cpp.

◆ RegisterEvents()

MT_CONNECTOR_EXPORT RegistrationWrapper MTConnectorSDK::RegisterEvents ( std::function< void(const MTConnectorEvent &)> callback,
const std::list< LogEvent > & eventIDs = {} )

Registers the specified function as a callback for events which are received from the MineTrust Connector service. Optionally supply a list of log events to subscribe to particular events only.

Examples
NativeApp.cpp.

◆ RegisterServer()

MT_CONNECTOR_EXPORT RegisterServerResultCodes MTConnectorSDK::RegisterServer ( const std::string & serverURL,
bool showUI = false )

Creates a local registration for the server with the specified ServerURL. Initialises the server configuration for this server, using the ServerUID obtained via the REST API

◆ RegisterServerTask()

MT_CONNECTOR_EXPORT concurrency::task< RegisterServerResultCodes > MTConnectorSDK::RegisterServerTask ( const std::string & serverURL,
bool showUI = false,
concurrency::cancellation_token cancel = concurrency::cancellation_token::none() )

Asynchronous counterpart of RegisterServer()

Warning
Care should be exercised when exercising cancellation if showUI is enabled - cancelling the invocation kills the underlying process, which may cause interactive windows to become unresponsive

◆ RemoveTag()

MT_CONNECTOR_EXPORT void MTConnectorSDK::RemoveTag ( PackageConfiguration & instance,
const std::string & localFilePath,
const std::string & tagName )

Updates the manifest of the package configuration so that the if specified local file is adorned with the specified tagName the associated tag is removed from the file

Examples
NativeApp.cpp.

◆ SavePackageConfiguration()

MT_CONNECTOR_EXPORT bool MTConnectorSDK::SavePackageConfiguration ( const PackageConfiguration & instance)

Saves the values within the specified instance to the corresponding JSON structure on disk. Returns a value indicating whether the operation was successful or not.

Examples
NativeApp.cpp.

◆ SendFiles()

MT_CONNECTOR_EXPORT concurrency::task< void > MTConnectorSDK::SendFiles ( const std::vector< LocalFileRecord > & selection,
std::function< PackageConfiguration(const LocalFileRecord &)> packageSelectionCallback,
concurrency::cancellation_token cancel = concurrency::cancellation_token::none() )

Processes the incoming file records as a set of files to 'send' to MineTrust. Each file to be sent is passed through the packageSelectionCallback which should determine the destination package of that file (null to indicate that the file can be skipped). Sent files are either added to their corresponding, locally synced package, or are otherwise resolved per-destination package to a partial synchronisation filter based on the tag metadata in their original package. This filter is then used to perform a temporary, partial synchronisation of the destination package, to which the respective file(s) are then added. Temporary packages are cleaned up after the operation completes.

Examples
NativeApp.cpp.

◆ SyncNow()

MT_CONNECTOR_EXPORT SyncNowResultCodes MTConnectorSDK::SyncNow ( const std::string & packageUID,
bool showUI = false )

Synchronously invokes an execution cycle for the specified package, returning '0' when it has completed. If an execution cycle is already in flight then this method returns when it completes.

Examples
NativeApp.cpp.

◆ SyncNowTask()

MT_CONNECTOR_EXPORT concurrency::task< SyncNowResultCodes > MTConnectorSDK::SyncNowTask ( const std::string & packageUID,
bool showUI = false,
concurrency::cancellation_token cancel = concurrency::cancellation_token::none() )

Asynchronous counterpart of SyncNow()

Warning
Care should be exercised when exercising cancellation if showUI is enabled - cancelling the invocation kills the underlying process, which may cause interactive windows to become unresponsive
Examples
NativeApp.cpp.

◆ TagFile()

MT_CONNECTOR_EXPORT void MTConnectorSDK::TagFile ( PackageConfiguration & instance,
const std::string & localFilePath,
const std::string & tagName,
const std::string & tagValue )

Updates the manifest of the package configuration so that the specified local file is adorned with the tagName and tagValue specified. A null tagValue removes that tag if present.

Examples
NativeApp.cpp.

◆ UnlockPackage()

MT_CONNECTOR_EXPORT UnlockPackageResultCodes MTConnectorSDK::UnlockPackage ( const std::string & packageUID,
bool discardChanges = false,
bool showUI = false )

Removes the exclusive lock on the specified local package. All files which were checked out as a part of the package lock will be automatically checked in (unless the 'discardChanges' switch is specified)

Examples
NativeApp.cpp.

◆ UnlockPackageTask()

MT_CONNECTOR_EXPORT concurrency::task< UnlockPackageResultCodes > MTConnectorSDK::UnlockPackageTask ( const std::string & packageUID,
bool discardChanges = false,
bool showUI = false,
concurrency::cancellation_token cancel = concurrency::cancellation_token::none() )

Asynchronous counterpart of UnlockPackage()

Warning
Care should be exercised when exercising cancellation if showUI is enabled - cancelling the invocation kills the underlying process, which may cause interactive windows to become unresponsive
Examples
NativeApp.cpp.

◆ UpdateLocal()

MT_CONNECTOR_EXPORT UpdateLocalResultCodes MTConnectorSDK::UpdateLocal ( const std::string & packageUID,
const std::string & filePath,
bool showUI = false )

Instructs MineTrust Connector to force-overwrite the specified local file with the contents of the corresponding server file

◆ UpdateLocalTask()

MT_CONNECTOR_EXPORT concurrency::task< UpdateLocalResultCodes > MTConnectorSDK::UpdateLocalTask ( const std::string & packageUID,
const std::string & filePath,
bool showUI = false,
concurrency::cancellation_token cancel = concurrency::cancellation_token::none() )

Asynchronous counterpart of UpdateLocal()

Warning
Care should be exercised when exercising cancellation if showUI is enabled - cancelling the invocation kills the underlying process, which may cause interactive windows to become unresponsive

◆ UpdateServer()

MT_CONNECTOR_EXPORT UpdateServerResultCodes MTConnectorSDK::UpdateServer ( const std::string & packageUID,
const std::string & filePath,
bool showUI = false )

Instructs MineTrust Connector to force-overwrite the specified server file with the contents of the corresponding local file

◆ UpdateServerTask()

MT_CONNECTOR_EXPORT concurrency::task< UpdateServerResultCodes > MTConnectorSDK::UpdateServerTask ( const std::string & packageUID,
const std::string & filePath,
bool showUI = false,
concurrency::cancellation_token cancel = concurrency::cancellation_token::none() )

Asynchronous counterpart of UpdateServer()

Warning
Care should be exercised when exercising cancellation if showUI is enabled - cancelling the invocation kills the underlying process, which may cause interactive windows to become unresponsive