Skip to main content

Class: EngineCore<C, S>

Core for the engine.

Type Parameters

C

C extends IEngineCoreConfig = IEngineCoreConfig

S

S extends IEngineState = IEngineState

Implements

  • IEngineCore<C, S>

Constructors

Constructor

new EngineCore<C, S>(options?): EngineCore<C, S>

Create a new instance of EngineCore.

Parameters

options?

IEngineCoreOptions<C, S>

The options for the engine.

Returns

EngineCore<C, S>

Properties

LOGGING_COMPONENT_TYPE_NAME

readonly static LOGGING_COMPONENT_TYPE_NAME: string = "engine-logging-service"

Name for the engine logger component, used for direct console logging.


LOGGING_CONNECTOR_TYPE_NAME

readonly static LOGGING_CONNECTOR_TYPE_NAME: string = "engine-logging-connector"

Name for the engine logger connector, used for direct console logging.


CLASS_NAME

readonly static CLASS_NAME: string

Runtime name for the class.


_context

protected _context: IEngineCoreContext<C, S>

The core context.


_contextIdKeys

protected readonly _contextIdKeys: object[]

The context ID keys.

key

key: string

componentFeatures

componentFeatures: string[]


_contextIds?

protected optional _contextIds?: IContextIds

The context IDs.

Methods

addTypeInitialiser()

addTypeInitialiser(type, module, method): void

Add a type initialiser.

Parameters

type

string

The type to add the initialiser for.

module

string

The name of the module which contains the initialiser method.

method

string

The name of the method to call.

Returns

void

Implementation of

IEngineCore.addTypeInitialiser


getTypeConfig()

getTypeConfig(type): IEngineCoreTypeConfig[] | undefined

Get the type config for a specific type.

Parameters

type

string

The type to get the config for.

Returns

IEngineCoreTypeConfig[] | undefined

The type config or undefined if not found.

Implementation of

IEngineCore.getTypeConfig


addContextIdKey()

addContextIdKey(key, componentFeatures): void

Add a context ID key to the engine.

Parameters

key

string

The context ID key.

componentFeatures

string[]

The component features for the context ID handler.

Returns

void

Implementation of

IEngineCore.addContextIdKey


getContextIdKeys()

getContextIdKeys(): string[]

Get the context ID keys for the engine.

Returns

string[]

The context IDs keys.

Implementation of

IEngineCore.getContextIdKeys


addContextId()

addContextId(key, value): void

Add a context ID to the engine.

Parameters

key

string

The context ID key.

value

string

The context ID value.

Returns

void

Implementation of

IEngineCore.addContextId


getContextIds()

getContextIds(): IContextIds | undefined

Get the context IDs for the engine.

Returns

IContextIds | undefined

The context IDs or undefined if none are set.

Implementation of

IEngineCore.getContextIds


start()

start(skipComponentStart?): Promise<void>

Start the engine core.

Parameters

skipComponentStart?

boolean

Should the component start be skipped.

Returns

Promise<void>

Nothing.

Implementation of

IEngineCore.start


stop()

stop(): Promise<void>

Stop the engine core.

Returns

Promise<void>

Nothing.

Implementation of

IEngineCore.stop


isStarted()

isStarted(): boolean

Is the engine started.

Returns

boolean

True if the engine is started.

Implementation of

IEngineCore.isStarted


isPrimary()

isPrimary(): boolean

Is this the primary engine instance.

Returns

boolean

True if the engine is the primary instance.

Implementation of

IEngineCore.isPrimary


isClone()

isClone(): boolean

Is this engine instance a clone.

Returns

boolean

True if the engine instance is a clone.

Implementation of

IEngineCore.isClone


logInfo()

logInfo(message): Promise<void>

Log info.

Parameters

message

string

The message to log.

Returns

Promise<void>

Implementation of

IEngineCore.logInfo


logError()

logError(error): Promise<void>

Log error.

Parameters

error

IError

The error to log.

Returns

Promise<void>

Implementation of

IEngineCore.logError


getConfig()

getConfig(): C

Get the config for the engine.

Returns

C

The config for the engine.

Implementation of

IEngineCore.getConfig


getState()

getState(): S

Get the state of the engine.

Returns

S

The state of the engine.

Implementation of

IEngineCore.getState


setStateDirty()

setStateDirty(): void

Set the state to dirty so it gets saved.

Returns

void

Implementation of

IEngineCore.setStateDirty


getRegisteredInstances()

getRegisteredInstances(): object

Get all the registered instances.

Returns

object

The registered instances.

Implementation of

IEngineCore.getRegisteredInstances


getRegisteredInstanceType()

getRegisteredInstanceType(componentConnectorType, features?): string

Get the registered instance type for the component/connector.

Parameters

componentConnectorType

string

The type of the component/connector.

features?

string[]

The requested features of the component, if not specified the default entry will be retrieved.

Returns

string

The instance type matching the criteria if one is registered.

Throws

If a matching instance was not found.

Implementation of

IEngineCore.getRegisteredInstanceType


getRegisteredInstanceTypeOptional()

getRegisteredInstanceTypeOptional(componentConnectorType, features?): string | undefined

Get the registered instance type for the component/connector if it exists.

Parameters

componentConnectorType

string

The type of the component/connector.

features?

string[]

The requested features of the component, if not specified the default entry will be retrieved.

Returns

string | undefined

The instance type matching the criteria if one is registered.

Implementation of

IEngineCore.getRegisteredInstanceTypeOptional


getCloneData()

getCloneData(): IEngineCoreClone<C, S>

Get the data required to create a clone of the engine.

Returns

IEngineCoreClone<C, S>

The clone data.

Implementation of

IEngineCore.getCloneData


populateClone()

populateClone(cloneData, contextIds?, silent?): void

Populate the engine from the clone data.

Parameters

cloneData

IEngineCoreClone<C, S>

The clone data to populate from.

contextIds?

IContextIds

The context IDs to use for the clone.

silent?

boolean

Should the clone be silent.

Returns

void

Implementation of

IEngineCore.populateClone