Package org.dlese.dpc.datamgr
Class DataManager
java.lang.Object
org.dlese.dpc.datamgr.DataManager
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
SerializedDataManager
Provides an abstract implementation of a common interface for applications
needing to work with a data store. Implementers of
DataListener
register with a DataManager instance. An instance of data is
uniquely identified using an object identifier. Applications must request
locks to restrict writing of data.
- Version:
- 1.0, 9/30/02
- Author:
- Dave Deniman, John Weatherley
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract booleanDeletes an existing data object iff the object is not locked.abstract booleanDeletes an existing data object, assuming the caller had requested and recieved the necessary lock.abstract ObjectRetrieves a single data object.abstract ListRetrieves aListof data objects.abstract booleanDetermine whether a given object is locked.abstract booleanisValidLock(String oid, String lockKey) Determine whether a given object is locked with the given key.abstract StringRequest a lock for a data object.abstract booleanDetermines whether an object with the given oid exists in the DataManager.abstract ObjectAdds a new object of data.abstract ObjectRemoves an existing data object iff the object is not locked.abstract ObjectRemoves an existing data object, assuming the caller had requested and recieved the necessary lock.abstract booleanRemove the lock on a data object.abstract ObjectUpdates a new object of data iff the object is not locked.abstract ObjectUpdates a new object of data, assuming the caller had requested and recieved the necessary lock.
-
Constructor Details
-
DataManager
public DataManager()
-
-
Method Details
-
get
Retrieves a single data object.- Parameters:
oid- The data identifier- Returns:
Objectof data- Throws:
OIDDoesNotExistException
-
get
Retrieves aListof data objects.- Parameters:
oids-Listof data identifiers- Returns:
Listof corresponding data objects- Throws:
OIDDoesNotExistException
-
put
public abstract Object put(String oid, Object obj) throws OIDAlreadyExistsException, ObjectNotSupportedException Adds a new object of data.- Parameters:
oid- The unique identifier that references the new data objectobj- The new data object- Returns:
- The added data object, if successful
- Throws:
OIDAlreadyExistsExceptionObjectNotSupportedException
-
remove
public abstract Object remove(String oid, String lockKey) throws OIDDoesNotExistException, InvalidLockException Removes an existing data object, assuming the caller had requested and recieved the necessary lock.- Parameters:
oid- The unique identifier that references the data object to be removedlockKey- The key corresponding to the lock on this data object- Returns:
- The removed data object, if successful
- Throws:
OIDDoesNotExistExceptionInvalidLockException
-
remove
public abstract Object remove(String oid) throws OIDDoesNotExistException, LockNotAvailableException Removes an existing data object iff the object is not locked. If the object is locked a LockNotAvailableException is thrown. After successful completion the object is removed from the DataManager and returned to the caller.- Parameters:
oid- The unique identifier that references the data object to be removed- Throws:
OIDDoesNotExistExceptionLockNotAvailableException
-
delete
public abstract boolean delete(String oid, String lockKey) throws OIDDoesNotExistException, InvalidLockException Deletes an existing data object, assuming the caller had requested and recieved the necessary lock. Similar toremove()except no object is returned and thus is more efficient if an object is not required.- Parameters:
oid- The unique identifier that references the data object to be deletedlockKey- The key corresponding to the lock on this data object- Throws:
OIDDoesNotExistExceptionInvalidLockException
-
delete
public abstract boolean delete(String oid) throws OIDDoesNotExistException, LockNotAvailableException Deletes an existing data object iff the object is not locked. If the object is locked a LockNotAvailableException is thrown. Similar toremove()except no object is returned and thus is more efficient. After successful completion the object is deleted from the DataManager.- Parameters:
oid- The unique identifier that references the data object to be deleted- Throws:
OIDDoesNotExistExceptionLockNotAvailableException
-
update
public abstract Object update(String oid, Object obj, String lockKey) throws OIDDoesNotExistException, ObjectNotSupportedException, InvalidLockException Updates a new object of data, assuming the caller had requested and recieved the necessary lock.- Parameters:
oid- The unique identifier that references the data object to be updatedobj- The new updated data objectlockKey- The key corresponding to the lock on this data object- Returns:
- The updated data object, if successful
- Throws:
OIDDoesNotExistExceptionObjectNotSupportedExceptionInvalidLockException
-
update
public abstract Object update(String oid, Object obj) throws OIDDoesNotExistException, ObjectNotSupportedException, LockNotAvailableException Updates a new object of data iff the object is not locked. If the object is locked a LockNotAvailableException is thrown.- Parameters:
oid- The unique identifier that references the data object to be updatedobj- The new updated data object- Returns:
- The updated data object, if successful otherwise null
- Throws:
OIDDoesNotExistExceptionObjectNotSupportedExceptionLockNotAvailableException
-
lock
Request a lock for a data object.- Parameters:
oid- The unique identifier that references the data object to be locked- Returns:
- The key for this lock, as a String, if successful
- Throws:
OIDDoesNotExistExceptionLockNotAvailableException
-
unlock
public abstract boolean unlock(String oid, String lockKey) throws OIDDoesNotExistException, InvalidLockException Remove the lock on a data object.- Parameters:
oid- The unique identifier that references the locked data objectlockKey- The key corresponding to the lock on this data object- Returns:
- true if successful, false otherwise
- Throws:
OIDDoesNotExistExceptionInvalidLockException
-
oidExists
Determines whether an object with the given oid exists in the DataManager.- Parameters:
oid- The unique identifier that references the data object- Returns:
- True iff the given object exists in this DataManager
-
isLocked
Determine whether a given object is locked.- Parameters:
oid- The unique identifier that references the data object- Returns:
- True iff the object referred to by this oid is locked
-
isValidLock
Determine whether a given object is locked with the given key.- Parameters:
oid- The unique identifier that references the data objectlockKey- The lock key- Returns:
- True iff the object referred to by this oid is locked with the given key
-