Package velox.api.layer1
Interface Layer1ApiAdminListener
- All Known Subinterfaces:
Layer1ApiAdapter,Layer1ApiAdminAdapter,Layer1ApiListener
- All Known Implementing Classes:
Layer1ApiDepthFreezer,Layer1ApiInjectorRelay,Layer1ApiRelay,Layer1ApiStrategiesEchoMessagesLayer,Layer1ApiUpstreamRelay
@DefaultQualifier(org.checkerframework.checker.nullness.qual.NonNull.class)
public interface Layer1ApiAdminListener
Listens to general events, such as login and connection state, system messages and upstream user messages.
-
Method Summary
Modifier and TypeMethodDescriptionvoidonConnectionLost(DisconnectionReason reason, @Nullable String message) Connection to server lost.voidConnection to server restored.voidonLoginFailed(LoginFailedReason reason, @Nullable String message) Failed to log in with specified credentialsvoidSuccessful login.voidonSystemTextMessage(String message, SystemTextMessageType messageType) Passes the message into Bookmap and shows it as a popup.voidonUserMessage(Object data) Send an upstream event.
-
Method Details
-
onLoginFailed
Failed to log in with specified credentials- Parameters:
reason- Reason codemessage- test message associated with login fail
-
onLoginSuccessful
void onLoginSuccessful()Successful login. -
onConnectionLost
Connection to server lost. Provider can call this method multiple times in sequence if the reason was changed (i.e. fromDisconnectionReason.NO_INTERNETtoDisconnectionReason.FATAL)- Parameters:
reason- Reason codemessage- text message associated with login disconnection
-
onConnectionRestored
void onConnectionRestored()Connection to server restored. A provider should call it only if it previously invokedonConnectionLost(DisconnectionReason, String) -
onSystemTextMessage
Passes the message into Bookmap and shows it as a popup. It is suitable for 1-time notifications, but for the general case take a look at the notifications API -Layer1ApiSoundAlertMessage- Parameters:
message- message itselfmessageType- message type- See Also:
-
onUserMessage
Send an upstream event. Allows incorporating arbitrary functionality into protocol.This is the extension point of the upstream direction: any layer or the provider may emit an arbitrary object, and it travels towards the GUI through every layer above the origin. The counterpart for the downstream direction is
Layer1ApiAdminProvider.sendUserMessage(Object).Contract for layers: inspect the message by type, act on the ones you understand and pass every other message on unchanged. Swallowing an unknown message breaks layers above you.
Messages emitted by Bookmap use classes from
velox.api.layer1.messages. Some of them are sent in response to a downstream request and arrive asynchronously, after the correspondingsendUserMessagecall has already returned.- Parameters:
data- Message content, never null
-