public class MetaModel extends Object
| Constructor and Description |
|---|
MetaModel(TopologyLayerCallback topology,
Executor changeExecutor)
Creates a
MetaModel where the root object of the domain model is received from another node. |
MetaModel(TopologyLayerCallback topology,
Object root,
Executor changeExecutor)
Creates a
MetaModel which serves a new domain model. |
| Modifier and Type | Method and Description |
|---|---|
void |
commandsForDomainModel(CommandsForDomainModelCallback callback)
This method creates the commands necessary to reproduce the entire domain model.
|
void |
execute(List<Command> commands)
Executes commands to change the domain model of the user.
|
public MetaModel(TopologyLayerCallback topology, Executor changeExecutor)
MetaModel where the root object of the domain model is received from another node.topology - used to interact with the lower layer which is probably represented by the class that called
this constructor.changeExecutor - The executor to use for all changes done to JavaFX properties.public MetaModel(TopologyLayerCallback topology, Object root, Executor changeExecutor)
MetaModel which serves a new domain model.topology - see MetaModel(TopologyLayerCallback, Executor)root - The root object of the domain model that should be served.changeExecutor - The executor to use for all changes done to JavaFX properties.MetaModel(TopologyLayerCallback, Executor)public void execute(List<Command> commands)
These commands have usually been created by an other instance of MetaModel in an other JVM which send
them via TopologyLayerCallback.sendCommands(List) or produced them through
commandsForDomainModel(CommandsForDomainModelCallback).
If you need to send these commands to other peers e.g. when you are the server in an client/server
environment, please call this method first an than redistribute the commands. This call blocks when one of
your threads called commandsForDomainModel(CommandsForDomainModelCallback) and hasn't
finished yet. When this happens, the commands you've passed as argument to this method will not be
incorporated into the command list returned by your
commandsForDomainModel(CommandsForDomainModelCallback) and so you may want to also
redistribute them to the new client that's the reason you've called
commandsForDomainModel(CommandsForDomainModelCallback).
commands - The commands that should be executed.public void commandsForDomainModel(CommandsForDomainModelCallback callback)
The API of this method may looks a bit odd as the commands produced are returned via a callback instead of return but this is necessary to ensure that no updated are lost for newly connecting peers.
Make sure that commands you receive via TopologyLayerCallback.sendCommands(List) are not send to the
peer you've requested this initial set of commands for before your callback is called. Make also sure that
future calls of TopologyLayerCallback.sendCommands(List) will send the changes to this new peer before
your callback returns.
It is guaranteed that your callback is only called once and that this call happens before
commandsForDomainModel(CommandsForDomainModelCallback) returns.
callback - The callback that takes the commands.Copyright © 2014 Saxonia Systems AG. All Rights Reserved.