public abstract class AbstractJavaMole extends java.lang.Object implements Mole
Modifier | Constructor and Description |
---|---|
protected |
AbstractJavaMole(java.util.Set<io.molr.commons.domain.Mission> availableMissions) |
Modifier and Type | Method and Description |
---|---|
protected abstract MissionExecutor |
executorFor(io.molr.commons.domain.Mission mission,
java.util.Map<java.lang.String,java.lang.Object> params) |
reactor.core.publisher.Mono<io.molr.commons.domain.MissionHandle> |
instantiate(io.molr.commons.domain.Mission mission,
java.util.Map<java.lang.String,java.lang.Object> params)
Instantiates the given mission with the given parameters (Currently only string and integer parameters are
supported).
|
void |
instruct(io.molr.commons.domain.MissionHandle handle,
io.molr.commons.domain.Strand strand,
io.molr.commons.domain.StrandCommand command)
Instructs the mission instance identified by the given handle to execute the given command on the given strand.
|
void |
instructRoot(io.molr.commons.domain.MissionHandle handle,
io.molr.commons.domain.StrandCommand command)
Instructs the root strand of the mission identified by the given handle to execute a given command.
|
protected abstract io.molr.commons.domain.MissionParameterDescription |
missionParameterDescriptionOf(io.molr.commons.domain.Mission mission) |
protected abstract io.molr.commons.domain.MissionRepresentation |
missionRepresentationOf(io.molr.commons.domain.Mission mission) |
reactor.core.publisher.Flux<io.molr.commons.domain.MissionOutput> |
outputsFor(io.molr.commons.domain.MissionHandle handle)
Retrieves a stream of the actual output of one mission instance.
|
reactor.core.publisher.Mono<io.molr.commons.domain.MissionParameterDescription> |
parameterDescriptionOf(io.molr.commons.domain.Mission mission)
Retrieves information on what parameters a mission expects (name, type, optional or mandatory).
|
reactor.core.publisher.Mono<io.molr.commons.domain.MissionRepresentation> |
representationOf(io.molr.commons.domain.Mission mission)
Retrieves the initial (!) representation of a mission, meaning when the mission is not instantiated/running.
|
reactor.core.publisher.Flux<io.molr.commons.domain.MissionRepresentation> |
representationsFor(io.molr.commons.domain.MissionHandle handle)
Delivers updates of the representation of the mission.
|
reactor.core.publisher.Flux<io.molr.commons.domain.AgencyState> |
states()
Retrieves a stream of the actual
AgencyState . |
reactor.core.publisher.Flux<io.molr.commons.domain.MissionState> |
statesFor(io.molr.commons.domain.MissionHandle handle)
Retrieves a stream emitting new items anytime the state of the mission instance changes.
|
protected AbstractJavaMole(java.util.Set<io.molr.commons.domain.Mission> availableMissions)
public reactor.core.publisher.Mono<io.molr.commons.domain.MissionHandle> instantiate(io.molr.commons.domain.Mission mission, java.util.Map<java.lang.String,java.lang.Object> params)
Mole
Strand
on its first (or only) Block
.
At this point in time, commands can be sent to the mission instance through the Mole.instruct(MissionHandle,
Strand, StrandCommand)
method (non-allowed commands shall be ignored by the agency and the underlying moles).
The allowed commands (and other information) can be queried through the Mole.statesFor(MissionHandle)
method.
instantiate
in interface Mole
mission
- the mission which shall be instantiatedparams
- a map from parameter name to parameter value to instantiate the missionpublic reactor.core.publisher.Mono<io.molr.commons.domain.MissionParameterDescription> parameterDescriptionOf(io.molr.commons.domain.Mission mission)
Mole
parameterDescriptionOf
in interface Mole
mission
- the mission for which the information shall be queried.public reactor.core.publisher.Flux<io.molr.commons.domain.AgencyState> states()
Mole
AgencyState
. This state contains information about all the available
missions and those which are currently instantiated. The stream shall emit a new item whenever the state changes
and shall be long-living, so basically never complete during the lifetime of the agency.public final reactor.core.publisher.Flux<io.molr.commons.domain.MissionState> statesFor(io.molr.commons.domain.MissionHandle handle)
Mole
statesFor
in interface Mole
handle
- a handle representing the mission instance for which the states shall be retrievedpublic final reactor.core.publisher.Flux<io.molr.commons.domain.MissionOutput> outputsFor(io.molr.commons.domain.MissionHandle handle)
Mole
outputsFor
in interface Mole
handle
- a handle representing the mission instance for which the output shall be queried.public final reactor.core.publisher.Flux<io.molr.commons.domain.MissionRepresentation> representationsFor(io.molr.commons.domain.MissionHandle handle)
Mole
representationsFor
in interface Mole
handle
- the handle of the mission for which to retrieve representation updatespublic reactor.core.publisher.Mono<io.molr.commons.domain.MissionRepresentation> representationOf(io.molr.commons.domain.Mission mission)
Mole
Mole.representationsFor(MissionHandle)
, to be notified of any changes in the
representation.representationOf
in interface Mole
mission
- the mission for which to retrieve the initial (!) representationpublic final void instruct(io.molr.commons.domain.MissionHandle handle, io.molr.commons.domain.Strand strand, io.molr.commons.domain.StrandCommand command)
Mole
Mole.statesFor(MissionHandle)
. However,
due to the asynchronous nature of the whole framework, it can never be guaranteed that the command is still
allowed when sent. For that reason, non-allowed commands shall be ignored by the implementations of an agency and
underlying moles.public final void instructRoot(io.molr.commons.domain.MissionHandle handle, io.molr.commons.domain.StrandCommand command)
Mole
Mole.instruct(MissionHandle, Strand, StrandCommand)
method.instructRoot
in interface Mole
handle
- a handle representing the mission instance on which the command shall be executedcommand
- the command to execute.protected abstract MissionExecutor executorFor(io.molr.commons.domain.Mission mission, java.util.Map<java.lang.String,java.lang.Object> params)
protected abstract io.molr.commons.domain.MissionRepresentation missionRepresentationOf(io.molr.commons.domain.Mission mission)
protected abstract io.molr.commons.domain.MissionParameterDescription missionParameterDescriptionOf(io.molr.commons.domain.Mission mission)