fr.dyade.aaa.util
Interface Transaction

All Known Implementing Classes:
AbstractTransaction, ATransaction, DBTransaction, DerbyDBTransaction, JTransaction, MySQLDBTransaction, NGTransaction, NTransaction, NullTransaction

public interface Transaction

The Transaction interface defines the API of the atomic storage component.


Field Summary
static int COMMIT
           
static int FINALIZE
           
static int FREE
           
static int GARBAGE
           
static int INIT
           
static int Kb
           
static int Mb
           
static java.lang.String[] PhaseInfo
           
static int ROLLBACK
           
static int RUN
           
 
Method Summary
 void begin()
          Start a transaction validation, the validation phase needs 3 phases: begin, commit and release.
 void close()
          Close the transaction module.
 void commit(boolean release)
          Commit the current transaction.
 void create(java.io.Serializable obj, java.lang.String name)
          Register the state of a newly created object in the current transaction.
 void create(java.io.Serializable obj, java.lang.String dirName, java.lang.String name)
          Register the state of a newly created object in the current transaction.
 void createByteArray(byte[] buf, java.lang.String name)
          Register a new byte array in the current transaction.
 void createByteArray(byte[] buf, java.lang.String dirName, java.lang.String name)
          Register a new byte array in the current transaction.
 void delete(java.lang.String name)
          Deletes the specified object.
 void delete(java.lang.String dirName, java.lang.String name)
          Deletes the specified object.
 java.lang.String[] getList(java.lang.String prefix)
          Returns an array of strings naming the objects in the component started by this prefix.
 int getPhase()
          Returns the transaction state.
 java.lang.String getPhaseInfo()
          Returns a string representation of the transaction state.
 void init(java.lang.String path)
          Initializes the atomic storage component.
 boolean isPersistent()
          Returns true if the component is persistent.
 java.lang.Object load(java.lang.String name)
          Load the specified object.
 java.lang.Object load(java.lang.String dirName, java.lang.String name)
          Load the specified object.
 byte[] loadByteArray(java.lang.String name)
          Load the specified byte array.
 byte[] loadByteArray(java.lang.String dirName, java.lang.String name)
          Load the specified byte array.
 void release()
          Release the mutual exclusion.
 void save(java.io.Serializable obj, java.lang.String name)
          Register the modified state of an object in the current transaction.
 void save(java.io.Serializable obj, java.lang.String dirName, java.lang.String name)
          Register the modified state of an object in the current transaction.
 void save(java.io.Serializable obj, java.lang.String dirName, java.lang.String name, boolean first)
          Register the state of an object in the current transaction.
 void saveByteArray(byte[] buf, java.lang.String name)
          Register a modified byte array in the current transaction.
 void saveByteArray(byte[] buf, java.lang.String dirName, java.lang.String name)
          Register a modified byte array in the current transaction.
 void saveByteArray(byte[] buf, java.lang.String dirName, java.lang.String name, boolean copy, boolean first)
          Register a modified byte array in the current transaction.
 void stop()
          Stops the transaction module.
 

Field Detail

INIT

static final int INIT
See Also:
Constant Field Values

FREE

static final int FREE
See Also:
Constant Field Values

RUN

static final int RUN
See Also:
Constant Field Values

COMMIT

static final int COMMIT
See Also:
Constant Field Values

ROLLBACK

static final int ROLLBACK
See Also:
Constant Field Values

GARBAGE

static final int GARBAGE
See Also:
Constant Field Values

FINALIZE

static final int FINALIZE
See Also:
Constant Field Values

PhaseInfo

static final java.lang.String[] PhaseInfo

Kb

static final int Kb
See Also:
Constant Field Values

Mb

static final int Mb
See Also:
Constant Field Values
Method Detail

init

void init(java.lang.String path)
          throws java.io.IOException
Initializes the atomic storage component.

Parameters:
path -
Throws:
java.io.IOException

getPhase

int getPhase()
Returns the transaction state.

Returns:
the transaction state.

getPhaseInfo

java.lang.String getPhaseInfo()
Returns a string representation of the transaction state.

Returns:
the string representation of the transaction state.

begin

void begin()
           throws java.io.IOException
Start a transaction validation, the validation phase needs 3 phases: begin, commit and release. The begin ensure the mutual exclusion of the current transaction.

Throws:
java.io.IOException

getList

java.lang.String[] getList(java.lang.String prefix)
Returns an array of strings naming the objects in the component started by this prefix.

Parameters:
prefix -
Returns:
an array of strings naming the objects in the component started by this prefix.

isPersistent

boolean isPersistent()
Returns true if the component is persistent.

Returns:
true if the component is persistent.

create

void create(java.io.Serializable obj,
            java.lang.String name)
            throws java.io.IOException
Register the state of a newly created object in the current transaction.

Parameters:
obj - the object to store.
name - the name of the object.
Throws:
java.io.IOException

create

void create(java.io.Serializable obj,
            java.lang.String dirName,
            java.lang.String name)
            throws java.io.IOException
Register the state of a newly created object in the current transaction.

Parameters:
obj - the object to store.
dirName - the directory name of the object.
name - the name of the object.
Throws:
java.io.IOException

save

void save(java.io.Serializable obj,
          java.lang.String name)
          throws java.io.IOException
Register the modified state of an object in the current transaction.

Parameters:
obj - the object to store.
name - the name of the object.
Throws:
java.io.IOException

save

void save(java.io.Serializable obj,
          java.lang.String dirName,
          java.lang.String name)
          throws java.io.IOException
Register the modified state of an object in the current transaction.

Parameters:
obj - the object to store.
dirName - the directory name of the object.
name - the name of the object.
Throws:
java.io.IOException

save

void save(java.io.Serializable obj,
          java.lang.String dirName,
          java.lang.String name,
          boolean first)
          throws java.io.IOException
Register the state of an object in the current transaction.

Parameters:
obj - the object to store.
dirName - the directory name of the object.
name - the name of the object.
first - the object is a new one.
Throws:
java.io.IOException

createByteArray

void createByteArray(byte[] buf,
                     java.lang.String name)
                     throws java.io.IOException
Register a new byte array in the current transaction.

Parameters:
buf - the byte array to store.
name - the name of the object.
Throws:
java.io.IOException

createByteArray

void createByteArray(byte[] buf,
                     java.lang.String dirName,
                     java.lang.String name)
                     throws java.io.IOException
Register a new byte array in the current transaction.

Parameters:
buf - the byte array to store.
dirName - the directory name of the object.
name - the name of the object.
Throws:
java.io.IOException

saveByteArray

void saveByteArray(byte[] buf,
                   java.lang.String name)
                   throws java.io.IOException
Register a modified byte array in the current transaction.

Parameters:
buf - the byte array to store.
name - the name of the object.
Throws:
java.io.IOException

saveByteArray

void saveByteArray(byte[] buf,
                   java.lang.String dirName,
                   java.lang.String name)
                   throws java.io.IOException
Register a modified byte array in the current transaction.

Parameters:
buf - the byte array to store.
dirName - the directory name of the object.
name - the name of the object.
Throws:
java.io.IOException

saveByteArray

void saveByteArray(byte[] buf,
                   java.lang.String dirName,
                   java.lang.String name,
                   boolean copy,
                   boolean first)
                   throws java.io.IOException
Register a modified byte array in the current transaction.

Parameters:
buf - the byte array to store.
dirName - the directory name of the object.
name - the name of the object.
copy - the byte array can be modified, copy it.
first - the object is a new one.
Throws:
java.io.IOException

load

java.lang.Object load(java.lang.String name)
                      throws java.io.IOException,
                             java.lang.ClassNotFoundException
Load the specified object.

Parameters:
name - the name of the object.
Returns:
the loaded object.
Throws:
java.io.IOException
java.lang.ClassNotFoundException

load

java.lang.Object load(java.lang.String dirName,
                      java.lang.String name)
                      throws java.io.IOException,
                             java.lang.ClassNotFoundException
Load the specified object.

Parameters:
dirName - the directory name of the object.
name - the name of the object.
Returns:
the loaded object.
Throws:
java.io.IOException
java.lang.ClassNotFoundException

loadByteArray

byte[] loadByteArray(java.lang.String name)
                     throws java.io.IOException,
                            java.lang.ClassNotFoundException
Load the specified byte array.

Parameters:
name - the name of the object.
Returns:
the loaded byte array.
Throws:
java.io.IOException
java.lang.ClassNotFoundException

loadByteArray

byte[] loadByteArray(java.lang.String dirName,
                     java.lang.String name)
                     throws java.io.IOException
Load the specified byte array.

Parameters:
dirName - the directory name of the object.
name - the name of the object.
Returns:
the loaded byte array.
Throws:
java.io.IOException

delete

void delete(java.lang.String name)
Deletes the specified object.

Parameters:
name - the name of the object.

delete

void delete(java.lang.String dirName,
            java.lang.String name)
Deletes the specified object.

Parameters:
dirName - the directory name of the object.
name - the name of the object.

commit

void commit(boolean release)
            throws java.io.IOException
Commit the current transaction.

Parameters:
release - if true releases the transaction at the end of the commit.
Throws:
java.io.IOException

release

void release()
             throws java.io.IOException
Release the mutual exclusion.

Throws:
java.io.IOException

stop

void stop()
Stops the transaction module. It waits all transactions termination, then the module is kept in a FREE 'ready to use' state.


close

void close()
Close the transaction module. It waits all transactions termination, the module will be initialized anew before reusing it.



Copyright © 2010 ScalAgent D.T.. All Rights Reserved.