public class MetaModel extends Object
| Constructor and Description |
|---|
MetaModel(TopologyLayerCallback topology)
Creates a
MetaModel where the root object of the domain model is received from another node. |
MetaModel(TopologyLayerCallback topology,
Object root)
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<Object> commands)
Executes commands to change the domain model of the user.
|
Object |
getById(UUID id)
Returns a object that is identified by an id.
|
UUID |
getId(Object object)
Returns the id for an object.
|
boolean |
isDoChangesInJavaFxThread() |
void |
setDoChangesInJavaFxThread(boolean doChangesInJavaFxThread) |
public MetaModel(TopologyLayerCallback topology)
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.public MetaModel(TopologyLayerCallback topology, Object root)
MetaModel which serves a new domain model.topology - see MetaModel(TopologyLayerCallback)root - The root object of the domain model that should be served.MetaModel(TopologyLayerCallback)public boolean isDoChangesInJavaFxThread()
true when all changes to the user domain model have to be done in the JavaFX thread and false
otherwise.public void setDoChangesInJavaFxThread(boolean doChangesInJavaFxThread)
doChangesInJavaFxThread - the new valueisDoChangesInJavaFxThread()public void execute(List<Object> 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
MetaModel#commandsForDomainModel().
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
MetaModel#commandsForDomainModel() 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
MetaModel#commandsForDomainModel() and so you may want to also redistribute them to the new client that's
the reason you've called MetaModel#commandsForDomainModel().
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.public Object getById(UUID id)
id - The idCopyright © 2014 Saxonia Systems AG. All Rights Reserved.