Trace notes - modelint/xuml-populate GitHub Wiki

Here are some loose notes on the design of the xuml-populate code.

Entry point

We begin in main.py initiating the logger, collecting arguments from the command line via argparse, resolving any supplied path and then creating an instance of System.

Assuming a path to the system package has been supplied via args.system, we'll create an instance of System.

System

init

We assume that each top level directory in the system package is a domain package. The term package is interchangeable with directory, but the term 'package' implies that the contents conform to certain naming and organization policies to organize the intended content.

Within each domain package we look for one or more subsystem packages.

Each subsytem requires an executable class model (*.xcm) file. We parse that file using our class model parser xcm-parser

For the first, and possibly only, class model, we'll grab the domain name and alias out of the parsed data.

In fact, at this point our plan is to parse all of the parseable files for each Domain in the System. For now these are the methods and state models.

Our System maintains a dictionary keyed by domain name named self.content. For each domain we keep a sub-dictionary keyed by subsystem name. Using the Elevator Case Study as our example:

self.content:
  Elevator Management:
    subsystems:
      Elevator
         class model: cm_parse
         methods:
           # Methods content dictionary keyed by method name
         state models:
           # State models content dictionary keyed by state model name (class name for lifecycles, rnum for assigners)
         external:
           # External entity content dictionary

Now we move on to any and all methods in the current subsystem. Methods are organized by class folder, so we descend into each looking for any Method (*.mtd) files to parse.

For each that we parse we put it under the appropriate methods key by method name.

As of this writing we just have the ping method in the Cabin class folder.

Now we iterate through all of the state models.

And as of this writing, we just have the Accessible Shaft Level lifecycle state model. So it's name is the same as the associated class name.

Next we would parse any external entity operations, but we'll hold off on that for now since the whole principle for managing bridging (explicit and implicit) among domains is still under review. Rest assured, we'll come back to this and end up parsing something similar to external entity operations.

Now that everything in the system is parsed, we're ready to begin population. So we call the System.populate() method and continue from there.

populate