net.sf.joafip.service
Class DataAccessSession

java.lang.Object
  extended by net.sf.joafip.service.AbstractDataAccessSession
      extended by net.sf.joafip.service.DataAccessSession
All Implemented Interfaces:
IDASFilePersistenceCallBack, IDataAccessSession, IDataAccessSessionCommon

@NotStorableClass
public class DataAccessSession
extends AbstractDataAccessSession
implements IDASFilePersistenceCallBack, IDataAccessSession

file persistence data access session

Author:
luc peuvrier

Field Summary
 
Fields inherited from class net.sf.joafip.service.AbstractDataAccessSession
filePersistence, mutex, opened
 
Method Summary
 void addListener(IFilePersistenceCloseActionListener listener)
          add a close action execution end listener
 EnumFilePersistenceCloseAction close(EnumFilePersistenceCloseAction action)
          close data access session with a save action
possible save actions
EnumFilePersistenceCloseAction.SAVE
ask for save modification, can be canceled by not save action by other data access session close.
 EnumFilePersistenceCloseAction closeAndWait(EnumFilePersistenceCloseAction action)
          as IDataAccessSession.close(EnumFilePersistenceCloseAction), but wait for effective execution of action
 void fireActionDone(EnumFilePersistenceCloseAction action)
          fire close action done notification
 void open()
          open this data access session, not synchronized with other session
 void openSynchronized()
          open this data access session, synchronized with other session: will wait for other session closed ( blocking )
 void removeListener(IFilePersistenceCloseActionListener listener)
          remove a close action execution end listener
 
Methods inherited from class net.sf.joafip.service.AbstractDataAccessSession
assertClosed, assertOpened, assertPersistenceOpenned, getClassIdentifier, getObject, getObjects, isClosed, isOpened, objectKeySet, removeObject, setCloserTrace, setEnumState, setObject, setOpenerTrace, storedEnum
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.sf.joafip.service.IDataAccessSessionCommon
getClassIdentifier, getObject, getObjects, isClosed, isOpened, objectKeySet, removeObject, setEnumState, setObject, storedEnum
 

Method Detail

open

public void open()
          throws FilePersistenceException,
                 FilePersistenceClassNotFoundException,
                 FilePersistenceInvalidClassException,
                 FilePersistenceDataCorruptedException,
                 FilePersistenceNotSerializableException
Description copied from interface: IDataAccessSessionCommon
open this data access session, not synchronized with other session

Specified by:
open in interface IDataAccessSessionCommon
Throws:
FilePersistenceException - failed read root object, session close pending can not reopen
FilePersistenceClassNotFoundException - Class of a serialized object cannot be found.
FilePersistenceInvalidClassException - something is wrong with a class used by serialization
FilePersistenceDataCorruptedException - data is inconsistent.
FilePersistenceNotSerializableException - Some object to be serialized does not follow joafip persistence rules or does not implement the java.io.Serializable interface.

openSynchronized

public void openSynchronized()
                      throws FilePersistenceException,
                             FilePersistenceClassNotFoundException,
                             FilePersistenceInvalidClassException,
                             FilePersistenceDataCorruptedException,
                             FilePersistenceNotSerializableException
Description copied from interface: IDataAccessSession
open this data access session, synchronized with other session: will wait for other session closed ( blocking )

Specified by:
openSynchronized in interface IDataAccessSession
Throws:
FilePersistenceException - failed read root object, session close pending can not reopen
FilePersistenceClassNotFoundException - Class of a serialized object cannot be found.
FilePersistenceInvalidClassException - something is wrong with a class used by serialization
FilePersistenceDataCorruptedException - data is inconsistent.
FilePersistenceNotSerializableException - Some object to be serialized does not follow joafip persistence rules or does not implement the java.io.Serializable interface.

close

public EnumFilePersistenceCloseAction close(EnumFilePersistenceCloseAction action)
                                     throws FilePersistenceException,
                                            FilePersistenceInvalidClassException,
                                            FilePersistenceNotSerializableException,
                                            FilePersistenceClassNotFoundException,
                                            FilePersistenceDataCorruptedException
Description copied from interface: IDataAccessSession
close data access session with a save action
possible save actions
action are executed only when all data access session are closed. If one of data access session is closed asking not save action then all the modification done in all session will not be save.
after action done (all data access session closed):
persistent object become detached, transient and detached remain in same state

Specified by:
close in interface IDataAccessSession
Parameters:
action - close action
Returns:
null if action pending, else action executed
Throws:
FilePersistenceException - session not registered as opened session, no file in stable state, file state restored to stable, file persistence is not opened
FilePersistenceInvalidClassException - something is wrong with a class used by serialization
FilePersistenceNotSerializableException - Some object to be serialized does not follow joafip persistence rules or does not implement the java.io.Serializable interface.
FilePersistenceClassNotFoundException - Class of a serialized object cannot be found.
FilePersistenceDataCorruptedException - data is inconsistent

closeAndWait

public EnumFilePersistenceCloseAction closeAndWait(EnumFilePersistenceCloseAction action)
                                            throws FilePersistenceException,
                                                   FilePersistenceInvalidClassException,
                                                   FilePersistenceNotSerializableException,
                                                   FilePersistenceClassNotFoundException,
                                                   FilePersistenceDataCorruptedException
Description copied from interface: IDataAccessSession
as IDataAccessSession.close(EnumFilePersistenceCloseAction), but wait for effective execution of action

Specified by:
closeAndWait in interface IDataAccessSession
Parameters:
action - close action
Returns:
action executed
Throws:
FilePersistenceException - session not registered as opened session, no file in stable state, file state restored to stable, file persistence is not opened, close wait interrupted
FilePersistenceInvalidClassException - something is wrong with a class used by serialization
FilePersistenceNotSerializableException - Some object to be serialized does not follow joafip persistence rules or does not implement the java.io.Serializable interface.
FilePersistenceClassNotFoundException - Class of a serialized object cannot be found.
FilePersistenceDataCorruptedException - data is inconsistent

addListener

public void addListener(IFilePersistenceCloseActionListener listener)
Description copied from interface: IDataAccessSession
add a close action execution end listener

Specified by:
addListener in interface IDataAccessSession
Parameters:
listener - close action execution end listener

removeListener

public void removeListener(IFilePersistenceCloseActionListener listener)
Description copied from interface: IDataAccessSession
remove a close action execution end listener

Specified by:
removeListener in interface IDataAccessSession
Parameters:
listener - close action execution end listener

fireActionDone

public void fireActionDone(EnumFilePersistenceCloseAction action)
Description copied from interface: IDASFilePersistenceCallBack
fire close action done notification

Specified by:
fireActionDone in interface IDASFilePersistenceCallBack
Parameters:
action - the action executed


Copyright © 2007-2009 Luc Peuvrier. All Rights Reserved.