public class ServerManager extends Object implements AutoCloseable
| Modifier and Type | Method and Description |
|---|---|
void |
addServer(@NonNull String host,
int port)
Deprecated.
|
void |
addServer(@NonNull String host,
int port,
String certificate)
Add a server into the manager
|
void |
addServerListener(@NonNull ServerListener siLAServerListener)
Add additional listener to retrieve SiLA Server information in-process
|
void |
clear()
Clear any servers from manager
|
void |
close() |
ClientInterceptor |
getClientInterceptor()
Get client interceptor
|
Map<UUID,Connection> |
getConnections()
Get server connections
|
static ServerManager |
getInstance()
Create a SiLAManager instance if not already present and returns it.
|
Map<UUID,Server> |
getServers()
Get the map of servers
|
void |
initialize(@NonNull Map<UUID,Server> silaServers)
Initialise SiLA Manager with pre-defined SiLA Servers, e.g.
|
void |
removeServer(@NonNull UUID id)
Removing Server manually
|
void |
removeServerListener(@NonNull ServerListener siLAServerListener)
Remove server listener
|
void |
setAllowUnsecureConnection(boolean allowUnsecureConnection) |
void |
setClientInterceptor(ClientInterceptor clientInterceptor)
Set client interceptor
|
void |
setServerName(@NonNull UUID id,
@NonNull String newServerName)
Set the Status of a Server
|
public static ServerManager getInstance()
RuntimeException - if unable to build SslContext during first callpublic void initialize(@NonNull
@NonNull Map<UUID,Server> silaServers)
silaServers - Map containing all predefined SiLAServerspublic void clear()
public void close()
close in interface AutoCloseablepublic void setAllowUnsecureConnection(boolean allowUnsecureConnection)
public void removeServer(@NonNull
@NonNull UUID id)
id - Server Id used for referencing to the Server@Deprecated public void addServer(@NonNull @NonNull String host, int port) throws ServerConnectionException
host - Host on which SiLA Server is exposedport - Port on which SiLA Server is exposedServerConnectionException - if unable to add the serverpublic void addServer(@NonNull
@NonNull String host,
int port,
String certificate)
throws ServerConnectionException
host - the server hostport - the server portcertificate - the server certificateServerConnectionException - if the server could not be addedpublic void setServerName(@NonNull
@NonNull UUID id,
@NonNull
@NonNull String newServerName)
id - Server IdnewServerName - String Server Namepublic Map<UUID,Server> getServers()
public Map<UUID,Connection> getConnections()
public void addServerListener(@NonNull
@NonNull ServerListener siLAServerListener)
public void removeServerListener(@NonNull
@NonNull ServerListener siLAServerListener)
siLAServerListener - the server listenerpublic ClientInterceptor getClientInterceptor()
public void setClientInterceptor(ClientInterceptor clientInterceptor)
clientInterceptor - the client interceptorCopyright © 2022 SiLA Java Developers. All rights reserved.