ModelManager

Manages the Composer model files.

The structure of Resources (Assets, Transactions, Participants) is modelled
in a set of Composer files. The contents of these files are managed
by the ModelManager. Each Composer file has a single namespace and contains
a set of asset, transaction and participant type definitions.

Composer applications load their Composer files and then call the addModelFile
method to register the Composer file(s) with the ModelManager. The ModelManager
parses the text of the Composer file and will make all defined types available
to other Composer services, such as the Serializer (to convert instances to/from JSON)
and Factory (to create instances).

Method Details

validateModelFile

_ validateModelFile( string modelfile, string filename )_

Validates a Composer file (as a string) to the ModelManager. Composer files have a single namespace.
Note that if there are dependencies between multiple files the files must be added in dependency order, or the addModelFiles method can be used to add a set of files irrespective of dependencies.

See also

Parameters

Name

Type

Mandatory

Description

modelFile

string

Yes

The Composer file as a string

fileName

string

Yes

an optional file name to associate with the model file

addModelFile

Object addModelFile( string modelfile, string filename )

Adds a Composer file (as a string) to the ModelManager. Composer files have a single namespace. If a Composer file with the same namespace has already been added to the ModelManager then it will be replaced. Note that if there are dependencies between multiple files the files must be added in dependency order, or the addModelFiles method can be used to add a set of files irrespective of dependencies.

See also

Parameters

updateModelFile

Object updateModelFile( string modelfile, string filename )

Updates a Composer file (as a string) on the ModelManager. Composer files have a single namespace. If a Composer file with the same namespace has already been added to the ModelManager then it will be replaced.