Architecture of GAMA
GAMA is an Eclipse RCP application made of OSGi bundles (Eclipse plugins), grouped into features that are assembled into two products (desktop and headless). The projects are organized at the root of the gama repository; the main Maven/Tycho build is coordinated by gama.parent, while gama.annotations and gama.processor are built separately beforehand.
- A plugin (bundle) is a Java project with a
META-INF/MANIFEST.MF(and often aplugin.xml). Its dependencies are declared in theRequire-Bundleheader of the manifest. - A feature is an Eclipse project centered on a
feature.xmlthat lists plugins and other features. Features are the units installed by the update site. - A product (
gama.product/gama.product,gama.product/gama.headless.product) lists the features that make up a runnable application.
To create a new plugin, use the New GAMA Plugin wizard supplied by the GAMA Developer Tools Eclipse plugin. The GAMA menu and GAMA-specific toolbar buttons are recommended shortcuts added by that plugin; without it, create and configure the plugin manually as described in Developing Plugins.
The projects​
Language and core​
| Project | Role |
|---|---|
gama.annotations | The Java annotations (@operator, @skill, @species, @symbol, @type, @doc, ...) used to declare GAML elements, and gama.annotations.constants.IKeyword. Has no dependency and targets JavaSE-21, as it is also loaded by the annotation processor inside Eclipse. |
gama.processor | The annotation processor. It reads the annotations of each GAMA plugin at compile time and generates gaml/gaml/additions/<shortcut>/GamlAdditions.java (plus documentation and tests). It is used through the prebuilt gama.processor.jar, referenced by the .factorypath of each plugin. |
gama.dev | Low-level developer utilities used everywhere: gama.dev.DEBUG (logging, timers) and gama.dev.FLAGS (system properties). |
gama.dependencies | Bundles the external Java libraries used by GAMA (JTS, GeoTools, JGraphT, StreamEx, Fory, JFreeChart, ... in libs/). Plugins must reuse them rather than embed their own copies. |
gaml.grammar | The Xtext grammar of GAML (src/gaml/grammar/Gaml.xtext) and its MWE2 generator (Generate_GAML_Artefacts.mwe2). It is only needed to regenerate the parser, which is written into gaml.compiler/src-gen and gama.ui.editor/src-gen (GAMA > Repair GAMA plugins > Regenerate Xtext grammar). It is not part of the runtime. |
gama.api | The public API: interfaces (IAgent, IScope, IShape, IList, IType...), the static factories (GamaListFactory, GamaPointFactory...), the types (Types), the runtime entry point gama.api.GAMA, and the loader of language extensions (gama.api.additions.GamaBundleLoader). It also declares the extension points used by the other plugins. See Introduction to the GAMA Java API. |
gaml.compiler | The GAML compiler (parser, validation, scoping, descriptions, expressions), built on Xtext. Depends on gama.api. |
gama.core | The implementation: agents, populations, simulations and experiments, topologies, outputs, and most of the built-in GAML operators (gama.gaml.operators), statements (gama.gaml.statements), skills (gama.gaml.skills) and architectures. Its activator (gama.core.CoreActivator) installs the concrete factories into gama.api and loads all the language additions. |
gama.workspace | Integration with the Eclipse workspace: GAMA project natures, models manager, status messages. |
gama.headless | The runtime without user interface (batch, server mode, tests). Defines the gama.headless.product application. |
gama.library | The models library (examples, tutorials) and model tests shipped with GAMA. |
gama.documentation | Tools that generate the GAML reference documentation. Not part of the products. |
Extensions​
gama.extension.* plugins add GAML vocabulary (operators, skills, species, types, file formats...) on top of the core. They usually depend on gama.core, gama.api and gama.dependencies:
| Plugin | Contents |
|---|---|
gama.extension.batch | Exploration and calibration methods for batch experiments |
gama.extension.bdi | The BDI (Belief-Desire-Intention) architecture |
gama.extension.database | SQL databases access |
gama.extension.dataframe, gama.extension.rds | Data frames and R data files |
gama.extension.fipa | FIPA communication between agents |
gama.extension.image | The image type and image manipulation |
gama.extension.maths | Differential equations and solvers |
gama.extension.network | Network communication (TCP, UDP, MQTT, WebSockets, HTTP, serial) |
gama.extension.osm, gama.extension.gml, gama.extension.kml, gama.extension.dxf, gama.extension.geopackage | Geographic file formats |
gama.extension.pedestrian, gama.extension.traffic | Pedestrian and traffic skills |
gama.extension.physics | Physics engine |
gama.extension.serialize | Saving and restoring agents and simulations |
gama.extension.sound | Sound |
gama.extension.stats | Advanced statistics |
Community plugins (R, Weka, Matlab, the graphical editor...) live in separate repositories, mostly in the gama-platform-plugins organization. With GAMA Developer Tools installed, they can be imported with GAMA > Install GAMA sources > Install community plugins... (see Installing the development version); without the plugin, import a cloned repository with Eclipse's File > Import... > Existing Projects into Workspace. Community plugins can also be installed in a release (see Using extensions).
User interface​
| Plugin | Role |
|---|---|
gama.ui.application | The Eclipse application (gama.ui.application.Application), workbench setup |
gama.ui.shared | Shared UI components, preferences, dialogs, the IGui implementation (gama.ui.shared.utils.SwtGui) |
gama.ui.editor | The GAML editor (Xtext UI) |
gama.ui.navigator | The models navigator |
gama.ui.viewers | Viewers for files (images, shapefiles, CSV, ...) |
gama.ui.experiment | Experiment views: parameters, inspectors, consoles, monitors |
gama.ui.display.java2d | 2D displays |
gama.ui.display.opengl, gama.ui.display.opengl4 | 3D displays (opengl4 is the OpenGL 4.1 shader-based renderer) |
Export, features and build​
| Project | Role |
|---|---|
gama.export, gama.ui.export | Exporting models as stand-alone simulation launchers (see Exporting projects). gama.export.DocumentApplication is the application started by the desktop product: it opens documents and delegates to gama.ui.application. |
gama.feature.* | The features (see below) |
gama.product | The product definitions (gama.product, gama.headless.product), launcher icons and plugin_customization.ini |
gama.p2site | The p2 update site (category.xml) |
gama.parent | The Maven/Tycho parent POM. Its <modules> lists every project of the build. gama.annotations and gama.processor are built separately, before it (see Creating a release of GAMA). |
Dependencies between the main plugins​
The graph below shows selected direct Require-Bundle relationships; Eclipse and third-party bundles are omitted, as are most transitive edges. Extension plugins vary in their requirements: some depend on gama.api, some on gama.core, and some on both.
Notes:
gama.apidoes not depend ongama.core. Plugins that only use interfaces and factories can depend ongama.apialone; plugins that subclass implementation classes (e.g.gama.core.population.AbstractPopulation,gama.core.object.GamlObject) also needgama.core.gama.headlessrequires some extensions directly (gama.extension.traffic,maths,database,network).- Some UI plugins require extensions for their viewers (e.g.
gama.ui.navigatorrequiresgama.extension.osmandgama.extension.gml;gama.ui.display.java2drequiresgama.extension.image).
Features and products​
| Feature | Plugins |
|---|---|
gama.feature.core | Core runtime, compiler, workspace, processor and standard extensions such as batch, maths, statistics, traffic and data access plugins |
gama.feature.dependencies | gama.dependencies and the third-party bundles it needs |
gama.feature.extensions | Standard extensions: bdi, fipa, physics, pedestrian, serialize, ... |
gama.feature.extension.image / .sound / .stats | One extension each |
gama.feature.library | gama.library |
gama.feature.ui | gama.ui.application, gama.ui.shared |
gama.feature.ui.dependencies | Eclipse UI bundles needed by GAMA |
gama.feature.ui.editor | gama.ui.editor, gama.ui.navigator, gama.ui.viewers |
gama.feature.ui.experiment | gama.ui.experiment, gama.ui.display.java2d, gama.ui.display.opengl, gama.ui.display.opengl4 |
gama.feature.export | gama.export |
gama.feature.ui.export | gama.ui.export |
The feature and product files are the reference for their exact contents: check gama.feature.*/feature.xml and gama.product/*.product. The diagrams below summarize those declarations; they do not show every transitive dependency.
Product feature sets​
The product files list the features assembled into each application:
- Headless (
gama.product/gama.headless.product) listsgama.feature.core,gama.feature.library,gama.feature.extensions,gama.feature.dependencies,gama.feature.extension.imageonly. - Desktop (
gama.product/gama.product) listsgama.feature.core,gama.feature.library,gama.feature.extensions,gama.feature.dependencies,gama.feature.ui,gama.feature.ui.editor,gama.feature.ui.experiment,gama.feature.ui.dependencies,gama.feature.export, the image/sound/statistics extension features.
In a development workspace, the GAMA Developer Tools plugin adds the GAMA > Get started..., Install GAMA sources and Check workspace... commands. These are recommended shortcuts. Without the plugin, follow the manual setup in Installing the development version: import projects into Eclipse or build them with Maven, then configure a launch. The source installer imports the projects in gama.parent/pom.xml plus gama.annotations, gama.processor and gaml.grammar when required.
How language extensions are loaded​
A plugin contributes to GAML by declaring the gaml.extension extension point (defined in gama.api/plugin.xml) in its plugin.xml, e.g. gama.extension.stats/plugin.xml:
<plugin>
<extension point="gama.standard.distribution">
</extension>
<extension point="gaml.extension">
</extension>
</plugin>
(gama.standard.distribution marks plugins that are part of the standard GAMA distribution.)
At compile time, gama.processor generates, for a plugin whose symbolic name ends with <shortcut> (the last segment of the name), the class gaml.additions.<shortcut>.GamlAdditions in the gaml/ source folder (e.g. gama.extension.stats/gaml/gaml/additions/stats/GamlAdditions.java). This code registers every annotated operator, skill, species, type, statement... Never edit it: it is regenerated at each build (GAMA > Clean GAMA plugins deletes and regenerates all the gaml/ folders).
At startup, gama.core.CoreActivator initializes the factories, then calls GamaBundleLoader.buildContributions() (gama.api/src/gama/api/additions/GamaBundleLoader.java):
gama.apiandgama.coreare loaded first; if they fail, GAMA exits. A failing additional plugin is reported and skipped.- In headless mode, the display plugins are not loaded.
- Other extension points declared by
gama.apilet plugins provide implementations of delegates:gama.create(createfrom new data sources),gama.save(new file formats forsave),gama.draw,gama.event_layer,gama.display(display surfaces),gama.experiment,gama.constants,gama.metadataandgama.server_command. - Models placed in the
models/folder of a plugin are added to the library; tests inmodels/Testsare added to the tests.