Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a configuration loader #28

Merged
merged 19 commits into from
Jan 23, 2024
Merged

Add a configuration loader #28

merged 19 commits into from
Jan 23, 2024

Conversation

cake-lier
Copy link
Collaborator

@cake-lier cake-lier commented Dec 19, 2023

Changes

  • This branch adds a configuration loader to Yggdrasil. This loader should take a JSON file and configure the Yggdrasil framework properly. The structure of this file follows closely the one defined by the JaCaMo specification (see here), with the main difference being that no ad-hoc parsing format is used (and no ad-hoc parser). It implies that it is possible to define the workspaces, the agents who joined them, the artifacts in them, and the agents focusing on those artifacts. A workspace needs a name and, optionally, a parent workspace name. An artifact needs a name, a semantic type, or a representation as a file path, depending on whether the environment is static or not, and can receive initial parameters as an array. The focusing agents specify their name as a URI and a callback URI to send the observable properties updates.
  • After creating workspaces and artifacts following the configuration, the corresponding representations are built thanks to the "store" verticle. If the environment is set to be static, only the "store" will read the configuration, searching for representations to insert. If the environment is dynamic, the "cartago" verticle will send the representations to the "store" after the corresponding entity creation.
  • The CArtAgO and WebSub verticles can be launched by appropriately setting a boolean value in their configuration. The original HTTPInterfaceConfig type is now divided across three different classes, each representing one part of the configuration ("EnvironmentConfig" for the "cartago" module and "WebSubConfig" for the "notification" module). If a module is disabled, the messages can still be sent to it, but the system will warn that the message will be a dead letter. By default, the "cartago" and "notification" modules are disabled.
  • The configuration objects, even if immutable and without side effects, have been moved into Vert.X LocalMaps so they are shared between verticles and set once by the "MainVerticle" when starting the system. This means the "MainVerticle" decides which verticles get launched and which do not, removing the usefulness of a "DefaultMainVerticle" class in the "core" module.
  • The notification module is now fully independent from the system thanks to the changes in the NotificationSubscriberRegistry: it is no longer a singleton. This means two new message types have been introduced: the "addCallback" and "removeCallback" ones. When the focus operation is invoked, the callback registration to the "notification" verticle is now done by the "http" one, not by the "cartago" one.
  • The "websub-uri" property is now "websub-base-uri," to which the "/hub/" path is appended and defaults to the base URI of the platform. The "known-artifacts" object is now an array of objects. All changes are exemplified by the files in the "conf" folder, especially the "cartago_conf.json" and "static_conf.json" files.

Open issues

Known Bugs

There are no known bugs so far. ("Program testing can be used to show the presence of bugs, but never to show their absence." -- Edsger Dijkstra)

@cake-lier cake-lier added the enhancement New feature or request label Dec 19, 2023
@cake-lier cake-lier self-assigned this Dec 19, 2023
@cake-lier cake-lier force-pushed the feature/configuration-loader branch from b34caa9 to 98e59c3 Compare January 20, 2024 12:26
@codecov-commenter
Copy link

codecov-commenter commented Jan 20, 2024

Codecov Report

Attention: 146 lines in your changes are missing coverage. Please review.

Comparison is base (6a043cb) 74.79% compared to head (27ebe3e) 75.27%.
Report is 15 commits behind head on main.

Files Patch % Lines
...s/HttpNotificationDispatcherMessageMarshaller.java 0.00% 56 Missing ⚠️
...agents/yggdrasil/model/impl/EnvironmentParser.java 80.62% 19 Missing and 12 partials ⚠️
...nts/yggdrasil/websub/HttpNotificationVerticle.java 77.46% 15 Missing and 1 partial ⚠️
...sil/eventbus/codecs/RdfStoreMessageMarshaller.java 0.00% 11 Missing ⚠️
...rasil/eventbus/messageboxes/CartagoMessagebox.java 57.14% 6 Missing and 3 partials ⚠️
...ggdrasil/eventbus/codecs/MessageNotifications.java 0.00% 6 Missing ⚠️
.../hyperagents/yggdrasil/http/HttpEntityHandler.java 92.45% 4 Missing ⚠️
...ageboxes/HttpNotificationDispatcherMessagebox.java 81.81% 2 Missing and 2 partials ⚠️
...gents/yggdrasil/eventbus/codecs/MessageFields.java 0.00% 3 Missing ⚠️
.../hyperagents/yggdrasil/store/RdfStoreVerticle.java 97.95% 1 Missing and 1 partial ⚠️
... and 4 more
Additional details and impacted files
@@             Coverage Diff              @@
##               main      #28      +/-   ##
============================================
+ Coverage     74.79%   75.27%   +0.47%     
- Complexity      302      391      +89     
============================================
  Files            33       35       +2     
  Lines          1706     2208     +502     
  Branches         64       75      +11     
============================================
+ Hits           1276     1662     +386     
- Misses          399      498      +99     
- Partials         31       48      +17     
Flag Coverage Δ
unittests 75.27% <79.58%> (+0.47%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@andreiciortea andreiciortea left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks @cake-lier !

… and environment, disable verticles by default
… from root to cartago and websub subprojects
@cake-lier cake-lier force-pushed the feature/configuration-loader branch from c75937c to 27ebe3e Compare January 23, 2024 23:41
@cake-lier cake-lier merged commit b799a49 into main Jan 23, 2024
1 check passed
@cake-lier cake-lier deleted the feature/configuration-loader branch January 23, 2024 23:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants