Class RemoteDbConnectionImpl

All Implemented Interfaces:
Serializable, Remote, RemoteDbConnection

public abstract class RemoteDbConnectionImpl extends RemoteServerObject implements RemoteDbConnection
Server side RMI-connection implementation.

Overview of what happens in a Tentackle RMI application rmiServer:

  • client gets a reference to a RemoteDbConnection
  • client invokes login() on the connection and gets a reference to a RemoteDbSession.
  • each session runs in its own thread (rmiServer and client) and the rmiServer session gets its own Db.
  • all further client requests work through the session object and the remote delegates created within the session
  • the client invokes logout() to close the session and Db.
  • in case the client terminates abnormally (without invoking logout()) a timeout runs logout() via its cleanable.
Author:
harald
See Also:
  • Constructor Details Link icon

  • Method Details Link icon

    • getRmiServer Link icon

      public RmiServer getRmiServer()
      Gets the RMI-server.
      Returns:
      the RMI server
    • checkClientVersion Link icon

      public void checkClientVersion(String clientVersion)
      Checks the client's version.

      The default implementation does nothing. It is invoked only for remote connections.

      Throws VersionIncompatibleException if versions are not compatible.

      Parameters:
      clientVersion - the client version
    • createSession Link icon

      public abstract RemoteDbSession createSession(SessionInfo clientInfo) throws RemoteException
      Creates the session.
      Needs to be implemented by the application.
      Parameters:
      clientInfo - the client info (login info)
      Returns:
      the created session
      Throws:
      RemoteException - if creation failed
    • exportRemoteObject Link icon

      public int exportRemoteObject(Remote remoteObject, int port, RMIClientSocketFactory csf, RMIServerSocketFactory ssf) throws RemoteException
      Exports the given remote object.

      Notice that the delegate must not extend UnicastRemoteObject!

      Parameters:
      remoteObject - the object to export
      port - the port to export the object on, 0 if auto
      csf - the client-side socket factory for making calls to the remote object, null if system default
      ssf - the rmiServer-side socket factory for receiving remote calls, null if system default
      Returns:
      the effective port, 0 if system default
      Throws:
      RemoteException - if export failed
    • unexportRemoteObject Link icon

      public void unexportRemoteObject(Remote remoteObject) throws RemoteException
      Un-exports the given remote object.
      Parameters:
      remoteObject - the object to un-export
      Throws:
      RemoteException - if the remote object is not currently exported
    • getServerVersion Link icon

      public String getServerVersion() throws RemoteException
      Description copied from interface: RemoteDbConnection
      Gets the application-specific version of the server.
      Specified by:
      getServerVersion in interface RemoteDbConnection
      Returns:
      the server version
      Throws:
      RemoteException - if failed
    • login Link icon

      public RemoteDbSession login(SessionInfo clientInfo) throws RemoteException
      Description copied from interface: RemoteDbConnection
      Login to remote RMI-server.
      Specified by:
      login in interface RemoteDbConnection
      Parameters:
      clientInfo - the session information
      Returns:
      the session
      Throws:
      RemoteException - if some error, for example wrong password
      See Also: