Class Reference
IRIS for UNIX 2019.2
InterSystems: The power behind what matters   
Documentation  Search
  [%SYS] >  [%SYS] >  [MFT] >  [Connection] >  [Base]
Private  Storage   

persistent class %SYS.MFT.Connection.Base extends %Persistent

The file manager to be used by %MFT classes will be described by a persistent class whose properties are stored in the CACHESYS database. This persistent file manager description will contain locations, user name and authentication information - essentially the connection and authentication information for the file management service.
The user of the file management API must create a persistent description of the connection to remote file management service. This connection is defined by the subclass of %SYS.MFT.Connection.Base which is implemented for the service provider being used.
The initially supported services all authenticate by using the OAuth 2.0 protocol. The file management connection will use OAuth 2.0 support to do the required authentication. An OAuth2 client must be configured for use by the connection. The details of the client are defined by the requirements of the specific vendor service. The ApplicationName property below is the application name for the OAuth2 client.
The %SYS.MFT.Connection>base class contains the base properties and methods for the remote file management services that we support. The %Admin_Secure will be required in order to open or save this object.

Inventory

Parameters Properties Methods Queries Indices ForeignKeys Triggers
9 20 1 1


Summary

Properties
ApplicationName HttpRequest Name SSLConfiguration
Service URL Username

Methods
%AddToSaveSet %AddToSyncSet %BMEBuilt %CheckConstraints
%CheckConstraintsForExtent %ClassIsLatestVersion %ClassName %ComposeOid
%ConstructClone %Delete %DeleteExtent %DeleteId
%DispatchClassMethod %DispatchGetModified %DispatchGetProperty %DispatchMethod
%DispatchSetModified %DispatchSetMultidimProperty %DispatchSetProperty %Exists
%ExistsId %Extends %GUID %GUIDSet
%GetLock %GetParameter %GetSwizzleObject %Id
%InsertBatch %IsA %IsModified %IsNull
%KillExtent %KillExtentData %LoadFromMemory %LockExtent
%LockId %New %NormalizeObject %ObjectIsNull
%ObjectModified %Oid %OnBeforeAddToSync %OnDetermineClass
%Open %OpenId %OriginalNamespace %PackageName
%PhysicalAddress %PurgeIndices %Reload %RemoveFromSaveSet
%ResolveConcurrencyConflict %RollBack %Save %SaveDirect
%SaveIndices %SerializeObject %SetModified %SortBegin
%SortEnd %SyncObjectIn %SyncTransport %UnlockExtent
%UnlockId %ValidateIndices %ValidateObject CreateClient
DefaultScope DefaultURL DeleteId GetAuthorizationCodeURL
IsAuthorized MakeHttpRequest OAuth2ClientCount Open
RevokeToken Save

Subclasses
%SYS.MFT.Connection.Box %SYS.MFT.Connection.Dropbox %SYS.MFT.Connection.Kiteworks

Properties

• property ApplicationName as %String(MAXLEN=64);
ApplicationName is the OAuth2 application name associated with this connection. The ConnectionId property will be used as the session id for the specific access token.
• property HttpRequest as %Net.HttpRequest [ Transient ];
Use the same %Net.HttpRequest object for all requests in the same session.
• property Name as %String(MAXLEN=64) [ Required ];
Name is the name of this connection to a file management service. Name serves as the IDKey for this class.
• property SSLConfiguration as %String(MAXLEN=64);
SSLConfiguration is the name of the SSL Configuration to be used to communicate with the file management API.
• property Service as %String [ InitialExpression = $piece($classname(),".",*) ];
Service is the name of the service that is accessed by this connection.
• property URL as %OAuth2.uri [ InitialExpression = ..DefaultURL() ];
URL is the base URL for REST access to this service including the final /. URL will default to the base URL for the remote file management service that is provided by the vendor. URL may be modified for locally hosted or private remote implementations.
• property Username as %String(MAXLEN=128);
Username is the name of the user on whose behalf the file access will take place.

Methods

• classmethod CreateClient(name As %String, sslConfiguration As %String, clientId As %String, clientSecret As %String, issuer, host As %String, port As %Integer, prefix As %String, useSSL As %Boolean) as %Status
Create an OAuth 2.0 client with the parameters required to authorize.
name is the name to be given to the OAuth 2.0 client.
sslConfiguration is the SSLConfiguration used to make the HTTP request.
clientId and ClientSecret are the id and secret for the OAuth 2.0 client which is obtained from the corresponding App definition.
If addiitonal properties are needed, then the OAuth 2.0 client may be opened and modified.
If a server definition does not yet exist for the OAuth 2.0 client, then a new server definition is created.
• classmethod DefaultScope() as %String
The default scope to use for obtaining the access token.
• classmethod DefaultURL() as %String
Each subclass will define the DefaultURL method to supply the default URL for the service.
• classmethod DeleteId(name As %String, keepOAuth2 As %Boolean = 0) as %Status
The DeleteId method deletes an existing connection object specified by its name. If keepOAuth2 is true, then the associated OAuth 2.0 connection is deleted. Otherwise, the OAuth2 connection is kept.
• method GetAuthorizationCodeURL(redirect As %String, scope As %String, ByRef properties As %String, Output sc As %Status) as %String
Get the URL for use by authorization code grant type.
• method IsAuthorized(Output errorMessage As %String) as %Boolean
Check if this connection has been authorized. The default authorization is via OAuth 2.0 access token.
• method MakeHttpRequest(httpRequest As %Net.HttpRequest, method As %String, url As %String, reset As %Boolean = 1) as %Status
MakeHttpRequest will add authentication to the specified %Net.HttpRequest object and execute the request using the specified method with the specified REST parameters added to the URL. After the request is made, the authentication information is removed to avoid making this available to user code.
• method OAuth2ClientCount() as %Integer
Get count of connection which reference the specified OAuth 2.0 client.
• classmethod Open(name As %String, Output sc As %Status) as %SYS.MFT.Connection.Base
Open a %SYS.MFT.Connection.Base subclass instance based on the ConnectionName property.
• method RevokeToken() as %Status
Revoke the token associated with this connection.
• method Save() as %Status
The Save method saves a %SYS.MFT.Connection.Base object. To save a new Connection object use the following procedure:
- get a new object with %New of the appropriate subclass of %SYS.MFT.Connection.Base.
- set required unique Name property.
- set any needed properties.
- call the Save method.

Queries

• query List()
Selects Name As %String, Service As %String, IsAuthorized As %String
List connections.

Indices

•index (IDIndex on Name) [IdKey,Unique];
The IDKEY for %SYS.MFT.Connection.Base is a unique user defined name.


Copyright (c) 2019 by InterSystems Corporation. Cambridge, Massachusetts, U.S.A. All rights reserved. Confidential property of InterSystems Corporation.