com.arjuna.ats.arjuna.objectstore
Class ObjectStore

java.lang.Object
  extended by com.arjuna.ats.arjuna.objectstore.ObjectStore
All Implemented Interfaces:
BaseStore, ParticipantStore, RecoveryStore, TxLog

public abstract class ObjectStore
extends java.lang.Object
implements BaseStore, ParticipantStore, RecoveryStore, TxLog

The object store interface is the application's route to using a specific object store implementation. The interface dynamically binds to an implementation of the right type. This is the base class from which all object store types are derived. Note that because object store instances are stateless, to improve efficiency we try to only create one instance of each type per process. Therefore, the create and destroy methods are used instead of new and delete. If an object store is accessed via create it *must* be deleted using destroy. Of course it is still possible to make use of new directly.

Since:
JTS 1.0.
Version:
$Id: ObjectStore.java 2342 2006-03-30 13:06:17Z $
Author:
Mark Little (mark@arjuna.com)

Field Summary
protected  int shareStatus
           
 
Constructor Summary
protected ObjectStore()
           
protected ObjectStore(int ss)
           
 
Method Summary
 boolean allObjUids(java.lang.String s, InputObjectState buff)
           
 boolean fullCommitNeeded()
          Does this store need to do the full write_uncommitted/commit protocol?
 void initialise(Uid u, java.lang.String tn)
          Initialise the object store.
 boolean isType(Uid u, java.lang.String tn, int st)
          Is the current state of the object the same as that provided as the last parameter?
 java.lang.String locateStore(java.lang.String localOSRoot)
           
 void pack(OutputBuffer buff)
          Pack up the object store state.
protected  java.lang.String revealedId(java.lang.String name)
          Given a type id which is possibly hidden (e.g., has a ! at the end), make it a valid Uid so we can return it.
 int shareState()
           
 java.lang.String storeDir()
           
 java.lang.String storeRoot()
           
protected abstract  boolean supressEntry(java.lang.String name)
          Suppress directories of the specified type from allTypes etc?
 void sync()
          Some object store implementations may be running with automatic sync disabled.
 void unpack(InputBuffer buff)
          Unpack an object store.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.arjuna.ats.arjuna.objectstore.ParticipantStore
commit_state, read_uncommitted, remove_uncommitted, write_uncommitted
 
Methods inherited from interface com.arjuna.ats.arjuna.objectstore.RecoveryStore
allObjUids, allTypes, currentState, hide_state, read_committed, reveal_state
 
Methods inherited from interface com.arjuna.ats.arjuna.objectstore.TxLog
remove_committed, write_committed
 
Methods inherited from interface com.arjuna.ats.arjuna.objectstore.BaseStore
getStoreName, typeIs
 

Field Detail

shareStatus

protected int shareStatus
Constructor Detail

ObjectStore

protected ObjectStore()

ObjectStore

protected ObjectStore(int ss)
Method Detail

allObjUids

public boolean allObjUids(java.lang.String s,
                          InputObjectState buff)
                   throws ObjectStoreException
Specified by:
allObjUids in interface RecoveryStore
Throws:
ObjectStoreException

sync

public void sync()
          throws java.io.SyncFailedException,
                 ObjectStoreException
Some object store implementations may be running with automatic sync disabled. Calling this method will ensure that any states are flushed to disk.

Specified by:
sync in interface TxLog
Throws:
java.io.SyncFailedException
ObjectStoreException

locateStore

public java.lang.String locateStore(java.lang.String localOSRoot)
                             throws ObjectStoreException
Parameters:
localOSRoot - the root of the store.
Returns:
the full path of the store. localOSRoot is always a relative name. NOTE this path always ends in a /
Throws:
ObjectStoreException

fullCommitNeeded

public boolean fullCommitNeeded()
Does this store need to do the full write_uncommitted/commit protocol?

Returns:
true if full commit is needed, false otherwise.

isType

public boolean isType(Uid u,
                      java.lang.String tn,
                      int st)
               throws ObjectStoreException
Is the current state of the object the same as that provided as the last parameter?

Specified by:
isType in interface RecoveryStore
Parameters:
u - The object to work on.
tn - The type of the object.
st - The expected type of the object.
Returns:
true if the current state is as expected, false otherwise.
Throws:
ObjectStoreException

initialise

public void initialise(Uid u,
                       java.lang.String tn)
Initialise the object store.


pack

public void pack(OutputBuffer buff)
          throws java.io.IOException
Pack up the object store state. May be used to ship an entire object store across the network, or persist a volatile object store.

Throws:
java.io.IOException

unpack

public void unpack(InputBuffer buff)
            throws java.io.IOException
Unpack an object store.

Throws:
java.io.IOException

shareState

public final int shareState()

storeDir

public final java.lang.String storeDir()

storeRoot

public final java.lang.String storeRoot()

supressEntry

protected abstract boolean supressEntry(java.lang.String name)
Suppress directories of the specified type from allTypes etc?


revealedId

protected java.lang.String revealedId(java.lang.String name)
Given a type id which is possibly hidden (e.g., has a ! at the end), make it a valid Uid so we can return it.