This page provides the major changes into the SARL API that needs to update your source code (deprecated API, major changes, etc.).
This page is divided into two parts: the deprecated features from the SARL API, and the deprecated features from the SARL Run-time Environment (SRE).
Deprecated Type | Deprecated Feature | Removal? | Replacement |
---|---|---|---|
io.sarl.lang.util.Utils | compareVersions(String, String) | Yes | Replace with compareMajorMinorVersions(String, String) .
|
io.sarl.docs.validator.DocumentationLogger | setLogger(Logger) | Yes | No replacement. |
Deprecated Type or Module | Deprecated Feature | Replacement |
---|---|---|
AbstractDocumentationMojo | getBootClassPath | No replacement. |
AbstractSARLLaunchConfiguration | getClasspath | Replace getClasspath(...) by getClasspathAndModulepath(...) .
|
Address | getUUID | Replace getUUID by getID .
|
Module io.sarl.eclipse-slf4j | all | No replacement. |
OpenEventSpace | register | Replace register(listener, true) by registerWeakParticipant(listener) , and register(listener, false) by registerStrongParticipant(listener) .
|
ReflectExtensions | getDefaultNameFormatter | Replace getDefaultNameFormatter by getDefaultMethodNameFormatter .
|
ReflectExtensions | setDefaultNameFormatter | Replace setDefaultNameFormatter by setDefaultMethodNameFormatter .
|
SarlBatchCompiler | getJavaBootClasspath | No replacement. |
SarlBatchCompiler | setJavaBootClasspath | No replacement. |
SarlcConfig | getJavaBootClasspath | No replacement. |
SarlcConfig | setJavaBootClasspath | No replacement. |
SARLClasspathProvider | getJavaBootClasspath | No replacement. |
SARLClasspathProvider | setJavaBootClasspath | No replacement. |
ScriptExecutor | setBootClassPath | No replacement. |
SREBootstrap | setOffline | No replacement. |
Deprecated Type | Deprecated Feature | Replacement |
---|---|---|
DefaultContextInteractions | willReceive | Replace receiver.willReceive(new MyEvent) by emit(new MyEvent) [it.ID == receiver] .
The number of functions in the API should be limited. This function is assumed to be redundant with emit .
|
Lifecycle | return type of spawn |
In SRE 2.x, we could spawn an agent and get their assigned UUID code via the spawn method
the Lifecycle capacity, e.g.:
Because of problems and inconsistencies caused by the parallel execution of the spawn function,
the return value of this method has been deprecated. The spawn function replies nothing since version
0.11 of the API.
To spawn an agent and grab its UUID code, we first generate the identifier and then spawn the agent with it:
```sarl
val agent_UUID = UUID::randomUUID
spawnInContextWithID(typeof(MyAgent), agent_UUID, defaultContext)
```
(defaultContext is the short for getDefaultContext provided by DefaultContextInteractions )
or, with the version 0.12 of the API: ```sarl val agent_UUID = UUID::randomUUID spawnWithID(typeof(MyAgent), agent_UUID) ``` |
OpenEventSpace | register | Replace space.register(participant, isWeak) by registerStrongParticipant(participant)
if isWeak is true, or registerWeakParticipant(participant) if isWeak is false. This change
is applied by internal design on the space implementation.
|
Deprecated Type | Deprecated Feature | Removal Version | Replacement |
---|---|---|---|
DefaultContextInteractions | spawn | Replace spawn(type, args) by Lifecycle.spawn(type, args) .
The definition of the spawn into DefaultContextInteractions is not expected by SARL
users since this capacity seems to be
dedicated to interactions. Lifecycle capacity is a better place for defining the spawn
functions.
| |
Logging | println | Replace println(msg) by info(msg) . The semantic of println is linked to the system console.
Agents are supposed to log their messages on the agent console.
| |
SarlSpecificationChecker | getSarlSpecificationVersion | Replaced by getSarlSpecificationVersionObject . Change due to the change of the return type that is now of type Version .
|
Deprecated Type | Deprecated Feature | Removal Version | Replacement |
---|---|---|---|
DefaultContextInteractions | receive | 0.10 | Replace receiver.receive(new Event) by emit(new Event) [it.ID == receiver] . The number of
functions in the API should be limited. This function is assumed to be redundant with emit .
|
Deprecated Type | Deprecated Feature | Removal Version | Replacement |
---|---|---|---|
Boot | setOffline(boolean) | 0.10 | This parameter is not any more needed in the kernel of Janus v3. Indeed, the Janus v3 kernel is now
based on a new plugin architecture (based on the Bootique API).
With this plugin API, we could write a core software (the kernel) with a minimum set of features and
that could be extended with plugins by only adding these plugins on the classpath of the application.
In the context of Janus, the network features were moved into a plugin. One could easily add the
network feature by adding the corresponding plugin jar file in the classpath (equivalent to the old
Boot.offline = false ) or remove it from the classpath (equivalent to Boot.offline = true ), or
even add another networking plugin that is based on another technology (e.g. MQTT, etc.).
So, Boot.offline function is not any more into the Janus kernel (i.e. the Boot class, see below)
but into the configuration of the networking plugin. This plugin is under validation and is planned
to be back in SARL 0.12.
|
Boot | setVerboseLevel(level) | 0.10 | This function is removed from Boot . The SRE utility class provides the replacing function.
Note that it must be called before any launch of agent since the configuration level of Janus is set at start up.
|
Boot | startJanus(type) | 0.10 | In the old SRE 2.x, one would start an agent from Java by directly using the Boot
class in Janus:
In order to avoid any problems due to changes into the Janus implementation, in SRE 3.x it is preferable to use the SRE
utility class as follows:
```sarl
var sre = SRE::bootstrap
sre.startAgent(typeof(MyAgent))
```
|
Copyright © 2014-2024 SARL.io, the Original Authors and Main Authors.
Documentation text and medias are licensed under the Creative Common CC-BY-SA-4.0; you may not use this file except in compliance with CC-BY-SA-4.0. You may obtain a copy of CC-BY-4.0.
Examples of SARL code are licensed under the Apache License, Version 2.0; you may not use this file except in compliance with the Apache License. You may obtain a copy of the Apache License.
You are free to reproduce the content of this page on copyleft websites such as Wikipedia.
Generated with the translator docs.generator 0.14.0.