io.sarl.lang.core
Interface SREBootstrap
All Known Implementing Classes:
SreMain
interface SREBootstrap
Represents an access point to the SARL run-time environment (SRE). This access point may be used for accessing the underlying SRE independently of its implementation.

Depending on the implementation of the SRE, an instance of this SRE access point could be injected.
Maven Group Identifier:
io.sarl.lang
Maven Artifact Identifier:
core
Since:
0.6
Property Summary
Modifier and type Property and description
java.util.logging.Logger kernelLogger
Replies the logger used by the SRE.
java.util.UUID universeContextUUID
Replies the UUID of the root/universe context that is given by the user of the bootstrap.
java.util.UUID universeSpaceUUID
Replies the UUID of the root/universe default space that is given by the user of the bootstrap.
Action Summary
Modifier and type Action and description
abstract void addSREListener(SREListener)
Add an observer on the SRE.
default java.util.logging.Logger getKernelLogger
Replies the logger used by the SRE.
abstract T getService(Class<T>)
Replies the service of the given type that is implemented into the SRE.
default java.util.UUID getUniverseContextUUID
Replies the UUID of the root/universe context that is given by the user of the bootstrap.
default java.util.UUID getUniverseSpaceUUID
Replies the UUID of the root/universe default space that is given by the user of the bootstrap.
default boolean isActive
Replies if the bootstrap could be used.
default boolean isRunning
Replies if the kernel is running.
abstract void removeSREListener(SREListener)
Remove the given observer on the SRE.
default void setBootAgentTypeContextUUID
Force the SRE platform to use a default context identifier that is build upon the classname of the boot agent.
abstract void setCommandLineArguments(String)
Specify arguments that should be used by the SRE as command-line arguments.
default void setOffline(boolean)
Set offline flag of the agent platform before it is launched.
Deprecated for removal since 0.12: since 0.12, no direct replacement
default void setRandomContextUUID
Force the SRE platform to use a random identifier for its default context.
default void setSpecificContextUUID
Force the SRE platform to use the identifier hard-coded in the source code for its default context.
default void setUniverseContextUUID(UUID)
Force the identifier of the root/universe context in case the SRE is run when the default identifier mode is enabled.
default void setUniverseSpaceUUID(UUID)
Force the identifier of the root/universe default space in case the SRE is run when the default identifier mode is enabled.
default void setVerboseLevel(int)
Force the verbosity level.
default void shutdown
Stop the SRE.
default void shutdown(boolean)
Stop the SRE.
abstract void shutdown(int)
Stop the SRE.
abstract void startAgent(Class<T>,Object*)
Launch the SRE and the first agent in the kernel.
abstract void startAgent(int,Class<T>,Object*)
Launch the SRE and the first agent in the kernel.
abstract void startAgentWithID(Class<T>,UUID,Object*)
Launch the SRE and the first agent in the kernel and assigning a specific UUID.
default AgentContext startWithoutAgent
Start the SRE without an agent.
abstract AgentContext startWithoutAgent(boolean)
Start the SRE without an agent.
Property Details
kernelLogger
val kernelLogger : java.util.logging.Logger
Replies the logger used by the SRE.

This function replies a not null value only if the kernel was launched.

This property is an alias for the action: getKernelLogger

Returns:
the logger, or null if the kernel was not launched or has no logger.
Since:
0.10
universeContextUUID
var universeContextUUID : java.util.UUID
Replies the UUID of the root/universe context that is given by the user of the bootstrap.

This function has no effect if the agent framework is already launched.

This property is an alias for the action: getUniverseContextUUID

Returns:
the identifier, or null if no identifier is provided by the user and the default identifier should be used.
Throws exception:
  • java.lang.UnsupportedOperationException: a runtime exception
Since:
0.9
universeSpaceUUID
var universeSpaceUUID : java.util.UUID
Replies the UUID of the root/universe default space that is given by the user of the bootstrap.

This function has no effect if the agent framework is already launched.

This property is an alias for the action: getUniverseSpaceUUID

Returns:
the identifier, or null if no identifier is provided by the user and the default identifier should be used.
Throws exception:
  • java.lang.UnsupportedOperationException: a runtime exception
Since:
0.9
Action Details
addSREListener(SREListener)
def addSREListener(SREListener)
Add an observer on the SRE.
Parameters:
listener - the observer to add.
Since:
0.11
getKernelLogger
def getKernelLogger : java.util.logging.Logger
Replies the logger used by the SRE.

This function replies a not null value only if the kernel was launched.
Returns:
the logger, or null if the kernel was not launched or has no logger.
Since:
0.10
getService(Class<T>)
def getService(Class<T>) : T

with T

Replies the service of the given type that is implemented into the SRE.
Parameters:
<T> - the type of the service.
serviceType - the type of the service.
Returns:
the service instance, or null if the SRE does not have any instance of service of the given type.
Since:
0.10
getUniverseContextUUID
def getUniverseContextUUID : java.util.UUID
Replies the UUID of the root/universe context that is given by the user of the bootstrap.

This function has no effect if the agent framework is already launched.
Returns:
the identifier, or null if no identifier is provided by the user and the default identifier should be used.
Throws exception:
  • java.lang.UnsupportedOperationException: a runtime exception
Since:
0.9
getUniverseSpaceUUID
def getUniverseSpaceUUID : java.util.UUID
Replies the UUID of the root/universe default space that is given by the user of the bootstrap.

This function has no effect if the agent framework is already launched.
Returns:
the identifier, or null if no identifier is provided by the user and the default identifier should be used.
Throws exception:
  • java.lang.UnsupportedOperationException: a runtime exception
Since:
0.9
isActive
def isActive : boolean
Replies if the bootstrap could be used.

If the bootstrap cannot be used, it cannot launch agent.
Returns:
true if the bootstrap could be used. false if it cannot be used.
isRunning
def isRunning : boolean
Replies if the kernel is running.
Returns:
true if the kernel is running. false is replied if the kernel was stopped.
Since:
0.10
removeSREListener(SREListener)
def removeSREListener(SREListener)
Remove the given observer on the SRE.
Parameters:
listener - the observer to remove.
Since:
0.11
setBootAgentTypeContextUUID
def setBootAgentTypeContextUUID
Force the SRE platform to use a default context identifier that is build upon the classname of the boot agent. It means that the UUID is always the same for a given classname.

This function has no effect if the agent framework is already launched.
Throws exception:
  • java.lang.UnsupportedOperationException: a runtime exception
Since:
0.7
setCommandLineArguments(String)
def setCommandLineArguments(String)
Specify arguments that should be used by the SRE as command-line arguments. These arguments are usually used as start-up of the SRE.
Parameters:
arguments - the command-line arguments.
Since:
0.12
setOffline(boolean)
def setOffline(boolean)
Set offline flag of the agent platform before it is launched.

This function has no effect if the agent framework is already launched.
Parameters:
isOffline - the offline flag.
Throws exception:
  • java.lang.UnsupportedOperationException: a runtime exception
Deprecated:
since 0.12, no direct replacement
Since:
0.7
setRandomContextUUID
def setRandomContextUUID
Force the SRE platform to use a random identifier for its default context.

This function has no effect if the agent framework is already launched.
Throws exception:
  • java.lang.UnsupportedOperationException: a runtime exception
Since:
0.7
setSpecificContextUUID
def setSpecificContextUUID
Force the SRE platform to use the identifier hard-coded in the source code for its default context.

This function has no effect if the agent framework is already launched.
Throws exception:
  • java.lang.UnsupportedOperationException: a runtime exception
Since:
0.9
See:
setUniverseContextUUID(UUID) , getUniverseContextUUID , setUniverseSpaceUUID(UUID) , getUniverseSpaceUUID
setUniverseContextUUID(UUID)
def setUniverseContextUUID(UUID)
Force the identifier of the root/universe context in case the SRE is run when the default identifier mode is enabled.

This function has no effect if the agent framework is already launched.
Parameters:
id - the identifier, or null if the default identifier should be used.
Throws exception:
  • java.lang.UnsupportedOperationException: a runtime exception
Since:
0.9
setUniverseSpaceUUID(UUID)
def setUniverseSpaceUUID(UUID)
Force the identifier of the root/universe default space in case the SRE is run when the default identifier mode is enabled.

This function has no effect if the agent framework is already launched.
Parameters:
id - the identifier, or null if the default identifier should be used.
Throws exception:
  • java.lang.UnsupportedOperationException: a runtime exception
Since:
0.9
setVerboseLevel(int)
def setVerboseLevel(int)
Force the verbosity level.

This function may have no effect if the agent framework is already launched. This depends on the implementation of the SRE.

The value of the level argument does not depend on a specific logging infrastructure. Indeed, JUL, Log4J and SLF4J attach different numeric values to the different logging levels. Consequently, the numerical values that are assumed by this function are:
  • <= 0: off, no logging.
  • = 1: errors only.
  • = 2: errors and warnings.
  • = 3: errors, warnings and info.
  • = 4: errors, warnings, info, debug 1.
  • = 5: errors, warnings, info, debug 1 to 2.
  • = 6: errors, warnings, info, debug 1 to 3.
  • = 7: all messages.
Parameters:
level - the verbosity level. See explanation in the documentation of this function.
Throws exception:
  • java.lang.UnsupportedOperationException: a runtime exception
Since:
0.7
shutdown
def shutdown

throws java.lang.InterruptedException

Stop the SRE. This function may cause the agents to stop during the run of a behavior. This function has no timeout. This function returns when the kernel and all its services are stopped.
Throws exception:
  • java.lang.InterruptedException: the shutdown process is interrupted.
Since:
0.10
See:
shutdown(boolean) , shutdown(int)
shutdown(boolean)
def shutdown(boolean)

throws java.lang.InterruptedException

Stop the SRE. This function may cause the agents to stop during the run of a behavior. This function has no timeout.

If the argument's value is evaluated to true, the shutdown(int) functions is invoked with negative timeout; Otherwise the shutdown(int) functions is invoked with 0 value.
Parameters:
blocking - indicates if the functions is blocked until the shutdown task is finished. If it is true, the function returns when the kernel is down. If it is false, the function could return before the kernel is down.
Throws exception:
  • java.lang.InterruptedException: the shutdown process is interrupted.
Since:
0.10
See:
shutdown , shutdown(int)
shutdown(int)
def shutdown(int)

throws java.lang.InterruptedException

Stop the SRE. This function may cause the agents to stop during the run of a behavior. This function returns when the kernel and all its services are stopped.
Parameters:
timeout - the maximum amount of milliseconds to wait for the shutdown. If the provided value is strictly positive, it is the number of milliseconds to wait for the termination of the shutdown. If the provided value is equal to 0, the function returns as soon as the shutdown process is launch (no waiting for the termination of the shutdown). If the value is strictly negative, the function waits forever for the termination of the shutdown process. The default value is -1.
Throws exception:
  • java.lang.InterruptedException: the shutdown process is interrupted.
Since:
0.11
See:
shutdown , shutdown(boolean) , shutdown(int)
startAgent(Class<T>,Object*)
def startAgent(Class<T>,Object*)

throws java.lang.Exception

Launch the SRE and the first agent in the kernel.

To know the identifier of the started agent, you must start the initial agent with startAgentWithID(Class, UUID, Object...).
Parameters:
agentCls - type of the first agent to launch.
params - parameters to pass to the agent as its initialization parameters.
Throws exception:
  • java.lang.Exception: - if it is impossible to start the platform.
See:
startAgentWithID(Class<T>,UUID,Object*)
startAgent(int,Class<T>,Object*)
def startAgent(int,Class<T>,Object*)

throws java.lang.Exception

Launch the SRE and the first agent in the kernel.

To know the identifier of the started agent, you must start the initial agent with startAgentWithID(Class, UUID, Object...).
Parameters:
nbAgents - the number of agents to be launched.
agentCls - type of the first agent to launch.
params - parameters to pass to the agent as its initialization parameters.
Throws exception:
  • java.lang.Exception: - if it is impossible to start the platform.
See:
startAgentWithID(Class<T>,UUID,Object*)
startAgentWithID(Class<T>,UUID,Object*)
def startAgentWithID(Class<T>,UUID,Object*)

throws java.lang.Exception

Launch the SRE and the first agent in the kernel and assigning a specific UUID.
Parameters:
agentCls - type of the first agent to launch.
agentID - the identifier of the agent to be created.
params - parameters to pass to the agent as its initialization parameters.
Throws exception:
  • java.lang.Exception: - if it is impossible to start the platform.
Since:
0.10
startWithoutAgent
def startWithoutAgent : AgentContext
Start the SRE without an agent. This function prepare the default context.
Returns:
the context that is created by the bootstrap. If null there is no context created.
Since:
0.7
startWithoutAgent(boolean)
def startWithoutAgent(boolean) : AgentContext
Start the SRE without an agent. This function prepare the default context.
Parameters:
asCommandLineApp - indicates if the application should be started as a commend-line application. If true, the SRE is started and run directly. Then, the "start agent" functions becomes unusable because the SRE has started everything as it is called from the shell command line. If false, the SRE is started in is normal way and all the functions are available according to their own specifications. If it not recommended to invoke this function with this argument evaluated to true.
Returns:
the context that is created by the bootstrap. If null there is no context created.
Since:
0.12
See:
startWithoutAgent