Modelio MDA API

The Modelio API is the API that Modelio is providing to the developers of modules.

Modelio API is structured into several services specific to a particular aspect of Module development. In practical terms, these services are not strictly independent. For example, you will need to use model services to access to some model elements required by model components services.

The Modelio API is currently delivered as a unique jar file (modelio.jar) that you must use in your development projects.

The Modelio API services are:

Accessing the Modelio API services

The unique access point to these services is provided by the Modelio singleton which acts as a ‘handle’ to the whole Modelio application. For each service, Modelio can provide an object that provides the concrete service API as a bunch of specific methods.

In the following code fragment, Modelio is used to apply an audit check to the root package of the model.

 1    // Get the model services: the modeling session
 2    IModelingSession session = Modelio.getInstance().getModelingSession();
 3    
 4    // Get the Modelio audit service 
 5    IAuditService audit = Modelio.getInstance().getAuditService();
 6
 7    // Get all work models roots
 8    for (MObject rootObj : session.getModel().getModelRoots() ) {
 9        // Look for a Project instance  
10        if (rootObj instanceof Project) {
11            // Get the model root package
12            Package root = ((Project) rootObj).getModel();
13
14            // And now ask for an audit on the root package
15            audit.check(root);
16        }
17    }