org.tentackle.db.rmi
Class RemoteDbConnectionImpl

java.lang.Object
  extended by java.rmi.server.RemoteObject
      extended by java.rmi.server.RemoteServer
          extended by java.rmi.server.UnicastRemoteObject
              extended by org.tentackle.db.rmi.RemoteDbConnectionImpl
All Implemented Interfaces:
Serializable, Remote, RemoteDbConnection
Direct Known Subclasses:
AppRemoteDbConnectionImpl

public class RemoteDbConnectionImpl
extends UnicastRemoteObject
implements RemoteDbConnection

Server side RMI-connection implementation.

Overview of what happens in a Tentackle RMI application server:

Author:
harald
See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Constructor Summary
RemoteDbConnectionImpl(DbServer server, int port, RMIClientSocketFactory csf, RMIServerSocketFactory ssf)
          Creates a connection.
 
Method Summary
protected  void finalize()
          Overridden to detect unwanted garbage collection as this should never happen.
 RMIClientSocketFactory getClientSocketFactory()
          Gets the client socket factory.
 int getPort()
          Gets the tcp port for this connection.
 DbServer getServer()
          Gets the DbServer.
 RMIServerSocketFactory getServerSocketFactory()
          Gets the server socket factory.
protected  UserInfo getServerUserInfo(UserInfo clientInfo)
          Gets the server UserInfo.
If it is not provided for this connection, it will be cloned from the given clientInfo.
 RemoteDbSession login(UserInfo clientInfo)
          Login to remote RMI-server.
 void logout(RemoteDbSession session)
          Logout from remote RMI-Server.
 
Methods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, unexportObject
 
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
 
Methods inherited from class java.rmi.server.RemoteObject
equals, getRef, hashCode, toString, toStub
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RemoteDbConnectionImpl

public RemoteDbConnectionImpl(DbServer server,
                              int port,
                              RMIClientSocketFactory csf,
                              RMIServerSocketFactory ssf)
                       throws RemoteException
Creates a connection.

Parameters:
server - the DbServer
port - the tcp-port, 0 = system default
csf - the client socket factory, null = system default
ssf - the server socket factory, null = system default
Throws:
RemoteException
See Also:
DbServer
Method Detail

getServer

public DbServer getServer()
Gets the DbServer.

Returns:
the db server

getPort

public int getPort()
Gets the tcp port for this connection.

Returns:
the tcp-port for this connection, 0 = system default

getClientSocketFactory

public RMIClientSocketFactory getClientSocketFactory()
Gets the client socket factory.

Returns:
the client socket factory for this connection, null = system default

getServerSocketFactory

public RMIServerSocketFactory getServerSocketFactory()
Gets the server socket factory.

Returns:
the server socket factory for this connection, null = system default

getServerUserInfo

protected UserInfo getServerUserInfo(UserInfo clientInfo)
                              throws RemoteException
Gets the server UserInfo.
If it is not provided for this connection, it will be cloned from the given clientInfo.

Parameters:
clientInfo - the default user info if no server info
Returns:
the server info
Throws:
RemoteException

finalize

protected void finalize()
                 throws Throwable
Overridden to detect unwanted garbage collection as this should never happen. If using DbServer, this will not happen because it keeps a reference to the connection object.

Overrides:
finalize in class Object
Throws:
Throwable - the Exception raised by this method

login

public RemoteDbSession login(UserInfo clientInfo)
                      throws RemoteException
Description copied from interface: RemoteDbConnection
Login to remote RMI-server.

Specified by:
login in interface RemoteDbConnection
Parameters:
clientInfo - the user information
Returns:
the session
Throws:
RemoteException - if some error, for example wrong passord

logout

public void logout(RemoteDbSession session)
            throws RemoteException
Description copied from interface: RemoteDbConnection
Logout from remote RMI-Server.

Specified by:
logout in interface RemoteDbConnection
Parameters:
session - to be closed
Throws:
RemoteException - if some error


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