public class DefaultEntityConnectionServer extends AbstractServer<AbstractRemoteEntityConnection,EntityConnectionServerAdmin>
Server.AuxiliaryServer, Server.ServerInfo
Modifier and Type | Field and Description |
---|---|
protected static org.slf4j.Logger |
LOG |
protected static java.lang.String |
RESTART |
static PropertyValue<java.lang.Boolean> |
SERIALIZATION_FILTER_DRYRUN
If true then the serialization whitelist specified by
SERIALIZATION_FILTER_WHITELIST is populated
with the names of all deserialized classes on server shutdown. |
static PropertyValue<java.lang.String> |
SERIALIZATION_FILTER_WHITELIST
The serialization whitelist file to use if any
|
static PropertyValue<java.lang.String> |
SERVER_CLIENT_CONNECTION_TIMEOUT
Specifies the default client connection timeout (ms) in a comma separated list.
|
static PropertyValue<java.lang.Boolean> |
SERVER_CLIENT_LOGGING_ENABLED
The initial connection logging status on the server, either true (on) or false (off)
Value type: Boolean Default value: false |
static PropertyValue<java.lang.Integer> |
SERVER_CONNECTION_LIMIT
Specifies maximum number of concurrent connections the server accepts
-1 indicates no limit and 0 indicates a closed server. |
static PropertyValue<java.lang.String> |
SERVER_CONNECTION_POOL_PROVIDER_CLASS
Specifies the class name of the connection pool provider to user, if none is specified
the internal connection pool is used if necessary
Value type: String Default value: none |
static PropertyValue<java.lang.String> |
SERVER_CONNECTION_POOLING_STARTUP_POOL_USERS
Specifies a comma separated list of username:password combinations for which to create connection pools on startup
Example: scott:tiger,john:foo,paul:bar
|
static PropertyValue<java.lang.String> |
SERVER_CONNECTION_VALIDATOR_CLASSES
Specifies a comma separated list of ConnectionValidator class names, which should be initialized on server startup,
these classes must be available on the server classpath and contain a parameterless constructor
|
static PropertyValue<java.lang.String> |
SERVER_DOMAIN_MODEL_CLASSES
Specifies a comma separated list of domain model class names, these classes must be
available on the server classpath
|
static PropertyValue<java.lang.String> |
SERVER_LOGIN_PROXY_CLASSES
Specifies a comma separated list of LoginProxy class names, which should be initialized on server startup,
these classes must be available on the server classpath and contain a parameterless constructor
|
protected static java.lang.String |
SHUTDOWN |
protected static java.lang.String |
START |
protected static java.lang.String |
STOP |
AUXILIARY_SERVER_CLASS_NAMES, CLIENT_HOST_KEY, DEFAULT_SERVER_CONNECTION_TIMEOUT, JAVAX_NET_KEYSTORE, JAVAX_NET_KEYSTORE_PASSWORD, JAVAX_NET_TRUSTSTORE, JAVAX_NET_TRUSTSTORE_PASSWORD, KEYSTORE, KEYSTORE_PASSWORD, LOCALHOST, REGISTRY_PORT, RMI_SERVER_HOSTNAME, SERVER_ADMIN_PORT, SERVER_ADMIN_USER, SERVER_CONNECTION_SSL_ENABLED, SERVER_CONNECTION_TIMEOUT, SERVER_HOST_NAME, SERVER_NAME_PREFIX, SERVER_PORT, TRUSTSTORE, TRUSTSTORE_PASSWORD
Constructor and Description |
---|
DefaultEntityConnectionServer(java.lang.String serverName,
int serverPort,
int serverAdminPort,
int registryPort,
Database database,
boolean sslEnabled,
int connectionLimit,
java.util.Collection<java.lang.String> domainModelClassNames,
java.util.Collection<java.lang.String> loginProxyClassNames,
java.util.Collection<java.lang.String> connectionValidatorClassNames,
java.util.Collection<User> startupPoolUsers,
java.util.Collection<java.lang.String> auxiliaryServerClassNames,
boolean clientLoggingEnabled,
int connectionTimeout,
java.util.Map<java.lang.String,java.lang.Integer> clientSpecificConnectionTimeouts,
User adminUser)
Constructs a new DefaultEntityConnectionServer and binds it to a registry on the given port
|
Modifier and Type | Method and Description |
---|---|
protected AbstractRemoteEntityConnection |
createRemoteConnection(ConnectionPool connectionPool,
Database database,
RemoteClient remoteClient,
int port,
boolean clientLoggingEnabled,
java.rmi.server.RMIClientSocketFactory clientSocketFactory,
java.rmi.server.RMIServerSocketFactory serverSocketFactory)
Creates the remote connection provided by this server
|
protected AbstractRemoteEntityConnection |
doConnect(RemoteClient remoteClient)
Establishes the actual client connection.
|
protected void |
doDisconnect(AbstractRemoteEntityConnection connection)
Disconnects the given connection.
|
protected static java.util.Map<java.lang.String,java.lang.Integer> |
getClientTimeoutValues() |
protected static java.util.Collection<User> |
getPoolUsers(java.util.Collection<java.lang.String> poolUsers) |
EntityConnectionServerAdmin |
getServerAdmin(User user)
Returns the admin intarface used to administer this server
|
int |
getServerLoad() |
protected void |
handleShutdown()
Called after shutdown has finished, for subclasses
|
protected static java.lang.String |
initializeServerName(java.lang.String databaseHost,
java.lang.String sid) |
boolean |
isClientLoggingEnabled() |
static void |
main(java.lang.String[] arguments)
If no arguments are supplied a new DefaultEntityConnectionServer is started.
|
static DefaultEntityConnectionServer |
startServer()
Starts the server
|
addSharedLoginProxy, connect, connectionsAvailable, disconnect, getConnection, getConnectionCount, getConnectionLimit, getConnections, getServerInfo, isShuttingDown, setConnectionLimit, setConnectionValidator, setLoginProxy, shutdown, validateUserCredentials
clone, exportObject, exportObject, exportObject, unexportObject
public static final PropertyValue<java.lang.String> SERIALIZATION_FILTER_WHITELIST
public static final PropertyValue<java.lang.Boolean> SERIALIZATION_FILTER_DRYRUN
SERIALIZATION_FILTER_WHITELIST
is populated
with the names of all deserialized classes on server shutdown. Note this overwrites the file if it already exists.public static final PropertyValue<java.lang.String> SERVER_CONNECTION_POOL_PROVIDER_CLASS
ConnectionPoolProvider
public static final PropertyValue<java.lang.Integer> SERVER_CONNECTION_LIMIT
public static final PropertyValue<java.lang.String> SERVER_CLIENT_CONNECTION_TIMEOUT
public static final PropertyValue<java.lang.Boolean> SERVER_CLIENT_LOGGING_ENABLED
public static final PropertyValue<java.lang.String> SERVER_CONNECTION_POOLING_STARTUP_POOL_USERS
public static final PropertyValue<java.lang.String> SERVER_CONNECTION_VALIDATOR_CLASSES
ConnectionValidator
public static final PropertyValue<java.lang.String> SERVER_LOGIN_PROXY_CLASSES
LoginProxy
public static final PropertyValue<java.lang.String> SERVER_DOMAIN_MODEL_CLASSES
protected static final org.slf4j.Logger LOG
protected static final java.lang.String START
protected static final java.lang.String STOP
protected static final java.lang.String SHUTDOWN
protected static final java.lang.String RESTART
public DefaultEntityConnectionServer(java.lang.String serverName, int serverPort, int serverAdminPort, int registryPort, Database database, boolean sslEnabled, int connectionLimit, java.util.Collection<java.lang.String> domainModelClassNames, java.util.Collection<java.lang.String> loginProxyClassNames, java.util.Collection<java.lang.String> connectionValidatorClassNames, java.util.Collection<User> startupPoolUsers, java.util.Collection<java.lang.String> auxiliaryServerClassNames, boolean clientLoggingEnabled, int connectionTimeout, java.util.Map<java.lang.String,java.lang.Integer> clientSpecificConnectionTimeouts, User adminUser) throws java.rmi.RemoteException
serverName
- the serverNameserverPort
- the port on which to make the server accessibleserverAdminPort
- the port on which to make the server admin interface accessibleregistryPort
- the registry port to usedatabase
- the Database implementationsslEnabled
- if true then ssl is enabledconnectionLimit
- the maximum number of concurrent connections, -1 for no limitdomainModelClassNames
- the domain model classes to load on startuploginProxyClassNames
- the login proxy classes to initialize on startupconnectionValidatorClassNames
- the connection validation classes to initialize on startupstartupPoolUsers
- the users for which to initialize connection pools on startupauxiliaryServerClassNames
- the class names of auxiliary servers to run alongside this serverclientLoggingEnabled
- if true then client logging is enabled on startupconnectionTimeout
- the idle connection timeoutclientSpecificConnectionTimeouts
- client specific connection timeouts, mapped to clientTypeIdadminUser
- the admin userjava.rmi.RemoteException
- in case of a remote exceptionjava.lang.RuntimeException
- 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 connectionspublic final EntityConnectionServerAdmin getServerAdmin(User user) throws ServerException.AuthenticationException
Server
user
- the server admin userServerException.AuthenticationException
- in case authentication failspublic final int getServerLoad()
public final boolean isClientLoggingEnabled()
protected final AbstractRemoteEntityConnection doConnect(RemoteClient remoteClient) throws java.rmi.RemoteException, ServerException.LoginException, ServerException.ServerFullException
doConnect
in class AbstractServer<AbstractRemoteEntityConnection,EntityConnectionServerAdmin>
remoteClient
- the client connection infojava.rmi.RemoteException
- in case of an exceptionServerException.LoginException
- in case of an error during the loginServerException.ServerFullException
- in case the server is not accepting new connectionsprotected final void doDisconnect(AbstractRemoteEntityConnection connection) throws java.rmi.RemoteException
doDisconnect
in class AbstractServer<AbstractRemoteEntityConnection,EntityConnectionServerAdmin>
connection
- the connection to disconnectjava.rmi.RemoteException
- in case of an exceptionprotected AbstractRemoteEntityConnection createRemoteConnection(ConnectionPool connectionPool, Database database, RemoteClient remoteClient, int port, boolean clientLoggingEnabled, java.rmi.server.RMIClientSocketFactory clientSocketFactory, java.rmi.server.RMIServerSocketFactory serverSocketFactory) throws java.rmi.RemoteException, DatabaseException
connectionPool
- the connection pool to use, if none is provided a local connection is establisheddatabase
- the underlying databaseremoteClient
- the client requesting the connectionport
- the port to use when exporting this remote connectionclientLoggingEnabled
- specifies whether or not method logging is enabledclientSocketFactory
- the client socket factory, null for defaultserverSocketFactory
- the server socket factory, null for defaultjava.rmi.RemoteException
- in case of an exceptionDatabaseException
- in case a database connection can not be established, for example
if a wrong username or password is providedprotected final void handleShutdown() throws java.rmi.RemoteException
handleShutdown
in class AbstractServer<AbstractRemoteEntityConnection,EntityConnectionServerAdmin>
java.rmi.RemoteException
- in case of an exceptionprotected static java.lang.String initializeServerName(java.lang.String databaseHost, java.lang.String sid)
protected static java.util.Collection<User> getPoolUsers(java.util.Collection<java.lang.String> poolUsers)
protected static java.util.Map<java.lang.String,java.lang.Integer> getClientTimeoutValues()
public static DefaultEntityConnectionServer startServer() throws java.rmi.RemoteException
java.rmi.RemoteException
- in case of an exceptionpublic static void main(java.lang.String[] arguments) throws java.rmi.RemoteException, ServerException.AuthenticationException
arguments
- 'start' (or no argument) starts the server, 'stop' or 'shutdown' causes a running server to be shut down and 'restart' restarts the serverjava.rmi.RemoteException
- in case of a remote exception during service exportServerException.AuthenticationException
- in case of missing or incorrect admin user information