org.tentackle.db.rmi
Class DbObjectRemoteDelegateImpl<T extends DbObject>

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.RemoteDelegateImpl<T>
                  extended by org.tentackle.db.rmi.DbObjectRemoteDelegateImpl<T>
Type Parameters:
T - the database object class
All Implemented Interfaces:
Serializable, Remote, DbObjectRemoteDelegate, RemoteDelegate
Direct Known Subclasses:
AppDbObjectRemoteDelegateImpl, DbPreferencesKeyRemoteDelegateImpl, DbPreferencesNodeRemoteDelegateImpl, ModificationLogRemoteDelegateImpl, ObjectIdRemoteDelegateImpl

public abstract class DbObjectRemoteDelegateImpl<T extends DbObject>
extends RemoteDelegateImpl<T>
implements DbObjectRemoteDelegate

Base class for the remote delegate of DbObject.
All other subclasses of DbObject should extend DbObjectRemoteDelegateImpl to reflect the class hierarchy below DbObject.

Author:
harald
See Also:
Serialized Form

Field Summary
protected  T dbObject
           
 
Fields inherited from class org.tentackle.db.rmi.RemoteDelegateImpl
clazz, csf, db, port, session, ssf
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Constructor Summary
DbObjectRemoteDelegateImpl(RemoteDbSessionImpl session, Class<T> clazz)
          Creates a delegate on the session socket.
DbObjectRemoteDelegateImpl(RemoteDbSessionImpl session, Class<T> clazz, int socketConfig)
          Creates a delegate on a non-default session socket.
DbObjectRemoteDelegateImpl(RemoteDbSessionImpl session, Class<T> clazz, int port, RMIClientSocketFactory csf, RMIServerSocketFactory ssf)
          Creates delegate.
 
Method Summary
 DbObjectResult deleteObject(DbObject obj, boolean withLinkedObjects)
           
 boolean deletePlain(long id, long serial)
           
 boolean dummyUpdate(DbObject obj)
           
 long[] getExpirationBacklog(long minSerial, long maxSerial)
           
 long[] getExpiredTableSerials(long oldSerial, long maxSerial)
           
 DbObjectResult insertObject(DbObject obj, boolean withLinkedObjects)
           
 boolean insertPlain(DbObject obj)
           
 boolean isReferenced(long id)
           
protected  T newObject()
          Creates a new instance of the required class for methods that return a new object.
 DbObjectResult save(DbObject obj)
           
 DbObject select(long id, boolean withLinkedObjects)
           
 List<? extends DbObject> selectAll(boolean withLinkedObjects)
           
 RemoteDbCursor selectAllCursor(boolean withLinkedObjects)
           
 long[] selectExpiredTableSerials(long oldSerial)
           
 long[] selectExpiredTableSerials(long oldSerial, long maxSerial)
           
 DbObject selectInValidContext(long id, boolean withLinkedObjects)
           
 DbObject selectLocked(long id, boolean withLinkedObjects)
           
 long selectModification()
           
 long selectSerial(long id)
           
 DbObjectResult updateObject(DbObject obj, boolean withLinkedObjects)
           
 boolean updatePlain(DbObject obj)
           
 boolean updateSerial(long id, long serial)
           
 boolean updateSerialAndTableSerial(long id, long serial, long tableSerial)
           
 boolean updateTableSerial(long id)
           
 
Methods inherited from class org.tentackle.db.rmi.RemoteDelegateImpl
getClientSocketFactory, getPort, getServerSocketFactory, getSession
 
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
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

dbObject

protected T extends DbObject dbObject
Constructor Detail

DbObjectRemoteDelegateImpl

public DbObjectRemoteDelegateImpl(RemoteDbSessionImpl session,
                                  Class<T> clazz,
                                  int port,
                                  RMIClientSocketFactory csf,
                                  RMIServerSocketFactory ssf)
                           throws RemoteException
Creates delegate.

Parameters:
session - is the RMI session
clazz - is the class the delegate provides service for
port - the port number on which the remote object receives calls, 0 = system default
csf - the client-side socket factory for making calls to the remote object, null = system default
ssf - the server-side socket factory for receiving remote calls, null = system default
Throws:
RemoteException

DbObjectRemoteDelegateImpl

public DbObjectRemoteDelegateImpl(RemoteDbSessionImpl session,
                                  Class<T> clazz)
                           throws RemoteException
Creates a delegate on the session socket.

Parameters:
session - is the RMI session
clazz - is the subclass of DbObject
Throws:
RemoteException

DbObjectRemoteDelegateImpl

public DbObjectRemoteDelegateImpl(RemoteDbSessionImpl session,
                                  Class<T> clazz,
                                  int socketConfig)
                           throws RemoteException
Creates a delegate on a non-default session socket. Example:
      public FirmaRemoteDelegateImpl(RemoteDbSessionImpl session, Class clazz) throws RemoteException {
        super(session, clazz, UserInfo.getSocketConfig(new Firma().getDbObjectClassVariables().properties));
      }
     

Parameters:
session - is the RMI session
clazz - is the subclass of DbObject
socketConfig - is of RemoteDbSessionImpl.SOCKETCONFIG_...
Throws:
RemoteException
Method Detail

newObject

protected T newObject()
                                throws RemoteException
Creates a new instance of the required class for methods that return a new object.

Returns:
the new object
Throws:
RemoteException

select

public DbObject select(long id,
                       boolean withLinkedObjects)
                throws RemoteException
Specified by:
select in interface DbObjectRemoteDelegate
Throws:
RemoteException

selectLocked

public DbObject selectLocked(long id,
                             boolean withLinkedObjects)
                      throws RemoteException
Specified by:
selectLocked in interface DbObjectRemoteDelegate
Throws:
RemoteException

selectInValidContext

public DbObject selectInValidContext(long id,
                                     boolean withLinkedObjects)
                              throws RemoteException
Specified by:
selectInValidContext in interface DbObjectRemoteDelegate
Throws:
RemoteException

selectAll

public List<? extends DbObject> selectAll(boolean withLinkedObjects)
                                   throws RemoteException
Specified by:
selectAll in interface DbObjectRemoteDelegate
Throws:
RemoteException

selectSerial

public long selectSerial(long id)
                  throws RemoteException
Specified by:
selectSerial in interface DbObjectRemoteDelegate
Throws:
RemoteException

updatePlain

public boolean updatePlain(DbObject obj)
                    throws RemoteException
Specified by:
updatePlain in interface DbObjectRemoteDelegate
Throws:
RemoteException

dummyUpdate

public boolean dummyUpdate(DbObject obj)
                    throws RemoteException
Specified by:
dummyUpdate in interface DbObjectRemoteDelegate
Throws:
RemoteException

updateSerial

public boolean updateSerial(long id,
                            long serial)
                     throws RemoteException
Specified by:
updateSerial in interface DbObjectRemoteDelegate
Throws:
RemoteException

updateTableSerial

public boolean updateTableSerial(long id)
                          throws RemoteException
Specified by:
updateTableSerial in interface DbObjectRemoteDelegate
Throws:
RemoteException

updateSerialAndTableSerial

public boolean updateSerialAndTableSerial(long id,
                                          long serial,
                                          long tableSerial)
                                   throws RemoteException
Specified by:
updateSerialAndTableSerial in interface DbObjectRemoteDelegate
Throws:
RemoteException

selectExpiredTableSerials

public long[] selectExpiredTableSerials(long oldSerial)
                                 throws RemoteException
Specified by:
selectExpiredTableSerials in interface DbObjectRemoteDelegate
Throws:
RemoteException

selectExpiredTableSerials

public long[] selectExpiredTableSerials(long oldSerial,
                                        long maxSerial)
                                 throws RemoteException
Specified by:
selectExpiredTableSerials in interface DbObjectRemoteDelegate
Throws:
RemoteException

getExpirationBacklog

public long[] getExpirationBacklog(long minSerial,
                                   long maxSerial)
                            throws RemoteException
Specified by:
getExpirationBacklog in interface DbObjectRemoteDelegate
Throws:
RemoteException

getExpiredTableSerials

public long[] getExpiredTableSerials(long oldSerial,
                                     long maxSerial)
                              throws RemoteException
Specified by:
getExpiredTableSerials in interface DbObjectRemoteDelegate
Throws:
RemoteException

deletePlain

public boolean deletePlain(long id,
                           long serial)
                    throws RemoteException
Specified by:
deletePlain in interface DbObjectRemoteDelegate
Throws:
RemoteException

insertPlain

public boolean insertPlain(DbObject obj)
                    throws RemoteException
Specified by:
insertPlain in interface DbObjectRemoteDelegate
Throws:
RemoteException

updateObject

public DbObjectResult updateObject(DbObject obj,
                                   boolean withLinkedObjects)
                            throws RemoteException
Specified by:
updateObject in interface DbObjectRemoteDelegate
Throws:
RemoteException

insertObject

public DbObjectResult insertObject(DbObject obj,
                                   boolean withLinkedObjects)
                            throws RemoteException
Specified by:
insertObject in interface DbObjectRemoteDelegate
Throws:
RemoteException

save

public DbObjectResult save(DbObject obj)
                    throws RemoteException
Specified by:
save in interface DbObjectRemoteDelegate
Throws:
RemoteException

deleteObject

public DbObjectResult deleteObject(DbObject obj,
                                   boolean withLinkedObjects)
                            throws RemoteException
Specified by:
deleteObject in interface DbObjectRemoteDelegate
Throws:
RemoteException

selectModification

public long selectModification()
                        throws RemoteException
Specified by:
selectModification in interface DbObjectRemoteDelegate
Throws:
RemoteException

selectAllCursor

public RemoteDbCursor selectAllCursor(boolean withLinkedObjects)
                               throws RemoteException
Specified by:
selectAllCursor in interface DbObjectRemoteDelegate
Throws:
RemoteException

isReferenced

public boolean isReferenced(long id)
                     throws RemoteException
Specified by:
isReferenced in interface DbObjectRemoteDelegate
Throws:
RemoteException


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