|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jasig.portal.concurrency.locking.RDBMEntityLockStore
public class RDBMEntityLockStore
RDBMS-based store for IEntityLocks
.
Field Summary | |
---|---|
private static java.lang.String |
addSql
|
private static java.lang.String |
allLockColumns
|
private static java.lang.String |
deleteLockSql
|
private static java.lang.String |
ENTITY_KEY_COLUMN
|
private static java.lang.String |
ENTITY_TYPE_COLUMN
|
private static java.lang.String |
EQ
|
private static java.lang.String |
EXPIRATION_TIME_COLUMN
|
private static java.lang.String |
GT
|
private static java.lang.String |
LOCK_OWNER_COLUMN
|
private static java.lang.String |
LOCK_TABLE
|
private static java.lang.String |
LOCK_TYPE_COLUMN
|
private static org.apache.commons.logging.Log |
log
|
private static java.lang.String |
LT
|
private static java.lang.String |
QUOTE
|
private static IEntityLockStore |
singleton
|
private static boolean |
timestampHasMillis
|
private static java.lang.String |
updateSql
|
Constructor Summary | |
---|---|
RDBMEntityLockStore()
RDBMEntityGroupStore constructor. |
Method Summary | |
---|---|
void |
add(IEntityLock lock)
Adds the lock to the underlying store. |
void |
delete(IEntityLock lock)
If this IEntityLock exists, delete it. |
void |
deleteAll()
Delete all IEntityLocks from the underlying store. |
void |
deleteExpired(java.util.Date expiration)
Delete all expired IEntityLocks from the underlying store. |
void |
deleteExpired(java.util.Date expiration,
java.lang.Class entityType,
java.lang.String entityKey)
Delete IEntityLocks from the underlying store that have expired as of expiration . |
void |
deleteExpired(IEntityLock lock)
Delete all expired IEntityLocks from the underlying store. |
IEntityLock[] |
find(java.lang.Class entityType,
java.lang.String entityKey,
java.lang.Integer lockType,
java.util.Date expiration,
java.lang.String lockOwner)
Retrieve IEntityLocks from the underlying store. |
IEntityLock[] |
findUnexpired(java.util.Date expiration,
java.lang.Class entityType,
java.lang.String entityKey,
java.lang.Integer lockType,
java.lang.String lockOwner)
Retrieve IEntityLocks from the underlying store. |
private static java.lang.String |
getAddSql()
SQL for inserting a row into the lock table. |
private static java.lang.String |
getAllLockColumns()
|
private static java.lang.String |
getDeleteLockSql()
SQL for deleting a row on the lock table. |
private static java.lang.String |
getSelectSql()
|
private static long |
getTimestampMillis(java.sql.Timestamp ts)
|
private static java.lang.String |
getUpdateSql()
SQL for updating a row on the lock table. |
private void |
initialize()
Cleanup the store by deleting locks expired an hour ago. |
private IEntityLock |
instanceFromResultSet(java.sql.ResultSet rs)
Extract values from ResultSet and create a new lock. |
private IEntityLock |
newInstance(java.lang.Class entityType,
java.lang.String entityKey,
int lockType,
java.util.Date expirationTime,
java.lang.String lockOwner)
|
private void |
primAdd(IEntityLock lock,
java.sql.Connection conn)
Add the lock to the underlying store. |
private void |
primDelete(IEntityLock lock,
java.sql.Connection conn)
Delete the IEntityLock from the underlying store. |
private void |
primDeleteExpired(java.util.Date expiration,
java.lang.Class entityType,
java.lang.String entityKey,
java.sql.Connection conn)
Delete IEntityLocks from the underlying store that have expired as of expiration . |
private IEntityLock[] |
primSelect(java.lang.String sql)
Retrieve IEntityLocks from the underlying store. |
private void |
primUpdate(IEntityLock lock,
java.util.Date newExpiration,
java.lang.Integer newType,
java.sql.Connection conn)
Updates the lock's expiration and lockType in the
underlying store. |
private static java.lang.String |
printTimestamp(java.sql.Timestamp ts)
|
private IEntityLock[] |
select(java.lang.Class entityType,
java.lang.String entityKey,
java.lang.Integer lockType,
java.util.Date expiration,
java.lang.String lockOwner)
Retrieve IEntityLocks from the underlying store. |
private IEntityLock[] |
selectUnexpired(java.sql.Timestamp ts,
java.lang.Class entityType,
java.lang.String entityKey,
java.lang.Integer lockType,
java.lang.String lockOwner)
Retrieve IEntityLocks from the underlying store. |
static IEntityLockStore |
singleton()
|
private static java.lang.String |
sqlQuote(java.lang.Object o)
|
void |
update(IEntityLock lock,
java.util.Date newExpiration)
Updates the lock's expiration in the underlying store. |
void |
update(IEntityLock lock,
java.util.Date newExpiration,
java.lang.Integer newLockType)
Updates the lock's expiration and lockType in the
underlying store. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final org.apache.commons.logging.Log log
private static IEntityLockStore singleton
private static java.lang.String LOCK_TABLE
private static java.lang.String ENTITY_TYPE_COLUMN
private static java.lang.String ENTITY_KEY_COLUMN
private static java.lang.String EXPIRATION_TIME_COLUMN
private static java.lang.String LOCK_OWNER_COLUMN
private static java.lang.String LOCK_TYPE_COLUMN
private static java.lang.String EQ
private static java.lang.String GT
private static java.lang.String LT
private static java.lang.String QUOTE
private static java.lang.String allLockColumns
private static java.lang.String addSql
private static java.lang.String deleteLockSql
private static java.lang.String updateSql
private static boolean timestampHasMillis
Constructor Detail |
---|
public RDBMEntityLockStore() throws LockingException
LockingException
Method Detail |
---|
public void add(IEntityLock lock) throws LockingException
add
in interface IEntityLockStore
lock
-
LockingException
public void delete(IEntityLock lock) throws LockingException
delete
in interface IEntityLockStore
lock
-
LockingException
public void deleteAll() throws LockingException
deleteAll
in interface IEntityLockStore
LockingException
public void deleteExpired(java.util.Date expiration) throws LockingException
deleteExpired
in interface IEntityLockStore
expiration
-
LockingException
public void deleteExpired(java.util.Date expiration, java.lang.Class entityType, java.lang.String entityKey) throws LockingException
expiration
. Params entityType
and
entityKey
are optional.
expiration
- java.util.DateentityType
- ClassentityKey
- String
LockingException
public void deleteExpired(IEntityLock lock) throws LockingException
lock
- IEntityLock
LockingException
public IEntityLock[] find(java.lang.Class entityType, java.lang.String entityKey, java.lang.Integer lockType, java.util.Date expiration, java.lang.String lockOwner) throws LockingException
find
in interface IEntityLockStore
entityType
- ClassentityKey
- StringlockType
- Integer - so we can accept a null value.expiration
- DatelockOwner
- String
LockingException
- - wraps an Exception specific to the store.public IEntityLock[] findUnexpired(java.util.Date expiration, java.lang.Class entityType, java.lang.String entityKey, java.lang.Integer lockType, java.lang.String lockOwner) throws LockingException
findUnexpired
in interface IEntityLockStore
expiration
- DateentityType
- ClassentityKey
- StringlockType
- Integer - so we can accept a null value.lockOwner
- String
LockingException
- - wraps an Exception specific to the store.private static java.lang.String getAddSql()
private static java.lang.String getAllLockColumns()
private static java.lang.String getDeleteLockSql()
private static java.lang.String getSelectSql()
private static java.lang.String getUpdateSql()
private void initialize() throws LockingException
LockingException
private IEntityLock instanceFromResultSet(java.sql.ResultSet rs) throws java.sql.SQLException, LockingException
rs
- java.sql.ResultSet
java.sql.SQLException
LockingException
private IEntityLock newInstance(java.lang.Class entityType, java.lang.String entityKey, int lockType, java.util.Date expirationTime, java.lang.String lockOwner) throws LockingException
LockingException
private void primAdd(IEntityLock lock, java.sql.Connection conn) throws java.sql.SQLException, LockingException
lock
- org.jasig.portal.concurrency.locking.IEntityLockconn
- java.sql.Connection
java.sql.SQLException
LockingException
private void primDelete(IEntityLock lock, java.sql.Connection conn) throws LockingException, java.sql.SQLException
lock
- conn
- the database connection
LockingException
java.sql.SQLException
private void primDeleteExpired(java.util.Date expiration, java.lang.Class entityType, java.lang.String entityKey, java.sql.Connection conn) throws LockingException, java.sql.SQLException
expiration
. Params entityType
and
entityKey
are optional.
expiration
- java.util.DateentityType
- ClassentityKey
- Stringconn
- Connection
LockingException
java.sql.SQLException
private IEntityLock[] primSelect(java.lang.String sql) throws LockingException
sql
- String - the sql string used to select the entity lock rows.
LockingException
- - wraps an Exception specific to the store.private void primUpdate(IEntityLock lock, java.util.Date newExpiration, java.lang.Integer newType, java.sql.Connection conn) throws java.sql.SQLException, LockingException
expiration
and lockType
in the
underlying store. The SQL is over-qualified to make sure the row has not been
updated since the lock was last checked.
lock
- newExpiration
- java.util.DatenewType
- Integerconn
- Connection
java.sql.SQLException
LockingException
private IEntityLock[] select(java.lang.Class entityType, java.lang.String entityKey, java.lang.Integer lockType, java.util.Date expiration, java.lang.String lockOwner) throws LockingException
entityType
- ClassentityKey
- StringlockType
- Integer - so we can accept a null value.expiration
- DatelockOwner
- String
LockingException
- - wraps an Exception specific to the store.private IEntityLock[] selectUnexpired(java.sql.Timestamp ts, java.lang.Class entityType, java.lang.String entityKey, java.lang.Integer lockType, java.lang.String lockOwner) throws LockingException
entityType
- ClassentityKey
- StringlockType
- Integer - so we can accept a null value.lockOwner
- String
LockingException
- - wraps an Exception specific to the store.public static IEntityLockStore singleton() throws LockingException
LockingException
private static java.lang.String sqlQuote(java.lang.Object o)
public void update(IEntityLock lock, java.util.Date newExpiration) throws LockingException
IEntityLockStore
expiration
in the underlying store.
update
in interface IEntityLockStore
lock
- org.jasig.portal.groups.IEntityLocknewExpiration
- java.util.Date
LockingException
public void update(IEntityLock lock, java.util.Date newExpiration, java.lang.Integer newLockType) throws LockingException
expiration
and lockType
in the
underlying store. Param lockType
may be null.
update
in interface IEntityLockStore
lock
- newExpiration
- java.util.DatenewLockType
- Integer
LockingException
private static long getTimestampMillis(java.sql.Timestamp ts)
private static java.lang.String printTimestamp(java.sql.Timestamp ts)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |