THYManagedModuleController

Overview

The THYManagedModuleController class is used internally to provide support for managed plugins. In the Hydra framework, this class is used internally by the THYManagedModule to load and initialize managed modules.

There is no need to use this class directly, instead, you can use the THYModuleManager to load managed as well as unmanaged modules.

Note: For more information on managed plugin usage in the Hydra framework, please refer to this article.

Location


 

constructor Create (PSafeArray, string, THYClrDomain)  overload

Creates a new instance of the class.

constructor Create(aAssembly: PSafeArray; aSearchPath: string; const aDefaultDomain: THYClrDomain)

Parameters:

  • aAssembly: Assembly
  • aSearchPath: The name of the directory to be appended to the private path.
  • aDefaultDomain: Clr domain

constructor Create (PSafeArray, string, Boolean)  overload

Creates a new instance of the class.

constructor Create(aAssembly: PSafeArray; aSearchPath: string; const InNewAppDomain: Boolean)

Parameters:

  • aAssembly: Path to the plugin module.
  • aSearchPath: The name of the directory to be appended to the private path.
  • InNewAppDomain: Specifies whether plugin module will be loaded in new AppDomain.

constructor Create (string, string, THYClrDomain)  overload

Creates a new instance of the class.

constructor Create(aFilename: string; aSearchPath: string; const aDefaultDomain: THYClrDomain)

Parameters:

  • aFilename: Path to the plugin module.
  • aSearchPath: The name of the directory to be appended to the private path.
  • aDefaultDomain: Clr domain

constructor Create (string, string, Boolean)  overload

Creates a new instance of the class.

constructor Create(aFilename: string; aSearchPath: string; const InNewAppDomain: Boolean)

Parameters:

  • aFilename: Path to the plugin module.
  • aSearchPath: The name of the directory to be appended to the private path.
  • InNewAppDomain: Specifies whether plugin module will be loaded in new AppDomain.

constructor Create (TComponent)  overload override    (declared in THYSimpleModuleController)

Creates a new instance of the class.

constructor Create(aOwner: TComponent)

Parameters:

  • aOwner:

constructor Create (string, Integer, Integer, string, string)  reintroduce overload virtual    (declared in THYSimpleModuleController)

Creates a new instance of the class.

constructor Create(const aLibraryName: string; aMajorVersion: Integer; aMinorVersion: Integer; const aRequiredPrivilege: string; const aDescription: string)

Parameters:

  • aLibraryName:
  • aMajorVersion:
  • aMinorVersion:
  • aRequiredPrivilege:
  • aDescription:

constructor CreateNew (string, Integer, Integer, string, string, Integer)  reintroduce overload virtual    (declared in THYSimpleModuleController)

Creates a new instance of the class.

constructor CreateNew(const aLibraryName: string; aMajorVersion: Integer; aMinorVersion: Integer; const aRequiredPrivilege: string; const aDescription: string; Dummy: Integer)

Parameters:

  • aLibraryName:
  • aMajorVersion:
  • aMinorVersion:
  • aRequiredPrivilege:
  • aDescription:
  • Dummy:

AppDomain

References to an application domain that is used to load plugins.

property AppDomain: _AppDomain read write

Assembly

References to an assembly object.

property Assembly: _Assembly read write

ClrAppDomain  protected

References to an application domain that is used to load plugins.

property ClrAppDomain: THYClrAppDomain read write

CreateInstance  protected override

Creates a new instance of the plugin with specified name.

function CreateInstance(const aPluginName: WideString): IHYCrossPlatformPlugin

Parameters:

  • aPluginName: Name of the plugin instance.

CrossPlatformHost    (declared in THYSimpleModuleController)

Reference to an instance of a cross platform host.

property CrossPlatformHost: IHYCrossPlatformHost read write

Descriptor    (declared in THYVCLModuleController)

Gets refence to the descriptor of the module.

property Descriptor:

Descriptor    (declared in THYSimpleModuleController)

property Descriptor: THYBaseDescriptor read write

DuplicatePluginDescriptor  protected    (declared in THYSimpleModuleController)

function DuplicatePluginDescriptor(Index: Integer): THYPluginDescriptor

Parameters:

  • Index:

Factories    (declared in THYVCLModuleController)

Sets reference to an instance of the host.

property Factories[Index: Integer]: THYBasePluginFactory read write

FactoryCount    (declared in THYVCLModuleController)

Gets number of registered factories.

property FactoryCount: Integer read write

FindFactory    (declared in THYVCLModuleController)

Searches for a factory with given name.

function FindFactory(const aPluginName: string): THYBasePluginFactory

Parameters:

  • aPluginName: Name of the factory.

get_Plugin  protected override safecall    (declared in THYVCLModuleController)

Returns the reference to a plugin descriptor with specified index.

function get_Plugin(aIndex: Integer): IHYCrossPlatformPluginDescriptor

Parameters:

  • aIndex:

GetDLLInstance    (declared in THYVCLModuleController)

Gets handle of the module.

function GetDLLInstance: cardinal

GetModuleController  protected safecall    (declared in THYSimpleModuleController)

Returns the interface of the current module controller.

function GetModuleController: IHYCrossPlatformModuleController

GetPluginDescriptor    (declared in THYSimpleModuleController)

function GetPluginDescriptor(aPluginName: string): THYPluginDescriptor

Parameters:

  • aPluginName:

Host    (declared in THYVCLModuleController)

The reference to the plugin host interface.

property Host: IHYVCLHost read write

IHYCrossPlatformModuleController_GetLargeImages  protected override safecall    (declared in THYVCLModuleController)

Returns the handle of the image list used for large images.

function IHYCrossPlatformModuleController_GetLargeImages: THandle

IHYCrossPlatformModuleController_GetSmallImages  protected override safecall    (declared in THYVCLModuleController)

Returns the handle of the image list used for small images.

function IHYCrossPlatformModuleController_GetSmallImages: THandle

InitializeObject  protected override

procedure InitializeObject

IsDefined

Checks whether specififed type has an attribute.

function IsDefined(InType: _Type; AttributeType: _Type): Boolean

Parameters:

  • InType: Reference to the managed type.
  • AttributeType: Reference to the managed attribute.

IsShutDown

Returns the value that indicates the plugin state.

property IsShutDown: Boolean read write

LargeImages    (declared in THYVCLModuleController)

Gets or sets reference to a image list that holds large images.

property LargeImages: TImageList read write

LargeImagesDisabled    (declared in THYVCLModuleController)

Gets or sets reference to a image list that holds large disabled images.

property LargeImagesDisabled: TImageList read write

LargeImagesHot    (declared in THYVCLModuleController)

Gets or sets reference to a image list that holds large hot images.

property LargeImagesHot: TImageList read write

LoadAssemblies

Loads all assemblies that fit the search mask parameter.

procedure LoadAssemblies(const iSearchMask: string)

Parameters:

  • iSearchMask: Search mask.

ManagedModuleController

References to the IHYCrossPlatformModuleController instance.

property ManagedModuleController: IHYCrossPlatformModuleController read write

NeedsManagedWrapperAttribute

References to the NeedsManagedWrapperAttribute attribute that indicates whether a wrapper class needs to be created to use this plugin.

property NeedsManagedWrapperAttribute: _Type read write

NonVisualPluginAttribute

References to the NonVisualPluginAttribute attribute.

property NonVisualPluginAttribute: _Type read write

OnHostParametersChange  protected virtual    (declared in THYVCLModuleController)

Event handler. Reacts on a host parameters changes.

procedure OnHostParametersChange(Sender: TObject)

Parameters:

  • Sender: Sender of the event.

OnSetHost    (declared in THYVCLModuleController)

Fires when reference to a host is changed.

property OnSetHost: THYHostSetEvent read write
delegate: procedure OnSetHost(const Sender: IHYVCLHostAware; const aHost: IHYVCLHost)

OnSetHostParameters    (declared in THYVCLModuleController)

Fires when host parameters is set.

property OnSetHostParameters: THYHostParametersChangeEvent read write
delegate: procedure OnSetHostParameters(const aHost: IHYVCLHost; aParameters: TStrings)

PluginAttribute

References to the PluginAttribute attribute.

property PluginAttribute: _Type read write

PluginDescriptorCount    (declared in THYVCLModuleController)

Gets number of registered plugin descriptors.

property PluginDescriptorCount: Integer read write

PluginDescriptors    (declared in THYVCLModuleController)

The reference to a plugin descriptor with specified index.

property PluginDescriptors[Index: Integer]: THYPluginDescriptor read write

RegisterPluginFactory    (declared in THYVCLModuleController)

Register plugin factory inside module controller.

procedure RegisterPluginFactory(const aPluginFactory: THYBasePluginFactory)

Parameters:

  • aPluginFactory: Reference to a plugin factory.

SafeCallException  override    (declared in THYVCLModuleController)

Handles exceptions in methods declared using the safecall calling convention.

function SafeCallException(ExceptObject: TObject; ExceptAddr: Pointer): HResult

Parameters:

  • ExceptObject: Exception object.
  • ExceptAddr: Addres of the exception.

SetHostParameters  protected override

Sets list of a host parameters.

procedure SetHostParameters(Value: TStrings)

Parameters:

  • Value: Reference to a list of parameters.

Shutdown

Unloads the application domain and sets the IsShutDown property to true

procedure Shutdown

SmallImages    (declared in THYVCLModuleController)

Gets or sets reference to a image list that holds small images.

property SmallImages: TImageList read write

SmallImagesDisabled    (declared in THYVCLModuleController)

Gets or sets reference to a image list that holds small disabled images.

property SmallImagesDisabled: TImageList read write

SmallImagesHot    (declared in THYVCLModuleController)

Gets or sets reference to a image list that holds small hot images.

property SmallImagesHot: TImageList read write

VisualPluginAttribute

References to the VisualPluginAttribute attribute.

property VisualPluginAttribute: _Type read write

 

AppDomain

References to an application domain that is used to load plugins.

property AppDomain: _AppDomain read write

Assembly

References to an assembly object.

property Assembly: _Assembly read write

ClrAppDomain  protected

References to an application domain that is used to load plugins.

property ClrAppDomain: THYClrAppDomain read write

CrossPlatformHost    (declared in THYSimpleModuleController)

Reference to an instance of a cross platform host.

property CrossPlatformHost: IHYCrossPlatformHost read write

Descriptor    (declared in THYVCLModuleController)

Gets refence to the descriptor of the module.

property Descriptor:

Descriptor    (declared in THYSimpleModuleController)

property Descriptor: THYBaseDescriptor read write

Factories    (declared in THYVCLModuleController)

Sets reference to an instance of the host.

property Factories[Index: Integer]: THYBasePluginFactory read write

FactoryCount    (declared in THYVCLModuleController)

Gets number of registered factories.

property FactoryCount: Integer read write

Host    (declared in THYVCLModuleController)

The reference to the plugin host interface.

property Host: IHYVCLHost read write

IsShutDown

Returns the value that indicates the plugin state.

property IsShutDown: Boolean read write

LargeImages    (declared in THYVCLModuleController)

Gets or sets reference to a image list that holds large images.

property LargeImages: TImageList read write

LargeImagesDisabled    (declared in THYVCLModuleController)

Gets or sets reference to a image list that holds large disabled images.

property LargeImagesDisabled: TImageList read write

LargeImagesHot    (declared in THYVCLModuleController)

Gets or sets reference to a image list that holds large hot images.

property LargeImagesHot: TImageList read write

ManagedModuleController

References to the IHYCrossPlatformModuleController instance.

property ManagedModuleController: IHYCrossPlatformModuleController read write

NeedsManagedWrapperAttribute

References to the NeedsManagedWrapperAttribute attribute that indicates whether a wrapper class needs to be created to use this plugin.

property NeedsManagedWrapperAttribute: _Type read write

NonVisualPluginAttribute

References to the NonVisualPluginAttribute attribute.

property NonVisualPluginAttribute: _Type read write

PluginAttribute

References to the PluginAttribute attribute.

property PluginAttribute: _Type read write

PluginDescriptorCount    (declared in THYVCLModuleController)

Gets number of registered plugin descriptors.

property PluginDescriptorCount: Integer read write

PluginDescriptors    (declared in THYVCLModuleController)

The reference to a plugin descriptor with specified index.

property PluginDescriptors[Index: Integer]: THYPluginDescriptor read write

SmallImages    (declared in THYVCLModuleController)

Gets or sets reference to a image list that holds small images.

property SmallImages: TImageList read write

SmallImagesDisabled    (declared in THYVCLModuleController)

Gets or sets reference to a image list that holds small disabled images.

property SmallImagesDisabled: TImageList read write

SmallImagesHot    (declared in THYVCLModuleController)

Gets or sets reference to a image list that holds small hot images.

property SmallImagesHot: TImageList read write

VisualPluginAttribute

References to the VisualPluginAttribute attribute.

property VisualPluginAttribute: _Type read write

 

constructor Create (PSafeArray, string, THYClrDomain)  overload

Creates a new instance of the class.

constructor Create(aAssembly: PSafeArray; aSearchPath: string; const aDefaultDomain: THYClrDomain)

Parameters:

  • aAssembly: Assembly
  • aSearchPath: The name of the directory to be appended to the private path.
  • aDefaultDomain: Clr domain

constructor Create (PSafeArray, string, Boolean)  overload

Creates a new instance of the class.

constructor Create(aAssembly: PSafeArray; aSearchPath: string; const InNewAppDomain: Boolean)

Parameters:

  • aAssembly: Path to the plugin module.
  • aSearchPath: The name of the directory to be appended to the private path.
  • InNewAppDomain: Specifies whether plugin module will be loaded in new AppDomain.

constructor Create (string, string, THYClrDomain)  overload

Creates a new instance of the class.

constructor Create(aFilename: string; aSearchPath: string; const aDefaultDomain: THYClrDomain)

Parameters:

  • aFilename: Path to the plugin module.
  • aSearchPath: The name of the directory to be appended to the private path.
  • aDefaultDomain: Clr domain

constructor Create (string, string, Boolean)  overload

Creates a new instance of the class.

constructor Create(aFilename: string; aSearchPath: string; const InNewAppDomain: Boolean)

Parameters:

  • aFilename: Path to the plugin module.
  • aSearchPath: The name of the directory to be appended to the private path.
  • InNewAppDomain: Specifies whether plugin module will be loaded in new AppDomain.

constructor Create (TComponent)  overload override    (declared in THYSimpleModuleController)

Creates a new instance of the class.

constructor Create(aOwner: TComponent)

Parameters:

  • aOwner:

constructor Create (string, Integer, Integer, string, string)  reintroduce overload virtual    (declared in THYSimpleModuleController)

Creates a new instance of the class.

constructor Create(const aLibraryName: string; aMajorVersion: Integer; aMinorVersion: Integer; const aRequiredPrivilege: string; const aDescription: string)

Parameters:

  • aLibraryName:
  • aMajorVersion:
  • aMinorVersion:
  • aRequiredPrivilege:
  • aDescription:

constructor CreateNew (string, Integer, Integer, string, string, Integer)  reintroduce overload virtual    (declared in THYSimpleModuleController)

Creates a new instance of the class.

constructor CreateNew(const aLibraryName: string; aMajorVersion: Integer; aMinorVersion: Integer; const aRequiredPrivilege: string; const aDescription: string; Dummy: Integer)

Parameters:

  • aLibraryName:
  • aMajorVersion:
  • aMinorVersion:
  • aRequiredPrivilege:
  • aDescription:
  • Dummy:

CreateInstance  protected override

Creates a new instance of the plugin with specified name.

function CreateInstance(const aPluginName: WideString): IHYCrossPlatformPlugin

Parameters:

  • aPluginName: Name of the plugin instance.

DuplicatePluginDescriptor  protected    (declared in THYSimpleModuleController)

function DuplicatePluginDescriptor(Index: Integer): THYPluginDescriptor

Parameters:

  • Index:

FindFactory    (declared in THYVCLModuleController)

Searches for a factory with given name.

function FindFactory(const aPluginName: string): THYBasePluginFactory

Parameters:

  • aPluginName: Name of the factory.

get_Plugin  protected override safecall    (declared in THYVCLModuleController)

Returns the reference to a plugin descriptor with specified index.

function get_Plugin(aIndex: Integer): IHYCrossPlatformPluginDescriptor

Parameters:

  • aIndex:

GetDLLInstance    (declared in THYVCLModuleController)

Gets handle of the module.

function GetDLLInstance: cardinal

GetModuleController  protected safecall    (declared in THYSimpleModuleController)

Returns the interface of the current module controller.

function GetModuleController: IHYCrossPlatformModuleController

GetPluginDescriptor    (declared in THYSimpleModuleController)

function GetPluginDescriptor(aPluginName: string): THYPluginDescriptor

Parameters:

  • aPluginName:

IHYCrossPlatformModuleController_GetLargeImages  protected override safecall    (declared in THYVCLModuleController)

Returns the handle of the image list used for large images.

function IHYCrossPlatformModuleController_GetLargeImages: THandle

IHYCrossPlatformModuleController_GetSmallImages  protected override safecall    (declared in THYVCLModuleController)

Returns the handle of the image list used for small images.

function IHYCrossPlatformModuleController_GetSmallImages: THandle

InitializeObject  protected override

procedure InitializeObject

IsDefined

Checks whether specififed type has an attribute.

function IsDefined(InType: _Type; AttributeType: _Type): Boolean

Parameters:

  • InType: Reference to the managed type.
  • AttributeType: Reference to the managed attribute.

LoadAssemblies

Loads all assemblies that fit the search mask parameter.

procedure LoadAssemblies(const iSearchMask: string)

Parameters:

  • iSearchMask: Search mask.

OnHostParametersChange  protected virtual    (declared in THYVCLModuleController)

Event handler. Reacts on a host parameters changes.

procedure OnHostParametersChange(Sender: TObject)

Parameters:

  • Sender: Sender of the event.

RegisterPluginFactory    (declared in THYVCLModuleController)

Register plugin factory inside module controller.

procedure RegisterPluginFactory(const aPluginFactory: THYBasePluginFactory)

Parameters:

  • aPluginFactory: Reference to a plugin factory.

SafeCallException  override    (declared in THYVCLModuleController)

Handles exceptions in methods declared using the safecall calling convention.

function SafeCallException(ExceptObject: TObject; ExceptAddr: Pointer): HResult

Parameters:

  • ExceptObject: Exception object.
  • ExceptAddr: Addres of the exception.

SetHostParameters  protected override

Sets list of a host parameters.

procedure SetHostParameters(Value: TStrings)

Parameters:

  • Value: Reference to a list of parameters.

Shutdown

Unloads the application domain and sets the IsShutDown property to true

procedure Shutdown

 

OnSetHost    (declared in THYVCLModuleController)

Fires when reference to a host is changed.

property OnSetHost: THYHostSetEvent read write
delegate: procedure OnSetHost(const Sender: IHYVCLHostAware; const aHost: IHYVCLHost)

OnSetHostParameters    (declared in THYVCLModuleController)

Fires when host parameters is set.

property OnSetHostParameters: THYHostParametersChangeEvent read write
delegate: procedure OnSetHostParameters(const aHost: IHYVCLHost; aParameters: TStrings)