OpenAssetIO [beta]
An abstract API for generalising interactions between a host application and an asset management system

The ManagerFactory is the primary mechanism for querying for available managers and constructing a Manager. More...

#include <ManagerFactory.hpp>

Classes

struct  ManagerDetail
 Simple struct containing the default configuration details of a potential manager implementation. More...
 

Public Types

using Ptr = ManagerFactoryPtr
 
using ConstPtr = ManagerFactoryConstPtr
 
using ManagerDetails = std::unordered_map< Identifier, ManagerDetail >
 Mapping of manager identifier to its configuration details. More...
 

Public Member Functions

Identifiers identifiers () const
 All identifiers known to the factory. More...
 
ManagerDetails availableManagers () const
 Get the details for each available manager as a map of manager identifier to manager details. More...
 
ManagerPtr createManager (const Identifier &identifier) const
 Create a Manager instance for the manager associated with the given identifier. More...
 

Static Public Member Functions

static ManagerFactoryPtr make (HostInterfacePtr hostInterface, ManagerImplementationFactoryInterfacePtr managerImplementationFactory, log::LoggerInterfacePtr logger)
 Construct an instance of this class. More...
 
static ManagerPtr createManagerForInterface (const Identifier &identifier, const HostInterfacePtr &hostInterface, const ManagerImplementationFactoryInterfacePtr &managerImplementationFactory, const log::LoggerInterfacePtr &logger)
 Create a Manager instance for the manager associated with the given identifier. More...
 
static ManagerPtr defaultManagerForInterface (const HostInterfacePtr &hostInterface, const ManagerImplementationFactoryInterfacePtr &managerImplementationFactory, const log::LoggerInterfacePtr &logger)
 Creates the default Manager as defined by the TOML configuration file referenced by the $OPENASSETIO_DEFAULT_CONFIG. More...
 
static ManagerPtr defaultManagerForInterface (std::string_view configPath, const HostInterfacePtr &hostInterface, const ManagerImplementationFactoryInterfacePtr &managerImplementationFactory, const log::LoggerInterfacePtr &logger)
 Creates the default Manager as defined by the given TOML configuration file. More...
 

Static Public Attributes

static const Str kDefaultManagerConfigEnvVarName
 The name of the env var used to define the default manager config TOML file. More...
 

Detailed Description

The ManagerFactory is the primary mechanism for querying for available managers and constructing a Manager.

The underlying manager implementation is constructed using the supplied ManagerImplementationFactoryInterface factory implementation.

Hosts should never attempt to directly construct a Manager class or interact with the implementation factory directly.

Member Typedef Documentation

using ManagerDetails = std::unordered_map<Identifier, ManagerDetail>

Mapping of manager identifier to its configuration details.

Member Function Documentation

ManagerDetails availableManagers ( ) const

Get the details for each available manager as a map of manager identifier to manager details.

This provides the default settings that can be taken and mutated before being used in the initialization of a Manager.

Additional manager metadata is also included that may be useful. For example, this may be presented as part of a manager picker UI widget.

See also
ManagerDetail
Returns
A ManagerDetail instance for each available manager.
ManagerPtr createManager ( const Identifier identifier) const

Create a Manager instance for the manager associated with the given identifier.

The instance returned should then be used for all interaction with the manager.

Parameters
identifierUnique manager identifier.
Returns
Newly instantiated manager.
static ManagerPtr createManagerForInterface ( const Identifier identifier,
const HostInterfacePtr hostInterface,
const ManagerImplementationFactoryInterfacePtr managerImplementationFactory,
const log::LoggerInterfacePtr logger 
)
static

Create a Manager instance for the manager associated with the given identifier.

The instance returned should then be used for all interaction with the manager.

Parameters
identifierUnique manager identifier.
hostInterfaceThe host's implementation of the HostInterface that uniquely identifies the host and provides common hooks for the manager to query asset-related properties from the host.
managerImplementationFactoryThe factory that will be used to instantiate the manager. See, for example, PythonPluginSystemManagerImplementationFactory.
loggerThe logger instance that will be used for all messaging from the factory and instantiated Manager instances.
Returns
Newly instantiated manager.
static ManagerPtr defaultManagerForInterface ( const HostInterfacePtr hostInterface,
const ManagerImplementationFactoryInterfacePtr managerImplementationFactory,
const log::LoggerInterfacePtr logger 
)
static

Creates the default Manager as defined by the TOML configuration file referenced by the $OPENASSETIO_DEFAULT_CONFIG.

Note
This mechanism should be the default approach for a host to initialize the API. Extended functionality to override this configuration can optionally be provided, but the ability to use the shared, default configuration is always required.
See also
Alternative direct signature for more details.
Environment Variables:
OPENASSETIO_DEFAULT_CONFIG str The path to a TOML file containing configuration information for the default manager.
Returns
A default-configured manager if $OPENASSETIO_DEFAULT_CONFIG is set, otherwise a nullptr if the var was not set.
Exceptions
errors.InputValidationExceptionif there are errors if the config file does not exist at the path provided in the $OPENASSETIO_DEFAULT_CONFIG env var.
errors.ConfigurationExceptionif there are errors occur whilst loading the TOML file referenced by the $OPENASSETIO_DEFAULT_CONFIG env var.
static ManagerPtr defaultManagerForInterface ( std::string_view  configPath,
const HostInterfacePtr hostInterface,
const ManagerImplementationFactoryInterfacePtr managerImplementationFactory,
const log::LoggerInterfacePtr logger 
)
static

Creates the default Manager as defined by the given TOML configuration file.

This allows deployments to centralize OpenAssetIO manager settings, and for hosts to instantiate this manager without the need for their own settings and persistence mechanism.

The referenced TOML file should have the following structure.

1 [manager]
2 identifier = "some.identifier"
3 
4 [manager.settings] # Optional
5 some_setting = "value"

Any occurrences of ${config_dir} within TOML string values will be substituted with the absolute path to the directory containing the TOML file, before being passed on to the manager settings.

Parameters
configPathPath to the TOML config file, compatible with std::ifstream::open. Relative paths resolve to a platform/environment-dependent location.
hostInterfaceThe host's implementation of the HostInterface that uniquely identifies the host and provides common hooks for the manager to query asset-related properties from the host.
managerImplementationFactoryThe factory that will be used to instantiate managers.
loggerThe logger instance that will be used for all messaging from the instantiated Manager instances.
Returns
A default-configured manager.
Exceptions
errors.InputValidationExceptionif there are errors if the config file does not exist at the path provided in configPath.
errors.ConfigurationExceptionif there are errors occur whilst loading the TOML file.
Identifiers identifiers ( ) const

All identifiers known to the factory.

Note
This may result in a significant amount of work being performed by the supplied manager interface factory.
See also
Manager.identifier.
static ManagerFactoryPtr make ( HostInterfacePtr  hostInterface,
ManagerImplementationFactoryInterfacePtr  managerImplementationFactory,
log::LoggerInterfacePtr  logger 
)
static

Construct an instance of this class.

Parameters
hostInterfaceThe host's implementation of the HostInterface that uniquely identifies the host and provides common hooks for the manager to query asset-related properties from the host.
managerImplementationFactoryThe factory that will be used to instantiate managers. See, for example, PythonPluginSystemManagerImplementationFactory.
loggerThe logger instance that will be used for all messaging from the factory and instantiated Manager instances.

Member Data Documentation

const Str kDefaultManagerConfigEnvVarName
static

The name of the env var used to define the default manager config TOML file.

See also
defaultManagerForInterface.

The documentation for this class was generated from the following file:
  • /src/src/openassetio-core/include/openassetio/hostApi/ManagerFactory.hpp