fr.dyade.aaa.util
Class NullTransaction

java.lang.Object
  extended by fr.dyade.aaa.util.NullTransaction
All Implemented Interfaces:
NullTransactionMBean, Transaction, TransactionMBean

public final class NullTransaction
extends java.lang.Object
implements Transaction, NullTransactionMBean


Field Summary
protected  int phase
           
 
Fields inherited from interface fr.dyade.aaa.util.Transaction
COMMIT, FINALIZE, FREE, GARBAGE, INIT, Kb, Mb, PhaseInfo, ROLLBACK, RUN
 
Constructor Summary
NullTransaction()
           
 
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.io.File getDir()
           
 java.lang.String[] getList(java.lang.String prefix)
          Returns an array of strings naming the objects in the component started by this prefix.
 java.lang.String getPersistenceDir()
          Returns the path of persistence directory.
 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()
          Tests if the Transaction 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.
protected  void setPhase(int newPhase)
           
 void stop()
          Stops the transaction module.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

phase

protected int phase
Constructor Detail

NullTransaction

public NullTransaction()
Method Detail

getPhase

public final int getPhase()
Description copied from interface: Transaction
Returns the transaction state.

Specified by:
getPhase in interface Transaction
Specified by:
getPhase in interface TransactionMBean
Returns:
the transaction state.

getPhaseInfo

public final java.lang.String getPhaseInfo()
Description copied from interface: Transaction
Returns a string representation of the transaction state.

Specified by:
getPhaseInfo in interface Transaction
Specified by:
getPhaseInfo in interface TransactionMBean
Returns:
the string representation of the transaction state.

setPhase

protected final void setPhase(int newPhase)

isPersistent

public boolean isPersistent()
Tests if the Transaction component is persistent.

Specified by:
isPersistent in interface Transaction
Specified by:
isPersistent in interface TransactionMBean
Returns:
false.

init

public void init(java.lang.String path)
          throws java.io.IOException
Description copied from interface: Transaction
Initializes the atomic storage component.

Specified by:
init in interface Transaction
Throws:
java.io.IOException

getDir

public java.io.File getDir()

getPersistenceDir

public java.lang.String getPersistenceDir()
Returns the path of persistence directory.

Returns:
null.

begin

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

Specified by:
begin in interface Transaction
Throws:
java.io.IOException

getList

public java.lang.String[] getList(java.lang.String prefix)
Description copied from interface: Transaction
Returns an array of strings naming the objects in the component started by this prefix.

Specified by:
getList in interface Transaction
Returns:
an array of strings naming the objects in the component started by this prefix.

create

public final void create(java.io.Serializable obj,
                         java.lang.String name)
                  throws java.io.IOException
Description copied from interface: Transaction
Register the state of a newly created object in the current transaction.

Specified by:
create in interface Transaction
Parameters:
obj - the object to store.
name - the name of the object.
Throws:
java.io.IOException

create

public final void create(java.io.Serializable obj,
                         java.lang.String dirName,
                         java.lang.String name)
                  throws java.io.IOException
Description copied from interface: Transaction
Register the state of a newly created object in the current transaction.

Specified by:
create in interface 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

public final void save(java.io.Serializable obj,
                       java.lang.String name)
                throws java.io.IOException
Description copied from interface: Transaction
Register the modified state of an object in the current transaction.

Specified by:
save in interface Transaction
Parameters:
obj - the object to store.
name - the name of the object.
Throws:
java.io.IOException

save

public final void save(java.io.Serializable obj,
                       java.lang.String dirName,
                       java.lang.String name)
                throws java.io.IOException
Description copied from interface: Transaction
Register the modified state of an object in the current transaction.

Specified by:
save in interface 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

public void save(java.io.Serializable obj,
                 java.lang.String dirName,
                 java.lang.String name,
                 boolean first)
          throws java.io.IOException
Description copied from interface: Transaction
Register the state of an object in the current transaction.

Specified by:
save in interface 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

public final void createByteArray(byte[] buf,
                                  java.lang.String name)
                           throws java.io.IOException
Description copied from interface: Transaction
Register a new byte array in the current transaction.

Specified by:
createByteArray in interface Transaction
Parameters:
buf - the byte array to store.
name - the name of the object.
Throws:
java.io.IOException

createByteArray

public final void createByteArray(byte[] buf,
                                  java.lang.String dirName,
                                  java.lang.String name)
                           throws java.io.IOException
Description copied from interface: Transaction
Register a new byte array in the current transaction.

Specified by:
createByteArray in interface 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

public final void saveByteArray(byte[] buf,
                                java.lang.String name)
                         throws java.io.IOException
Description copied from interface: Transaction
Register a modified byte array in the current transaction.

Specified by:
saveByteArray in interface Transaction
Parameters:
buf - the byte array to store.
name - the name of the object.
Throws:
java.io.IOException

saveByteArray

public final void saveByteArray(byte[] buf,
                                java.lang.String dirName,
                                java.lang.String name)
                         throws java.io.IOException
Description copied from interface: Transaction
Register a modified byte array in the current transaction.

Specified by:
saveByteArray in interface 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

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

Specified by:
saveByteArray in interface 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

public final java.lang.Object load(java.lang.String name)
                            throws java.io.IOException,
                                   java.lang.ClassNotFoundException
Description copied from interface: Transaction
Load the specified object.

Specified by:
load in interface Transaction
Parameters:
name - the name of the object.
Returns:
the loaded object.
Throws:
java.io.IOException
java.lang.ClassNotFoundException

load

public final java.lang.Object load(java.lang.String dirName,
                                   java.lang.String name)
                            throws java.io.IOException,
                                   java.lang.ClassNotFoundException
Description copied from interface: Transaction
Load the specified object.

Specified by:
load in interface Transaction
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

public final byte[] loadByteArray(java.lang.String name)
                           throws java.io.IOException
Description copied from interface: Transaction
Load the specified byte array.

Specified by:
loadByteArray in interface Transaction
Parameters:
name - the name of the object.
Returns:
the loaded byte array.
Throws:
java.io.IOException

loadByteArray

public byte[] loadByteArray(java.lang.String dirName,
                            java.lang.String name)
                     throws java.io.IOException
Description copied from interface: Transaction
Load the specified byte array.

Specified by:
loadByteArray in interface Transaction
Parameters:
dirName - the directory name of the object.
name - the name of the object.
Returns:
the loaded byte array.
Throws:
java.io.IOException

delete

public final void delete(java.lang.String name)
Description copied from interface: Transaction
Deletes the specified object.

Specified by:
delete in interface Transaction
Parameters:
name - the name of the object.

delete

public void delete(java.lang.String dirName,
                   java.lang.String name)
Description copied from interface: Transaction
Deletes the specified object.

Specified by:
delete in interface Transaction
Parameters:
dirName - the directory name of the object.
name - the name of the object.

commit

public void commit(boolean release)
            throws java.io.IOException
Description copied from interface: Transaction
Commit the current transaction.

Specified by:
commit in interface Transaction
Parameters:
release - if true releases the transaction at the end of the commit.
Throws:
java.io.IOException

release

public void release()
             throws java.io.IOException
Description copied from interface: Transaction
Release the mutual exclusion.

Specified by:
release in interface Transaction
Throws:
java.io.IOException

stop

public final void stop()
Description copied from interface: Transaction
Stops the transaction module. It waits all transactions termination, then the module is kept in a FREE 'ready to use' state.

Specified by:
stop in interface Transaction

close

public final void close()
Description copied from interface: Transaction
Close the transaction module. It waits all transactions termination, the module will be initialized anew before reusing it.

Specified by:
close in interface Transaction


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