sqlg2.db.client
Class SafeDBInterface

java.lang.Object
  extended by sqlg2.db.client.SafeDBInterface
All Implemented Interfaces:
java.rmi.Remote, IDBInterface

public final class SafeDBInterface
extends java.lang.Object
implements IDBInterface

Wrapper for IDBInterface on the client side. Caches transactions - creates only one transaction per thread. Also runs activity notification thread to notify server about this client.


Constructor Summary
SafeDBInterface(IDBInterface idb)
          Constructor.
 
Method Summary
 void close()
          Closes DB connection.
 SessionInfo[] getActiveSessions()
          Returns active sessions descriptors.
 SessionInfo getCurrentSession()
          Returns calling session descriptor
 ISimpleTransaction getSimpleTransaction()
          Creates "simple" transaction.
 ITransaction getTransaction()
          Creates transaction.
 java.lang.String getUserHost()
          User host name.
 java.lang.String getUserLogin()
          Returns user login (which was passed to IConnectionFactory.openConnection(java.lang.String, java.lang.String)).
 java.lang.Object getUserObject()
          Returns user identifier object which was returned from AuthenticationHelper.authenticate(java.sql.Connection,String,String) (null in case of direct authentication).
 void killSession(long sessionId)
           
 IDBInterface migrateTo(IConnectionFactory conf)
          Opens new DB connection to another application with same login and password.
 void ping()
          Checks server for availability and signal that client is alive.
 void runProcess(ProcessFactory factory)
          Creates background process on the server.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SafeDBInterface

public SafeDBInterface(IDBInterface idb)
Constructor.

Parameters:
idb - DB connection
Method Detail

getSimpleTransaction

public ISimpleTransaction getSimpleTransaction()
                                        throws java.sql.SQLException,
                                               java.rmi.RemoteException
Description copied from interface: IDBInterface
Creates "simple" transaction.

Specified by:
getSimpleTransaction in interface IDBInterface
Throws:
java.sql.SQLException
java.rmi.RemoteException
See Also:
ISimpleTransaction

getTransaction

public ITransaction getTransaction()
                            throws java.sql.SQLException,
                                   java.rmi.RemoteException
Description copied from interface: IDBInterface
Creates transaction.

Specified by:
getTransaction in interface IDBInterface
Throws:
java.sql.SQLException
java.rmi.RemoteException
See Also:
ITransaction

ping

public void ping()
          throws java.rmi.RemoteException
Description copied from interface: IDBInterface
Checks server for availability and signal that client is alive.

Specified by:
ping in interface IDBInterface
Throws:
java.rmi.RemoteException

close

public void close()
           throws java.rmi.RemoteException
Description copied from interface: IDBInterface
Closes DB connection.

Specified by:
close in interface IDBInterface
Throws:
java.rmi.RemoteException

getUserLogin

public java.lang.String getUserLogin()
                              throws java.rmi.RemoteException
Description copied from interface: IDBInterface
Returns user login (which was passed to IConnectionFactory.openConnection(java.lang.String, java.lang.String)).

Specified by:
getUserLogin in interface IDBInterface
Returns:
user login
Throws:
java.rmi.RemoteException

getUserHost

public java.lang.String getUserHost()
                             throws java.rmi.RemoteException
Description copied from interface: IDBInterface
User host name.

Specified by:
getUserHost in interface IDBInterface
Returns:
host name
Throws:
java.rmi.RemoteException

getUserObject

public java.lang.Object getUserObject()
                               throws java.rmi.RemoteException
Description copied from interface: IDBInterface
Returns user identifier object which was returned from AuthenticationHelper.authenticate(java.sql.Connection,String,String) (null in case of direct authentication).

Specified by:
getUserObject in interface IDBInterface
Throws:
java.rmi.RemoteException

getActiveSessions

public SessionInfo[] getActiveSessions()
                                throws java.rmi.RemoteException
Description copied from interface: IDBInterface
Returns active sessions descriptors.

Specified by:
getActiveSessions in interface IDBInterface
Throws:
java.rmi.RemoteException

killSession

public void killSession(long sessionId)
                 throws java.rmi.RemoteException
Specified by:
killSession in interface IDBInterface
Throws:
java.rmi.RemoteException

getCurrentSession

public SessionInfo getCurrentSession()
                              throws java.rmi.RemoteException
Description copied from interface: IDBInterface
Returns calling session descriptor

Specified by:
getCurrentSession in interface IDBInterface
Throws:
java.rmi.RemoteException

migrateTo

public IDBInterface migrateTo(IConnectionFactory conf)
                       throws java.rmi.RemoteException,
                              java.sql.SQLException
Description copied from interface: IDBInterface
Opens new DB connection to another application with same login and password.

Specified by:
migrateTo in interface IDBInterface
Parameters:
conf - root object of application
Returns:
new DB connection
Throws:
java.rmi.RemoteException
java.sql.SQLException

runProcess

public void runProcess(ProcessFactory factory)
                throws java.rmi.RemoteException,
                       java.sql.SQLException
Description copied from interface: IDBInterface
Creates background process on the server.

Specified by:
runProcess in interface IDBInterface
Parameters:
factory - process factory
Throws:
java.rmi.RemoteException
java.sql.SQLException