Class JDBCStore
java.lang.Object
com.arjuna.ats.internal.arjuna.objectstore.jdbc.JDBCStore
- All Implemented Interfaces:
BaseStore
,ObjectStoreAPI
,ParticipantStore
,RecoveryStore
,TxLog
An object store implementation which uses a JDBC database for maintaining
object states. All states are maintained within a single table.
It is assumed that only one object will use a given instance of the
JDBCStore. Hence, there is no need for synchronizations.
-
Field Summary
Modifier and TypeFieldDescriptionprotected JDBCImple_driver
protected final ObjectStoreEnvironmentBean
protected String
-
Constructor Summary
ConstructorDescriptionJDBCStore
(ObjectStoreEnvironmentBean jdbcStoreEnvironmentBean) Create a new JDBCStore -
Method Summary
Modifier and TypeMethodDescriptionboolean
allObjUids
(String s, InputObjectState buff) Obtain all of the Uids for a specified type, regardless of their state.boolean
allObjUids
(String tName, InputObjectState state, int match) Obtain all of the Uids for a specified type.boolean
allTypes
(InputObjectState foundTypes) Obtain all types of objects stored in the object store.boolean
commit_state
(Uid objUid, String tName) Commit the object's state in the object store.int
currentState
(Uid objUid, String tName) boolean
Does this store need to do the full write_uncommitted/commit protocol?boolean
hide_state
(Uid objUid, String tName) Hide the object's state in the object store.boolean
Is the current state of the object the same as that provided as the last parameter?void
packInto
(OutputBuffer buff) read_committed
(Uid storeUid, String tName) Read the object's committed state.read_uncommitted
(Uid storeUid, String tName) Read the object's shadowed state.boolean
remove_committed
(Uid storeUid, String tName) Remove the object's committed state.boolean
remove_uncommitted
(Uid storeUid, String tName) Remove the object's uncommitted state.boolean
reveal_state
(Uid objUid, String tName) Reveal a hidden object's state.void
start()
void
stop()
void
sync()
Some object store implementations may be running with automatic sync disabled.void
unpackFrom
(InputBuffer buff) boolean
write_committed
(Uid storeUid, String tName, OutputObjectState state) Write a new copy of the object's committed state.boolean
write_uncommitted
(Uid storeUid, String tName, OutputObjectState state) Write a copy of the object's uncommitted state.
-
Field Details
-
_theImple
-
tableName
-
jdbcStoreEnvironmentBean
-
-
Constructor Details
-
JDBCStore
Create a new JDBCStore- Parameters:
jdbcStoreEnvironmentBean
- The environment bean containing the configuration- Throws:
ObjectStoreException
- In case the store environment bean was not correctly configured
-
-
Method Details
-
start
public void start() -
stop
public void stop() -
fullCommitNeeded
public boolean fullCommitNeeded()Does this store need to do the full write_uncommitted/commit protocol?- Specified by:
fullCommitNeeded
in interfaceParticipantStore
- Returns:
true
if full commit is needed,false
otherwise.
-
sync
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 interfaceTxLog
- Throws:
SyncFailedException
ObjectStoreException
-
isType
Is the current state of the object the same as that provided as the last parameter?- Specified by:
isType
in interfaceRecoveryStore
- 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
-
getStoreName
- Specified by:
getStoreName
in interfaceBaseStore
- Returns:
- the "name" of the object store. Where in the hierarchy it appears, e.g., /ObjectStore/MyName/...
-
allObjUids
Description copied from interface:RecoveryStore
Obtain all of the Uids for a specified type, regardless of their state.- Specified by:
allObjUids
in interfaceRecoveryStore
- Parameters:
s
- The type to scan for.buff
- The object state in which to store the Uids- Returns:
true
if no errors occurred,false
otherwise.- Throws:
ObjectStoreException
-
commit_state
Description copied from interface:ParticipantStore
Commit the object's state in the object store.- Specified by:
commit_state
in interfaceParticipantStore
- Parameters:
objUid
- The object to work on.tName
- The type of the object to work on.- Returns:
true
if no errors occurred,false
otherwise.- Throws:
ObjectStoreException
-
hide_state
Description copied from interface:RecoveryStore
Hide the object's state in the object store. Used by crash recovery.- Specified by:
hide_state
in interfaceRecoveryStore
- Parameters:
objUid
- The object to work on.tName
- The type of the object to work on.- Returns:
true
if no errors occurred,false
otherwise.- Throws:
ObjectStoreException
-
reveal_state
Description copied from interface:RecoveryStore
Reveal a hidden object's state.- Specified by:
reveal_state
in interfaceRecoveryStore
- Parameters:
objUid
- The object to work on.tName
- The type of the object to work on.- Returns:
true
if no errors occurred,false
otherwise.- Throws:
ObjectStoreException
-
currentState
- Specified by:
currentState
in interfaceRecoveryStore
- Parameters:
objUid
- The object to query.tName
- The type of the object to query.- Returns:
- the current state of the object's state (e.g., shadowed, committed ...) [StateStatus]
- Throws:
ObjectStoreException
-
read_committed
Description copied from interface:ParticipantStore
Read the object's committed state.- Specified by:
read_committed
in interfaceParticipantStore
- Specified by:
read_committed
in interfaceRecoveryStore
- Parameters:
storeUid
- The object to work on.tName
- The type of the object to work on.- Returns:
- the state of the object.
- Throws:
ObjectStoreException
-
read_uncommitted
Description copied from interface:ParticipantStore
Read the object's shadowed state.- Specified by:
read_uncommitted
in interfaceParticipantStore
- Parameters:
storeUid
- The object to work on.tName
- The type of the object to work on.- Returns:
- the state of the object.
- Throws:
ObjectStoreException
-
remove_committed
Description copied from interface:TxLog
Remove the object's committed state.- Specified by:
remove_committed
in interfaceTxLog
- Parameters:
storeUid
- The object to work on.tName
- The type of the object to work on.- Returns:
true
if no errors occurred,false
otherwise.- Throws:
ObjectStoreException
-
remove_uncommitted
Description copied from interface:ParticipantStore
Remove the object's uncommitted state.- Specified by:
remove_uncommitted
in interfaceParticipantStore
- Parameters:
storeUid
- The object to work on.tName
- The type of the object to work on.- Returns:
true
if no errors occurred,false
otherwise.- Throws:
ObjectStoreException
-
write_committed
public boolean write_committed(Uid storeUid, String tName, OutputObjectState state) throws ObjectStoreException Description copied from interface:TxLog
Write a new copy of the object's committed state.- Specified by:
write_committed
in interfaceTxLog
- Parameters:
storeUid
- The object to work on.tName
- The type of the object to work on.state
- The state to write.- Returns:
true
if no errors occurred,false
otherwise.- Throws:
ObjectStoreException
-
write_uncommitted
public boolean write_uncommitted(Uid storeUid, String tName, OutputObjectState state) throws ObjectStoreException Description copied from interface:ParticipantStore
Write a copy of the object's uncommitted state.- Specified by:
write_uncommitted
in interfaceParticipantStore
- Parameters:
storeUid
- The object to work on.tName
- The type of the object to work on.state
- The state to write.- Returns:
true
if no errors occurred,false
otherwise.- Throws:
ObjectStoreException
-
allObjUids
public boolean allObjUids(String tName, InputObjectState state, int match) throws ObjectStoreException Description copied from interface:RecoveryStore
Obtain all of the Uids for a specified type.- Specified by:
allObjUids
in interfaceRecoveryStore
- Parameters:
tName
- The type to scan for.state
- The object state in which to store the Uidsmatch
- The file type to look for (e.g., committed, shadowed). [StateStatus] Note: m=OS_UNKNOWN matches any state.- Returns:
true
if no errors occurred,false
otherwise.- Throws:
ObjectStoreException
-
allTypes
Description copied from interface:RecoveryStore
Obtain all types of objects stored in the object store.- Specified by:
allTypes
in interfaceRecoveryStore
- Parameters:
foundTypes
- The state in which to store the types.- Returns:
true
if no errors occurred,false
otherwise.- Throws:
ObjectStoreException
-
packInto
- Throws:
IOException
-
unpackFrom
- Throws:
IOException
-