com.arjuna.ats.arjuna.objectstore
Class ObjectStoreImple

java.lang.Object
  extended bycom.arjuna.ats.arjuna.objectstore.ObjectStoreImple

public abstract class ObjectStoreImple
extends java.lang.Object

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: ObjectStoreImple.java 2342 2006-03-30 13:06:17Z $
Author:
Mark Little (mark@arjuna.com)

Field Summary
protected  int shareStatus
           
 
Constructor Summary
protected ObjectStoreImple()
           
protected ObjectStoreImple(int ss)
           
protected ObjectStoreImple(ObjectName objName)
           
 
Method Summary
abstract  boolean allObjUids(java.lang.String s, InputObjectState buff, int m)
          Obtain all of the Uids for a specified type.
abstract  boolean allTypes(InputObjectState buff)
          Obtain all types of objects stored in the object store.
 ClassName className()
           
abstract  boolean commit_state(Uid u, java.lang.String tn)
          Commit the object's state in the object store.
abstract  int currentState(Uid u, java.lang.String tn)
           
 boolean fullCommitNeeded()
          Does this store need to do the full write_uncommitted/commit protocol?
abstract  java.lang.String getStoreName()
           
abstract  boolean hide_state(Uid u, java.lang.String tn)
          Hide the object's state in the object store.
 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)
           
static ClassName name()
           
 void pack(OutputBuffer buff)
          Pack up the object store state.
abstract  InputObjectState read_committed(Uid u, java.lang.String tn)
          Read the object's committed state.
abstract  InputObjectState read_uncommitted(Uid u, java.lang.String tn)
          Read the object's shadowed state.
abstract  boolean remove_committed(Uid u, java.lang.String tn)
          Remove the object's committed state.
abstract  boolean remove_uncommitted(Uid u, java.lang.String tn)
          Remove the object's uncommitted state.
abstract  boolean reveal_state(Uid u, java.lang.String tn)
          Reveal a hidden object's 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.
abstract  int typeIs()
          The type of the object store.
 void unpack(InputBuffer buff)
          Unpack an object store.
abstract  boolean write_committed(Uid u, java.lang.String tn, OutputObjectState buff)
          Write a new copy of the object's committed state.
abstract  boolean write_uncommitted(Uid u, java.lang.String tn, OutputObjectState buff)
          Write a copy of the object's uncommitted state.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

shareStatus

protected int shareStatus
Constructor Detail

ObjectStoreImple

protected ObjectStoreImple()

ObjectStoreImple

protected ObjectStoreImple(int ss)

ObjectStoreImple

protected ObjectStoreImple(ObjectName objName)
Method Detail

typeIs

public abstract int typeIs()
The type of the object store. This is used to order the instances in the intentions list.

Returns:
the type of the record.
See Also:
RecordType

allObjUids

public abstract boolean allObjUids(java.lang.String s,
                                   InputObjectState buff,
                                   int m)
                            throws ObjectStoreException
Obtain all of the Uids for a specified type.

Returns:
true if no errors occurred, false otherwise.
Throws:
ObjectStoreException

allTypes

public abstract boolean allTypes(InputObjectState buff)
                          throws ObjectStoreException
Obtain all types of objects stored in the object store.

Returns:
true if no errors occurred, false otherwise.
Throws:
ObjectStoreException

currentState

public abstract int currentState(Uid u,
                                 java.lang.String tn)
                          throws ObjectStoreException
Returns:
the current state of the object's state (e.g., shadowed, committed ...)
Throws:
ObjectStoreException

getStoreName

public abstract java.lang.String getStoreName()
Returns:
the name of the object store.

commit_state

public abstract boolean commit_state(Uid u,
                                     java.lang.String tn)
                              throws ObjectStoreException
Commit the object's state in the object store.

Returns:
true if no errors occurred, false otherwise.
Throws:
ObjectStoreException

hide_state

public abstract boolean hide_state(Uid u,
                                   java.lang.String tn)
                            throws ObjectStoreException
Hide the object's state in the object store. Used by crash recovery.

Returns:
true if no errors occurred, false otherwise.
Throws:
ObjectStoreException

reveal_state

public abstract boolean reveal_state(Uid u,
                                     java.lang.String tn)
                              throws ObjectStoreException
Reveal a hidden object's state.

Returns:
true if no errors occurred, false otherwise.
Throws:
ObjectStoreException

read_committed

public abstract InputObjectState read_committed(Uid u,
                                                java.lang.String tn)
                                         throws ObjectStoreException
Read the object's committed state.

Returns:
the state of the object.
Throws:
ObjectStoreException

read_uncommitted

public abstract InputObjectState read_uncommitted(Uid u,
                                                  java.lang.String tn)
                                           throws ObjectStoreException
Read the object's shadowed state.

Returns:
the state of the object.
Throws:
ObjectStoreException

remove_committed

public abstract boolean remove_committed(Uid u,
                                         java.lang.String tn)
                                  throws ObjectStoreException
Remove the object's committed state.

Returns:
true if no errors occurred, false otherwise.
Throws:
ObjectStoreException

remove_uncommitted

public abstract boolean remove_uncommitted(Uid u,
                                           java.lang.String tn)
                                    throws ObjectStoreException
Remove the object's uncommitted state.

Returns:
true if no errors occurred, false otherwise.
Throws:
ObjectStoreException

write_committed

public abstract boolean write_committed(Uid u,
                                        java.lang.String tn,
                                        OutputObjectState buff)
                                 throws ObjectStoreException
Write a new copy of the object's committed state.

Returns:
true if no errors occurred, false otherwise.
Throws:
ObjectStoreException

write_uncommitted

public abstract boolean write_uncommitted(Uid u,
                                          java.lang.String tn,
                                          OutputObjectState buff)
                                   throws ObjectStoreException
Write a copy of the object's uncommitted state.

Returns:
true if no errors occurred, false otherwise.
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.

Throws:
java.io.SyncFailedException
ObjectStoreException

locateStore

public java.lang.String locateStore(java.lang.String localOSRoot)
                             throws ObjectStoreException
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?

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

className

public ClassName className()

shareState

public final int shareState()

storeDir

public final java.lang.String storeDir()

storeRoot

public final java.lang.String storeRoot()

name

public static ClassName name()

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.