public class ServerManager extends Object implements AutoCloseable
| Modifier and Type | Method and Description |
|---|---|
void |
addServer(@NonNull String host,
int port)
Add Server to the manager
|
Server |
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() |
io.grpc.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 |
setAllowInsecureConnection(boolean allowInsecureConnection)
Deprecated.
|
void |
setClientInterceptor(io.grpc.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 AutoCloseable@Deprecated public void setAllowInsecureConnection(boolean allowInsecureConnection)
public void removeServer(@NonNull
@NonNull UUID id)
id - Server Id used for referencing to the Serverpublic 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 Server 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 io.grpc.ClientInterceptor getClientInterceptor()
public void setClientInterceptor(io.grpc.ClientInterceptor clientInterceptor)
clientInterceptor - the client interceptorCopyright © 2024 SiLA Java Developers. All rights reserved.