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:
- Model services
- access and explore the currently opened model
- create/modify/delete model elements
- react to model changes (model listener)
- Diagram services
- get a handle on a diagram
- read/create/delete/modify a diagram contents
- Model components services
- deploy a model components
- package a model component
- Module services
- manage the project modules
- call a module’s peer services
- Navigation services
- fire and listen to navigation events
- Picking services
- be a picking provider
- use picking
- Audit services
- check a model element
- Log services
- log a message
- Image services
- get a model element’s image
- Script services
- get a Python interpreter to execute a Python script
- Edition services
- open a text editor
- Context services
- get the workspace
- get I18n and versionning data
- Metamodel services
- get a metaclass by name
- get a metaclass name
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 model root package 5 IPackage root = session.getModel().getRoot(); 6 7 // get the audit service Modelio 8 IAuditService audit = Modelio.getInstance().getAuditService(); 9 10 // and now ask for an audit on the root package 11 audit.check(root);