java.lang.Object
is.codion.common.rmi.server.AbstractServer<AbstractServerEntityConnection,EntityServerAdmin>
is.codion.framework.server.EntityServer
- All Implemented Interfaces:
Server<AbstractServerEntityConnection,,EntityServerAdmin> Remote
A remote server serving
ServerEntityConnection instances to clients.-
Nested Class Summary
Nested classes/interfaces inherited from class is.codion.common.rmi.server.AbstractServer
AbstractServer.SessionConnection<T>Nested classes/interfaces inherited from interface is.codion.common.rmi.server.Server
Server.Locator -
Field Summary
Fields inherited from interface is.codion.common.rmi.server.Server
CLIENT_HOST -
Constructor Summary
ConstructorsConstructorDescriptionEntityServer(EntityServerConfiguration configuration) Constructs a new EntityServer, publishing nothing untilstarted. -
Method Summary
Modifier and TypeMethodDescriptionfinal EntityServerAdminReturns the admin interface used to administer this serverprotected final AbstractServerEntityConnectionconnect(RemoteSession session) Establishes the actual connection.protected AbstractServerEntityConnectioncreateConnection(Database database, RemoteSession session, int port, @Nullable RMIClientSocketFactory clientSocketFactory, @Nullable RMIServerSocketFactory serverSocketFactory) Creates the connection this server provides to a client sessionprotected final voiddisconnect(AbstractServerEntityConnection connection) Disconnects the given connection.static voidIf no arguments are supplied a new EntityServer is started.protected final voidmaintainConnections(Collection<AbstractServer.SessionConnection<AbstractServerEntityConnection>> connections) Maintains the given connections, that is, disconnects inactive or invalid connections, if required.static EntityServerConstructs and starts the server, using the configuration from system properties.static EntityServerstartServer(EntityServerConfiguration configuration) Constructs and starts the server.Methods inherited from class is.codion.common.rmi.server.AbstractServer
addShutdownListener, auxiliaryServers, connect, connection, connectionCount, connectionLimit, connectionLimit, connections, connectionsAvailable, disconnect, getAdmin, information, logShutdownAndReturn, maintenanceInterval, maintenanceInterval, registry, setAdmin, shutdown, start, validateUserCredentials
-
Constructor Details
-
EntityServer
Constructs a new EntityServer, publishing nothing untilstarted.- Parameters:
configuration- the server configuration- Throws:
RemoteException- in case of a remote exceptionRuntimeException- in case the domain model classes are not found on the classpath or if the jdbc driver class is not found or in case of an exception while constructing the initial pooled connections
-
-
Method Details
-
admin
Description copied from interface:ServerReturns the admin interface used to administer this server- Parameters:
user- the server admin user- Returns:
- the administration interface for this server
- Throws:
ServerAuthenticationException- in case authentication failsIllegalStateException- in case no server admin instance is available
-
connect
protected final AbstractServerEntityConnection connect(RemoteSession session) throws RemoteException, LoginException Description copied from class:AbstractServerEstablishes the actual connection.- Specified by:
connectin classAbstractServer<AbstractServerEntityConnection,EntityServerAdmin> - Parameters:
session- the remote session- Returns:
- a connection for the given session
- Throws:
RemoteException- in case of an exceptionLoginException- in case of an error during the login
-
disconnect
Description copied from class:AbstractServerDisconnects the given connection.- Specified by:
disconnectin classAbstractServer<AbstractServerEntityConnection,EntityServerAdmin> - Parameters:
connection- the connection to disconnect- Throws:
RemoteException- in case of an exception
-
createConnection
protected AbstractServerEntityConnection createConnection(Database database, RemoteSession session, int port, @Nullable RMIClientSocketFactory clientSocketFactory, @Nullable RMIServerSocketFactory serverSocketFactory) throws RemoteException Creates the connection this server provides to a client session- Parameters:
database- the underlying databasesession- the session the connection servesport- the port to use when exporting the connection, negative to not export itclientSocketFactory- the client socket factory, null for defaultserverSocketFactory- the server socket factory, null for default- Returns:
- the connection
- Throws:
RemoteException- in case of an exceptionDatabaseException- in case a database connection can not be established, for example if a wrong username or password is provided
-
maintainConnections
protected final void maintainConnections(Collection<AbstractServer.SessionConnection<AbstractServerEntityConnection>> connections) throws RemoteException Description copied from class:AbstractServerMaintains the given connections, that is, disconnects inactive or invalid connections, if required.- Specified by:
maintainConnectionsin classAbstractServer<AbstractServerEntityConnection,EntityServerAdmin> - Parameters:
connections- all current connections- Throws:
RemoteException- in case of an exception
-
startServer
Constructs and starts the server, using the configuration from system properties.- Returns:
- the server instance
- Throws:
RemoteException- in case of an exception
-
startServer
public static EntityServer startServer(EntityServerConfiguration configuration) throws RemoteException Constructs and starts the server.- Parameters:
configuration- the configuration- Returns:
- the server instance
- Throws:
RemoteException- in case of an exception- See Also:
-
main
If no arguments are supplied a new EntityServer is started.- Parameters:
arguments- 'shutdown' (case-insensitive) causes a running server to be shut down, otherwise a server is started- Throws:
RemoteException- in case of a remote exception during service exportServerAuthenticationException- in case of missing or incorrect admin user information
-