public interface CommandTransferServer
This is the interface to the underlying network library that serializes and transfers the Commands produced
by this framework.
All methods defined in here are intended to be used by SynchronizeFxClient and not by the user.
Any implementation must be capable of transferring all classes in the package
de.saxsys.synchronizefx.core.metamodel.commands, the class java.util.UUID and all classes of the user
domain model that doesn't contain any Fields that extend Property. You may wan't the user to provide them
manually if your implementation hasn't any generic system to handle any Object that is thrown on it.
It is guaranteed that setTopologyLayerCallback(NetworkToTopologyCallbackServer) is only
called before start() and the send methods only after
start() (maybe multiple times). It is also guaranteed that no more methods are called
after shutdown() was called.
If you support user supplied serializers, please use the Serializer interface for them. This way serializers
are usable for multiple CommandTransferServer implementations.
This is the server side. For the client side see CommandTransferClient.
| Modifier and Type | Method and Description |
|---|---|
void |
onConnectFinished(Object client)
Called in response to
NetworkToTopologyCallbackServer.onConnect(Object) when the setup for the new client
has finished. |
void |
send(List<Command> commands,
Object client)
Sends commands to a single client.
|
void |
sendToAll(List<Command> commands)
Sends commands to all connected peers.
|
void |
sendToAllExcept(List<Command> commands,
Object nonReciver)
Sends a commands to all peers except to
nonReciver. |
void |
setTopologyLayerCallback(NetworkToTopologyCallbackServer callback)
Sets the callback to the topology layer for events like incoming commands, new connections or errors.
|
void |
shutdown()
Disconnect all clients that are still connected an shut down the Server.
|
void |
start()
Starts the server and make it listen for new client connections.
|
void setTopologyLayerCallback(NetworkToTopologyCallbackServer callback)
callback - The callbackvoid start()
throws SynchronizeFXException
SynchronizeFXException - when the start up of the server failed.void onConnectFinished(Object client)
NetworkToTopologyCallbackServer.onConnect(Object) when the setup for the new client
has finished.
Ensure that send in this interface can take account of the new client before you return from this
method.client - The client which was set up.void sendToAll(List<Command> commands)
onConnectFinished(Object) has be
called for it so don't send the commands to clients where this method has not been called yet.commands - The commands to send. The commands don't need to be send all at once but their order must not be
changed.void send(List<Command> commands, Object client)
commands - The commands to send. The commands don't need to be send all at once but their order must not be
changed.client - the destination to which this method should be send. Only objects returned by
NetworkToTopologyCallbackServer.recive(List, Object) as sender are valid destinations.void sendToAllExcept(List<Command> commands, Object nonReciver)
nonReciver.
In this context, a peer is connected only after onConnectFinished(Object) has be
called for it so don't send the commands to clients where this method has not been called yet.commands - The commands to be send. The commands don't need to be send all at once but their order must not be
changed.nonReciver - The client that should not receive the command.void shutdown()
Copyright © 2015 Saxonia Systems AG. All Rights Reserved.