public final class Servers
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static java.rmi.registry.Registry |
getRegistry(int port) |
static <T extends java.rmi.Remote,A extends java.rmi.Remote> |
getServer(java.lang.String serverHostName,
java.lang.String serverNamePrefix,
int registryPort,
int requestedServerPort)
Retrieves a Server from a registry running on the given host, using the
given server name prefix as a condition.
|
static java.rmi.registry.Registry |
initializeRegistry(int port)
Initializes a Registry if one is not running
|
static RemoteClient |
remoteClient(ConnectionRequest connectionRequest)
Instantiates a new RemoteClient
|
static RemoteClient |
remoteClient(ConnectionRequest connectionRequest,
User databaseUser)
Instantiates a new RemoteClient
|
static RemoteClient |
remoteClient(RemoteClient remoteClient,
User databaseUser)
Instantiates a new RemoteClient based on the given client
but with the specified database user
|
static void |
resolveTrustStoreFromClasspath(java.lang.String temporaryFileNamePrefix)
Reads the trust store specified by "javax.net.ssl.trustStore" from the classpath, copies it
to a temporary file and sets the trust store property so that it points to that temporary file.
|
public static RemoteClient remoteClient(ConnectionRequest connectionRequest)
connectionRequest
- the connection requestpublic static RemoteClient remoteClient(ConnectionRequest connectionRequest, User databaseUser)
connectionRequest
- the connection requestdatabaseUser
- the user to use when connecting to the underlying databasepublic static RemoteClient remoteClient(RemoteClient remoteClient, User databaseUser)
remoteClient
- the remote client to copydatabaseUser
- the database user to usepublic static java.rmi.registry.Registry initializeRegistry(int port) throws java.rmi.RemoteException
port
- the port on which to look for (or create) a registryjava.rmi.RemoteException
- in case of an exceptionpublic static java.rmi.registry.Registry getRegistry(int port) throws java.rmi.RemoteException
port
- the port on which to look for a registryjava.rmi.RemoteException
- in case of an exceptionpublic static <T extends java.rmi.Remote,A extends java.rmi.Remote> Server<T,A> getServer(java.lang.String serverHostName, java.lang.String serverNamePrefix, int registryPort, int requestedServerPort) throws java.rmi.RemoteException, java.rmi.NotBoundException
T
- the Remote object type served by the serverA
- the server admin type supplied by the serverserverHostName
- the name of the hostserverNamePrefix
- the server name prefix, an empty string results in all servers being returnedregistryPort
- the port on which to lookup the registryrequestedServerPort
- the required server port, -1 for any portjava.rmi.RemoteException
- in case of a remote exceptionjava.rmi.NotBoundException
- in case no such server is foundpublic static void resolveTrustStoreFromClasspath(java.lang.String temporaryFileNamePrefix)
temporaryFileNamePrefix
- the prefix to use for the temporary filenameServer.TRUSTSTORE