|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface DataStore
Defines the interface to the underlying persistence mechanism to store byte data.
Objects are identified by object IDs, which are positive
longs. Names are mapped to object IDs.
| Method Summary | |
|---|---|
long |
createObject(Transaction txn)
Reserves an object ID for a new object. |
long |
getBinding(Transaction txn,
String name)
Obtains the object ID bound to a name. |
int |
getClassId(Transaction txn,
byte[] classInfo)
Returns the class ID to represent classes with the specified class information. |
byte[] |
getClassInfo(Transaction txn,
int classId)
Returns the class information associated with the specified class ID. |
long |
getLocalNodeId()
Returns the node ID for the local node. |
byte[] |
getObject(Transaction txn,
long oid,
boolean forUpdate)
Obtains the data associated with an object ID. |
void |
markForUpdate(Transaction txn,
long oid)
Notifies the DataStore that an object is going to be
modified. |
String |
nextBoundName(Transaction txn,
String name)
Returns the next name after the specified name that has a binding, or null if there are no more bound names. |
long |
nextObjectId(Transaction txn,
long oid)
Returns the object ID for the next object after the object with the specified ID, or -1 if there are no more objects. |
void |
ready()
Notifies the data store that services associated with the application have been successfully created. |
void |
removeBinding(Transaction txn,
String name)
Removes the binding for a name. |
void |
removeObject(Transaction txn,
long oid)
Removes the object with the specified object ID. |
void |
setBinding(Transaction txn,
String name,
long oid)
Binds an object ID to a name. |
void |
setBindingDescription(Transaction txn,
String name,
Object description)
Associates a description with a bound name, for use in describing name accesses. |
void |
setObject(Transaction txn,
long oid,
byte[] data)
Specifies data to associate with an object ID. |
void |
setObjectDescription(Transaction txn,
long oid,
Object description)
Associates a description with an object ID, for use in describing object accesses. |
void |
setObjects(Transaction txn,
long[] oids,
byte[][] dataArray)
Specifies data to associate with a series of object IDs. |
void |
shutdown()
Shuts down this data store. |
| Method Detail |
|---|
void ready()
throws Exception
Exception - if an error occurslong getLocalNodeId()
long createObject(Transaction txn)
setObject or setObjects is
called. Aborting a transaction is also not required to unassign the ID
so long as other operations treat it as a non-existent object.
txn - the transaction under which the operation should take place
TransactionAbortedException - if the transaction was aborted due
to a lock conflict or timeout
TransactionNotActiveException - if the transaction is not active
IllegalStateException - if the operation failed because of a
problem with the current transaction
void markForUpdate(Transaction txn,
long oid)
DataStore that an object is going to be
modified. The implementation can use this information to obtain an
exclusive lock on the object in order to avoid contention when the
object is modified. This method does nothing if the object does not
exist.
txn - the transaction under which the operation should take placeoid - the object ID
IllegalArgumentException - if oid is negative
TransactionAbortedException - if the transaction was aborted due
to a lock conflict or timeout
TransactionNotActiveException - if the transaction is not active
IllegalStateException - if the operation failed because of a
problem with the current transaction
byte[] getObject(Transaction txn,
long oid,
boolean forUpdate)
forUpdate parameter is true, the caller is
stating its intention to modify the object. The implementation can use
that information to obtain an exclusive lock on the object in order
avoid contention when the object is modified.
txn - the transaction under which the operation should take placeoid - the object IDforUpdate - whether the caller intends to modify the object
IllegalArgumentException - if oid is negative
ObjectNotFoundException - if the object is not found
TransactionAbortedException - if the transaction was aborted due
to a lock conflict or timeout
TransactionNotActiveException - if the transaction is not active
IllegalStateException - if the operation failed because of a
problem with the current transaction
void setObject(Transaction txn,
long oid,
byte[] data)
txn - the transaction under which the operation should take placeoid - the object IDdata - the data
IllegalArgumentException - if oid is negative
TransactionAbortedException - if the transaction was aborted due
to a lock conflict or timeout
TransactionNotActiveException - if the transaction is not active
IllegalStateException - if the operation failed because of a
problem with the current transaction
void setObjects(Transaction txn,
long[] oids,
byte[][] dataArray)
txn - the transaction under which the operation should take placeoids - the object IDsdataArray - the associated data values
IllegalArgumentException - if oids and
data are not the same length, or if
oids contains a value that is negative
TransactionAbortedException - if the transaction was aborted due
to a lock conflict or timeout
TransactionNotActiveException - if the transaction is not active
IllegalStateException - if the operation failed because of a
problem with the current transaction
void removeObject(Transaction txn,
long oid)
ObjectNotFoundException, although this behavior is
not guaranteed. The implementation is not required to check that the
object is an externally visible object rather than one used internally
by the implementation.
txn - the transaction under which the operation should take placeoid - the object ID
IllegalArgumentException - if oid is negative
ObjectNotFoundException - if the object is not found
TransactionAbortedException - if the transaction was aborted due
to a lock conflict or timeout
TransactionNotActiveException - if the transaction is not active
IllegalStateException - if the operation failed because of a
problem with the current transaction
long getBinding(Transaction txn,
String name)
txn - the transaction under which the operation should take placename - the name
NameNotBoundException - if no object ID is bound to the name
TransactionAbortedException - if the transaction was aborted due
to a lock conflict or timeout
TransactionNotActiveException - if the transaction is not active
IllegalStateException - if the operation failed because of a
problem with the current transaction
void setBinding(Transaction txn,
String name,
long oid)
txn - the transaction under which the operation should take placename - the nameoid - the object ID
IllegalArgumentException - if oid is negative
TransactionAbortedException - if the transaction was aborted due
to a lock conflict or timeout
TransactionNotActiveException - if the transaction is not active
IllegalStateException - if the operation failed because of a
problem with the current transaction
void removeBinding(Transaction txn,
String name)
txn - the transaction under which the operation should take placename - the name
NameNotBoundException - if the name is not bound
TransactionAbortedException - if the transaction was aborted due
to a lock conflict or timeout
TransactionNotActiveException - if the transaction is not active
IllegalStateException - if the operation failed because of a
problem with the current transaction
String nextBoundName(Transaction txn,
String name)
null if there are no more bound names. If
name is null, then the search starts at the
beginning.
txn - the transaction under which the operation should take placename - the name to search after, or null to start
at the beginning
name, or
null if there are no more bound names
TransactionAbortedException - if the transaction was aborted due
to a lock conflict or timeout
TransactionNotActiveException - if the transaction is not active
IllegalStateException - if the operation failed because of a
problem with the current transactionvoid shutdown()
int getClassId(Transaction txn,
byte[] classInfo)
0. The
class information is the serialized form of the ObjectStreamClass instance that serialization uses to represent the
class.
txn - the transaction under which the operation should take placeclassInfo - the class information
TransactionAbortedException - if the transaction was aborted due
to a lock conflict or timeout
TransactionNotActiveException - if the transaction is not active
IllegalStateException - if the operation failed because of a
problem with the current transaction
byte[] getClassInfo(Transaction txn,
int classId)
throws ClassInfoNotFoundException
ObjectStreamClass instance that serialization uses to represent the
class.
txn - the transaction under which the operation should take placeclassId - the class ID
IllegalArgumentException - if classId is not greater than
0
ClassInfoNotFoundException - if the ID is not found
TransactionAbortedException - if the transaction was aborted due
to a lock conflict or timeout
IllegalStateException - if the operation failed because of a
problem with the transaction
long nextObjectId(Transaction txn,
long oid)
-1 if there are no more objects. If objectId is -1, then returns the ID of the first object. The
IDs returned by this method will not include ones for objects that have
already been removed, and may not include identifiers for objects
created after an iteration has begun. It is not an error for the object
associated with the specified identifier to have already been
removed. Applications should not assume that objects associated with the IDs returned by this method, but which cannot be reached by traversing object field references starting with an object associated with a name binding, will continue to be retained by the data store.
txn - the transaction under which the operation should take placeoid - the identifier of the object to search after, or
-1 to request the first object
oid, or -1 if there are no more
objects
IllegalArgumentException - if the argument is less than -1
TransactionAbortedException - if the transaction was aborted due
to a lock conflict or timeout
IllegalStateException - if the operation failed because of a
problem with the current transaction
void setObjectDescription(Transaction txn,
long oid,
Object description)
description should provide a meaningful toString method.
txn - the transaction under which the operation should take placeoid - the object IDdescription - the description
IllegalArgumentException - if oid is negative
IllegalStateException - if the operation failed because of a
problem with the current transactionAccessReporter.setObjectDescription
void setBindingDescription(Transaction txn,
String name,
Object description)
description should provide a meaningful toString method.
txn - the transaction under which the operation should take placename - the namedescription - the description
IllegalStateException - if the operation failed because of a
problem with the current transactionAccessReporter.setObjectDescription
|
RedDwarf, Version 0.10.1 2010-03-14 10:56:12 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||