org.tentackle.db.rmi
Class DbServer

java.lang.Object
  extended by org.tentackle.db.rmi.DbServer

public class DbServer
extends Object

A generic db-RMI-DbServer.
The db properties file is parsed for the following keywords: service=service-name: defaults to the basename of the DbServer-class instance, i.e. -> rmi://localhost:1099/

  • createregistry: creates a local registry (on the port according to service, defaulting to 1099)
  • connectionclass=connection-class: defaults to org.tentackle.db.rmi.RemoteConnectionImpl (which is only for testing. Real apps need another class)
  • timeoutinterval=timeout-polling-interval-in-milliseconds: The polling interval for dead sessions in milliseconds. Defaults to 1000ms. 0 turns off the cleanup thread completely (risky!).
  • timeout=session-timeout: The default session timeout (in polling-intervals) for dead client connections (see Db -> keepAlive). Defaults to 0, i.e. no timeout (sessions may request an individual timeout).
  • port=port: for the connection object> default is 0, i.e. system default (or from fixed ports)
  • Fixed ports:
    ports=28000: plain=28000, compressed=28001, ssl=28002, compressed+ssl=28003
    is the same as:
    ports=28000,28001,28002,28003
    Default is: ports=0,0,0,0
    Use -1 to disable service at this port, i.e. "ports=-1,-1,0,0" means: ssl only, with or without compression.
  • compressed: connection is compressed (initially)
  • ssl: connection is with SSL (initially)
  • keystore=keystore: default is null if not provided by command line
  • truststore=truststore: for client auth, default is null if not provided by command line
  • keystorepassword=keystore-password: no default if not provided by command line
  • truststorepassword=truststore-password: no default if not provided by command line Notice that servers need either both (key- and truststore) set or none. Otherwise weird error messages will happen when closing a connection.
  • ciphersuites=...: comma separated list of enabled cipher suites
  • protocols=...: comma separated list of enabled protocols
  • clientauth: set if server requires client authentication
  • Author:
    harald

    Constructor Summary
    DbServer(UserInfo serverInfo)
              Creates an instance of an RMI-db-server with default connection object (or configured entirely by db properties file)
    DbServer(UserInfo serverInfo, Class<? extends RemoteDbConnectionImpl> connectionClass)
              Creates an instance of an RMI-db-server.
     
    Method Summary
     RMIClientSocketFactory getClientSocketFactory()
              Gets the server's csf
     int getCompressedPort()
              Get the fixed port for compressed communication
     int getCompressedSslPort()
              Get the fixed port for compressed+ssl communication
     String[] getEnabledCipherSuites()
              Gets the enables cipher suites
     String[] getEnabledProtocols()
              Gets the enabled protocols
     boolean getNeedClientAuth()
              Determines whether the client need authentication as well.
     int getPlainPort()
              Get the fixed port for plain communication.
     int getPort()
              Gets the port the server is listening on
     int getPort(int port, RMIClientSocketFactory csf, RMIServerSocketFactory ssf)
              Gets the tcp port for a new remote object (e.g.
     RMIServerSocketFactory getServerSocketFactory()
              Gets the server's ssf
     UserInfo getServerUserInfo()
               
     int getSessionTimeout()
              Gets the default session timeout.
     int getSslPort()
              Get the fixed port for ssl communication
     void start()
              Starts the server.
     void stop()
              Stops the server.
     
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
     

    Constructor Detail

    DbServer

    public DbServer(UserInfo serverInfo,
                    Class<? extends RemoteDbConnectionImpl> connectionClass)
             throws ApplicationException
    Creates an instance of an RMI-db-server.

    Parameters:
    serverInfo - the servers db-connection user info
    connectionClass - the class of the connection object to instantiate, null = default or from serverInfo's properties file
    Throws:
    ApplicationException - if some configuration error

    DbServer

    public DbServer(UserInfo serverInfo)
             throws ApplicationException
    Creates an instance of an RMI-db-server with default connection object (or configured entirely by db properties file)

    Parameters:
    serverInfo - the servers db-connection user info
    Throws:
    ApplicationException - if some configuration error
    Method Detail

    getServerUserInfo

    public UserInfo getServerUserInfo()
    Returns:
    the server info

    getEnabledCipherSuites

    public String[] getEnabledCipherSuites()
    Gets the enables cipher suites

    Returns:
    the suites

    getEnabledProtocols

    public String[] getEnabledProtocols()
    Gets the enabled protocols

    Returns:
    the protocols

    getNeedClientAuth

    public boolean getNeedClientAuth()
    Determines whether the client need authentication as well.

    Returns:
    true if server needs client authentication

    getPort

    public int getPort(int port,
                       RMIClientSocketFactory csf,
                       RMIServerSocketFactory ssf)
                throws ApplicationException
    Gets the tcp port for a new remote object (e.g. session) according to the fixed ports, if any set.

    Parameters:
    port - the requested port by the delegate, 0 = use system default
    csf - the client socket factory, null = same as connection
    ssf - the server socket factory, null = same as connection
    Returns:
    the granted port, 0 = use system default
    Throws:
    ApplicationException - if requested port could not be granted

    getPlainPort

    public int getPlainPort()
    Get the fixed port for plain communication.

    Returns:
    the port number, 0 = not fixed, i.e. system default

    getCompressedPort

    public int getCompressedPort()
    Get the fixed port for compressed communication

    Returns:
    the port number, 0 = not fixed, i.e. system default

    getSslPort

    public int getSslPort()
    Get the fixed port for ssl communication

    Returns:
    the port number, 0 = not fixed, i.e. system default

    getCompressedSslPort

    public int getCompressedSslPort()
    Get the fixed port for compressed+ssl communication

    Returns:
    the port number, 0 = not fixed, i.e. system default

    getPort

    public int getPort()
    Gets the port the server is listening on

    Returns:
    the port

    getClientSocketFactory

    public RMIClientSocketFactory getClientSocketFactory()
    Gets the server's csf

    Returns:
    the client socket factory

    getServerSocketFactory

    public RMIServerSocketFactory getServerSocketFactory()
    Gets the server's ssf

    Returns:
    the server socket factory

    getSessionTimeout

    public int getSessionTimeout()
    Gets the default session timeout.

    Returns:
    the timeout in polling intervals.

    start

    public void start()
               throws ApplicationException
    Starts the server.

    Throws:
    ApplicationException - if startup failed

    stop

    public void stop()
              throws ApplicationException
    Stops the server.

    Unbinds the connection object.

    Throws:
    ApplicationException


    Copyright © 2001-2008 Harald Krake, Bergstr. 48, 78098 Triberg, Germany, harald@krake.de