org.objectweb.perseus.fos.lib
Class FosTxContext

java.lang.Object
  extended byorg.objectweb.perseus.fos.lib.FosTxContext
All Implemented Interfaces:
FosAccess, FosTransaction

public class FosTxContext
extends java.lang.Object
implements FosTransaction

Author:
S. Chassande-Barrioz, P. D?chamboux

Method Summary
 void begin()
          Begins a FOS transaction with no DTP context.
 void begin(javax.transaction.xa.Xid xid)
          Begins a FOS transaction with a DTP context.
 void commit()
          Commits a FOS transaction.
 void delete(java.lang.String dirof, java.lang.String id)
          Deletes the file associated with a persistent object.
 void deleteDir(java.lang.String dirof)
          Deletes a directory that stores persistent objects along with all object files stored under it.
 boolean exist(java.lang.String dirof, java.lang.String id)
          Tests if the file associated to a persistent object exists.
 boolean existDir(java.lang.String dirof)
          Tests if a directory that stores persistent objects exists.
 boolean isActive()
          Specifies if this FOS transaction is active or not.
 boolean prepare()
          Prepares a FOS transaction to commit.
 void read(java.lang.String dirof, java.lang.String id, FosStructure fs, FosAccess conn, java.lang.Object ctxt)
           
 void read(java.lang.String dirof, java.lang.String id, FosStructure fs, java.lang.Object ctxt)
          Reads the content of a persistent object from a file.
 void rollback()
          Roolbacks a FOS transaction.
 java.util.Iterator scan(java.lang.String dirof)
          Gets an iterator in order to iterate over the names of the data object files stored into that sub-directory.
 void write(java.lang.String dirof, java.lang.String id, FosStructure fs, FosAccess conn, java.lang.Object ctxt)
           
 void write(java.lang.String dirof, java.lang.String id, FosStructure fs, java.lang.Object ctxt)
          Writes the content of a persistent object to a file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

begin

public void begin()
           throws FosException
Begins a FOS transaction with no DTP context.

Specified by:
begin in interface FosTransaction
Throws:
FosException

begin

public void begin(javax.transaction.xa.Xid xid)
           throws FosException
Begins a FOS transaction with a DTP context.

Specified by:
begin in interface FosTransaction
Parameters:
xid - The DTP identifier associated with this FOS transaction. It is null if non XA runtime environment.
Throws:
FosException

isActive

public boolean isActive()
Specifies if this FOS transaction is active or not. true means that it has begun but it has not been committed or rollbacked yet.

Specified by:
isActive in interface FosTransaction

prepare

public boolean prepare()
                throws FosException
Prepares a FOS transaction to commit.

Specified by:
prepare in interface FosTransaction
Returns:
true if all objects used by this transaction was just read.
Throws:
FosException

commit

public void commit()
            throws FosException
Commits a FOS transaction.

Specified by:
commit in interface FosTransaction
Throws:
FosException

rollback

public void rollback()
              throws FosException
Roolbacks a FOS transaction.

Specified by:
rollback in interface FosTransaction
Throws:
FosException

exist

public boolean exist(java.lang.String dirof,
                     java.lang.String id)
              throws FosException
Tests if the file associated to a persistent object exists. This file is specified by the directory under which it is stored under dbDir, and its name (or id) within this directory.

Specified by:
exist in interface FosAccess
Parameters:
dirof - The directory under dbDir where the file should be located.
id - The name of the file to test (corresponding to the object identifier).
Returns:
true if the object file exists, else false.
Throws:
FosException

existDir

public boolean existDir(java.lang.String dirof)
                 throws FosException
Tests if a directory that stores persistent objects exists.

Specified by:
existDir in interface FosAccess
Parameters:
dirof - The directory under dbDir to test the existence.
Returns:
true if the directory exists, else false.
Throws:
FosException

read

public void read(java.lang.String dirof,
                 java.lang.String id,
                 FosStructure fs,
                 java.lang.Object ctxt)
          throws FosException
Reads the content of a persistent object from a file. This file is specified by the directory under which it is stored under dbDir, and its name (or id) within this directory. The object that actually reads the file is also given by the user.

Specified by:
read in interface FosAccess
Parameters:
dirof - The directory under dbDir where the read file is located.
id - The name of the file to read (corresponding to the object identifier).
fs - The user object for actually reading the file.
Throws:
FosException

read

public void read(java.lang.String dirof,
                 java.lang.String id,
                 FosStructure fs,
                 FosAccess conn,
                 java.lang.Object ctxt)
          throws FosException
Throws:
FosException

delete

public void delete(java.lang.String dirof,
                   java.lang.String id)
            throws FosException
Deletes the file associated with a persistent object. This file is specified by the directory under which it is stored under dbDir, and its name (or id) within this directory.

Specified by:
delete in interface FosAccess
Parameters:
dirof - The directory under dbDir where the deleted file is located.
id - The name of the file to delete (corresponding to the object identifier).
Throws:
FosException

deleteDir

public void deleteDir(java.lang.String dirof)
               throws FosException
Deletes a directory that stores persistent objects along with all object files stored under it.

Specified by:
deleteDir in interface FosAccess
Parameters:
dirof - The directory under dbDir to be deleted.
Throws:
FosException

scan

public java.util.Iterator scan(java.lang.String dirof)
                        throws FosException
Gets an iterator in order to iterate over the names of the data object files stored into that sub-directory.

Specified by:
scan in interface FosAccess
Parameters:
dirof - The sub-directory from which to scan the data object file names.
Returns:
The iterator in order to iterate over these names.
Throws:
FosException

write

public void write(java.lang.String dirof,
                  java.lang.String id,
                  FosStructure fs,
                  java.lang.Object ctxt)
           throws FosException
Writes the content of a persistent object to a file. This file is specified by the directory under which it is stored under dbDir, and its name (or id) within this directory. The object that actually writes the file is also given by the user.

Specified by:
write in interface FosAccess
Parameters:
dirof - The directory under dbDir where the written file is located.
id - The name of the file to write (corresponding to the object identifier).
fs - The user object for actually writing the file.
Throws:
FosException

write

public void write(java.lang.String dirof,
                  java.lang.String id,
                  FosStructure fs,
                  FosAccess conn,
                  java.lang.Object ctxt)
           throws FosException
Throws:
FosException


Copyright © 2000-2002 France Telecom S.A., INRIA, IMAG-LSR All Rights Reserved.