Skip to main content
Hitachi Vantara Lumada and Pentaho Documentation

InstancesContainer

pentaho.type. InstancesContainer

A class that holds configured named instances.

AMD Module

require(["pentaho/type/InstancesContainer"], function(InstancesContainer) { /* code goes here */ });

Constructor

Name Description
new InstancesContainer(context, spec)

Members

Name Description
context :  pentaho.type.Context

Gets the associated type context.

Methods

Name Description
declare(id, typeId, instanceConfig) : pentaho.type.InstancesContainer

Declares an instance with a given identifier and container specification.

get(instRef, instKeyArgs, typeBase) : pentaho.type.Instance

Resolves an instance reference.

getAllByType(baseTypeId, keyArgs) : Array.<<code>!pentaho.type.Instance>

Gets all of the instances of the given type which are already successfully loaded and that, optionally, match a specified filter.

getAllByTypeAsync(baseTypeId, keyArgs) : Promise.<<code>Array.<<code>!pentaho.type.Instance>>

Gets a promise for all of the instances of the given type and that, optionally, match a specified filter.

getAsync(instRef, instKeyArgs, typeBase) : Promise.<<code>pentaho.type.Instance>

Resolves an instance reference, asynchronously.

getById(id) : pentaho.type.Instance

Gets a loaded configured instance given its identifier.

getByIdAsync(id) : Promise.<<code>pentaho.type.Instance>

Gets a promise for a configured instance given its identifier.

getByType(baseTypeId, keyArgs) : pentaho.type.Instance

Gets the highest ranking instance among the instances of the given type which are successfully loaded and that, optionally, match a specified filter.

getByTypeAsync(baseTypeId, keyArgs) : Promise.<<code>pentaho.type.Instance>

Gets a promise for the first instance of the given type and that, optionally, matches a specified filter.

Constructor Details

new InstancesContainer(context, spec)

Source: javascript/web/pentaho/type/InstancesContainer.js, line 207

Parameters:
Name Default Value Summary
context : pentaho.type.Context

The associated type context.

spec : pentaho.type.spec.ContextInstancesConfiguration

The instances' context configuration.

Members Details

context:  pentaho.type.Context

Gets the associated type context.

Source: javascript/web/pentaho/type/InstancesContainer.js, line 257

Methods Details

declare(id, typeId, instanceConfig) : pentaho.type.InstancesContainer

Declares an instance with a given identifier and container specification.

Source: javascript/web/pentaho/type/InstancesContainer.js, line 271

Parameters:
Name Default Value Summary
id : string

The instance identifier.

typeId : string

The type identifier.

instanceConfig : pentaho.type.spec.IContextInstanceConfiguration

— The instance's container configuration.

Returns:
Name Description
pentaho.type.InstancesContainer

This instance container.

get(instRef, instKeyArgs, typeBase) : pentaho.type.Instance

Resolves an instance reference.

This method can be used for:

Source: javascript/web/pentaho/type/InstancesContainer.js, line 756

Parameters:
Name Default Value Summary
instRef : pentaho.type.spec.UInstanceReference
Optional

An instance reference.

instKeyArgs : Object
Optional

The keyword arguments passed to the instance constructor, when one is created.

typeBase : pentaho.type.Type
Optional

The base type of which returned instances must be an instance and, also, the default type used when type information is not available in instRef.

Returns:
Name Description
pentaho.type.Instance

An instance, or null

Throws:
Name Description
pentaho.lang.OperationInvalidError

When it is not possible to determine the type of instance to create based on instRef and baseType is not specified.

pentaho.lang.OperationInvalidError

When an instance should be created but its determined type is abstract.

pentaho.lang.OperationInvalidError

When the special "resolve instance by type" syntax is used but it is not possible to determine the type to resolve against and baseType is not specified.

pentaho.lang.OperationInvalidError

When the special "resolve instance by type" syntax is used but the corresponding "element type" is an anonymous type.

pentaho.lang.OperationInvalidError

When the type of the resolved value is not a subtype of typeBase.

Error

Other errors, as documented in: Context#get, getById and getByType.

See also: pentaho.type.InstancesContainer#getAsync , pentaho.type.Type#create

getAllByType(baseTypeId, keyArgs) : Array.<<code>!pentaho.type.Instance>

Gets all of the instances of the given type which are already successfully loaded and that, optionally, match a specified filter.

Source: javascript/web/pentaho/type/InstancesContainer.js, line 509

Parameters:
Name Default Value Summary
baseTypeId : string | Class.<<code>pentaho.type.Instance> | pentaho.type.Type

The identifier of the base type or the instance constructor or type of an identified type.

keyArgs : Object
Optional

The keyword arguments.

Parameters:
Name Default Value Summary
filter : function
Optional

A predicate function that determines whether an instance can be part of the result.

isRequired : boolean
Optional
false

Indicates that an error should be thrown if there are no matching results.

Returns:
Name Description
Array.<<code>!pentaho.type.Instance>

An array of matching instances, possibly empty.

Throws:
Name Description
pentaho.lang.ArgumentInvalidError

When baseTypeId is an instance constructor or type object of an anonymous type.

pentaho.lang.OperationInvalidError

When there is no matching result and keyArgs.isRequired is true.

getAllByTypeAsync(baseTypeId, keyArgs) : Promise.<<code>Array.<<code>!pentaho.type.Instance>>

Gets a promise for all of the instances of the given type and that, optionally, match a specified filter.

Source: javascript/web/pentaho/type/InstancesContainer.js, line 415

Parameters:
Name Default Value Summary
baseTypeId : string | Class.<<code>pentaho.type.Instance> | pentaho.type.Type

The identifier of the base type or the instance constructor or type of an identified type.

keyArgs : Object
Optional

The keyword arguments.

Parameters:
Name Default Value Summary
filter : function
Optional

A predicate function that determines whether an instance can be part of the result.

isRequired : boolean
Optional
false

Indicates that the promise should be rejected if there is no matching result.

Returns:
Name Description
Promise.<<code>Array.<<code>!pentaho.type.Instance>>

A promise for an array of matching instances, possibly empty.

getAsync(instRef, instKeyArgs, typeBase) : Promise.<<code>pentaho.type.Instance>

Resolves an instance reference, asynchronously.

This method can be used for:

Source: javascript/web/pentaho/type/InstancesContainer.js, line 689

Parameters:
Name Default Value Summary
instRef : pentaho.type.spec.UInstanceReference
Optional

An instance reference.

instKeyArgs : Object
Optional

The keyword arguments passed to the instance constructor, when one is created.

typeBase : pentaho.type.Type
Optional

The base type of which returned instances must be an instance and, also, the default type used when type information is not available in instRef.

Returns:
Name Description
Promise.<<code>pentaho.type.Instance>

A promise to an instance.

See also: pentaho.type.InstancesContainer#get , pentaho.type.Type#createAsync

getById(id) : pentaho.type.Instance

Gets a loaded configured instance given its identifier.

An instance can only be requested synchronously if it has already been requested asynchronously before.

Source: javascript/web/pentaho/type/InstancesContainer.js, line 339

Parameters:
Name Default Value Summary
id : string

The instance identifier.

Returns:
Name Description
pentaho.type.Instance

The requested instance, or null, when reserved.

Throws:
Name Description
pentaho.lang.ArgumentRequiredError

When id is an empty string or Nully.

pentaho.lang.OperationInvalidError

When id is not the identifier of a defined instance.

pentaho.lang.OperationInvalidError

When the requested instance has not been loaded yet.

pentaho.lang.OperationInvalidError

When the requested instance's AMD module did not return an instance of the defined type.

Error

When the requested instance or its type are not defined as a module in the AMD module system.

getByIdAsync(id) : Promise.<<code>pentaho.type.Instance>

Gets a promise for a configured instance given its identifier.

Source: javascript/web/pentaho/type/InstancesContainer.js, line 306

Parameters:
Name Default Value Summary
id : string

The instance identifier.

Returns:
Name Description
Promise.<<code>pentaho.type.Instance>

A promise for the requested instance.

getByType(baseTypeId, keyArgs) : pentaho.type.Instance

Gets the highest ranking instance among the instances of the given type which are successfully loaded and that, optionally, match a specified filter.

Source: javascript/web/pentaho/type/InstancesContainer.js, line 462

Parameters:
Name Default Value Summary
baseTypeId : string | Class.<<code>pentaho.type.Instance> | pentaho.type.Type

The identifier of the base type or the instance constructor or type of an identified type.

keyArgs : Object
Optional

The keyword arguments.

Parameters:
Name Default Value Summary
filter : function
Optional

A predicate function that determines whether an instance can be the result.

isRequired : boolean
Optional
false

Indicates that an error should be thrown if there is no matching result.

Returns:
Name Description
pentaho.type.Instance

A matching loaded instance, or null.

Throws:
Name Description
pentaho.lang.ArgumentInvalidError

When baseTypeId is an instance constructor or type object of an anonymous type.

pentaho.lang.OperationInvalidError

When keyArgs.isRequired is true and there is no matching result.

getByTypeAsync(baseTypeId, keyArgs) : Promise.<<code>pentaho.type.Instance>

Gets a promise for the first instance of the given type and that, optionally, matches a specified filter.

Source: javascript/web/pentaho/type/InstancesContainer.js, line 383

Parameters:
Name Default Value Summary
baseTypeId : string | Class.<<code>pentaho.type.Instance> | pentaho.type.Type

The identifier of the base type or the instance constructor or type of an identified type.

keyArgs : Object
Optional

The keyword arguments.

Parameters:
Name Default Value Summary
filter : function
Optional

A predicate function that determines whether an instance can be the result.

isRequired : boolean
Optional
false

Indicates that the promise should be rejected if there is no matching result.

Returns:
Name Description
Promise.<<code>pentaho.type.Instance>

A promise for: a matching instance or null.