Overall Structure Expanders

Metadata representation

The representation and manipulation of the meta-model data is distributed over 4 repositories:

  • expanders: mainly responsible for actual expansion and harvesting and injection
  • elementsio: mainly responsible for reading/writing the model from/to XML
  • nsx-prime: mainly responsible to trigger actions and interact with Prime Radiant
  • primeRadiant: mainly consisting of XML meta-model to generate the Prime Radiant

Currently, various data objects coexist for every data element/entity of the metamodel:

  • ElemDescriptor value classes in repo expanders, package n.d.descriptor
  • ElemModel value classes in repo expanders, package n.d.model
  • ElemAggregate value classes in repo elementsio, package n.d.elements.model
  • ElemDetails classes generated from model in repo primeRadiant, package n.d.elements

The n.d.model.ElemModel value classes exist only for top-level meta-elements, and consist in general of a simple wrapping of the corresponding ElemDescriptor value class.

Expansion control flow

The main classes to start expansion are located in the package n.d.runner of the nsx-prime repository:

  • ExpandApplicationFromFile: retrieving the model by reading XML files
  • ExpandApplicationFromPrime: retrieving the model by calling a Prime Radiant

Both create an in-memory model represented as an instance of the class ApplicationAggregate, belonging to the package n.d.elements.model of the repository elementsio (actually the FromPrime version creates an ApplicationInstanceAggregate containing the ApplicationAggregate). This ApplicationAggregate is passed to the ApplicationFromAggregateExpander of the package n.d.runner of the nsx-prime repository.

First, the ApplicationFromAggregateExpander invokes the PrimeToExpanderApplicationModelAgent to convert the aggregate value objects from elementsio into the model and descriptor value objects from the expanders repository. Here, typical classes being used are ModelFromElemClient classes from the package n.d.elements in the nsx-prime repository, and ElemDescriptorBuilder classes from the package n.d.descriptor.builder in the expanders repository.

Then, the ApplicationFromAggregateExpander is able to call the expand method on classes from the actual expanders repository:

  • n.d.af.ApplicationSkeletonExpander
  • n.d.model.FullComponentExpander for every component

passing the n.d.model.ApplicationModel and n.d.model.ComponentModel value objects from the expanders repository, containing the various more detailed ElemModel and ElemDescriptor value objects.

The FullComponentExpander will call al set of ModuleTotalExpander classes, where the Modules represent the various primitives of the metamodel, such as the elements (DataElement, TaskElement, FlowElement, …), but als some lower-level primitives as Commands, Finders, and Projections.

Selection of expanders

The set(s) of expanders too be used are

  • declared in groups in n.d.expansion.config.default_expanders.yaml
  • reified by n.d.expansion.config.ExpanderConfigFileReader into n.d.expansion.config.ExpanderClassEnumeration
  • made available through the class n.d.context.ApplicationContext
  • accessible from n.d.context.ApplicationExpansionContext and n.d.context.ComponentExpansionContext

For a given expansion module, e.g. Projection, the subset

  • is retrieved by a configurator, e.g. n.d.de.expansion.ProjectionExpansionConfigurator
  • made available to a total expander, e.g. net.democritus.de.common.ProjectionTotalExpander

This total expander ProjectionTotalExpander is called by the n.d.model.FullComponentExpander for every Projection, in the same way as the total expanders are called for the various types of elements, the finders and commands. All the projections that are to be expanded are made available through the getProjections() method of the n.d.model.ComponentModel class, which iterates over all the n.d.descriptor.DataDescriptor objects to retrieve all projections.

In the case of projections, it should be noted that default projections, e.g details and info, are added in n.d.elements.ModelFromDataElementClient located in repository nsx-prime, by explicitly creating them projection per projection using the class n.d.de.helper.ProjectionBuilder of the expanders repository. Nevertheless, it is also possible to create the default projections at once using the n.d.de.helper.ProjectionBuilder, and that method is even made available through the n.d.descriptor.builder.DataDescriptorBuilder.