Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jasig.portal.concurrency.locking
Class RDBMEntityLockStore

    java.lang.Object
      org.jasig.portal.concurrency.locking.RDBMEntityLockStore

All Implemented Interfaces:
  IEntityLockStore

    public class RDBMEntityLockStore

extends java.lang.Object
implements IEntityLockStore

RDBMS-based store for `IEntityLocks`.

Version:
  $Revision: 1.19 $
Author:
  Dan Ellentuck

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

### log

    private static final org.apache.commons.logging.Log log

### singleton

    private static IEntityLockStore singleton

### LOCK_TABLE

    private static java.lang.String LOCK_TABLE

### ENTITY_TYPE_COLUMN

    private static java.lang.String ENTITY_TYPE_COLUMN

### ENTITY_KEY_COLUMN

    private static java.lang.String ENTITY_KEY_COLUMN

### EXPIRATION_TIME_COLUMN

    private static java.lang.String EXPIRATION_TIME_COLUMN

### LOCK_OWNER_COLUMN

    private static java.lang.String LOCK_OWNER_COLUMN

### LOCK_TYPE_COLUMN

    private static java.lang.String LOCK_TYPE_COLUMN

### EQ

    private static java.lang.String EQ

### GT

    private static java.lang.String GT

### LT

    private static java.lang.String LT

### QUOTE

    private static java.lang.String QUOTE

### allLockColumns

    private static java.lang.String allLockColumns

### addSql

    private static java.lang.String addSql

### deleteLockSql

    private static java.lang.String deleteLockSql

### updateSql

    private static java.lang.String updateSql

### timestampHasMillis

    private static boolean timestampHasMillis

Constructor Detail

### RDBMEntityLockStore

    public RDBMEntityLockStore()
                        throws LockingException

  RDBMEntityGroupStore constructor.

  Throws:
    `LockingException`

Method Detail

### add

    public void add(IEntityLock lock)
             throws LockingException

  Adds the lock to the underlying store.

  Specified by:
    `add` in interface `IEntityLockStore`
  Parameters:
    `lock` -
  Throws:
    `LockingException`

### delete

    public void delete(IEntityLock lock)
                throws LockingException

  If this IEntityLock exists, delete it.

  Specified by:
    `delete` in interface `IEntityLockStore`
  Parameters:
    `lock` -
  Throws:
    `LockingException`

### deleteAll

    public void deleteAll()
                   throws LockingException

  Delete all IEntityLocks from the underlying store.

  Specified by:
    `deleteAll` in interface `IEntityLockStore`
  Throws:
    `LockingException`

### deleteExpired

    public void deleteExpired(java.util.Date expiration)
                       throws LockingException

  Delete all expired IEntityLocks from the underlying store.

  Specified by:
    `deleteExpired` in interface `IEntityLockStore`
  Parameters:
    `expiration` -
  Throws:
    `LockingException`

### deleteExpired

    public void deleteExpired(java.util.Date expiration,
                              java.lang.Class entityType,
                              java.lang.String entityKey)
                       throws LockingException

  Delete IEntityLocks from the underlying store that have expired as of `expiration`. Params `entityType` and `entityKey` are optional.

  Parameters:
    `expiration` - java.util.Date
    `entityType` - Class
    `entityKey` - String
  Throws:
    `LockingException`

### deleteExpired

    public void deleteExpired(IEntityLock lock)
                       throws LockingException

  Delete all expired IEntityLocks from the underlying store.

  Parameters:
    `lock` - IEntityLock
  Throws:
    `LockingException`

### find

    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

  Retrieve IEntityLocks from the underlying store. Any or all of the parameters may be null.

  Specified by:
    `find` in interface `IEntityLockStore`
  Parameters:
    `entityType` - Class
    `entityKey` - String
    `lockType` - Integer - so we can accept a null value.
    `expiration` - Date
    `lockOwner` - String
  Returns:
    org.jasig.portal.groups.IEntityLock[]
  Throws:
    `LockingException` - - wraps an Exception specific to the store.

### findUnexpired

    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

  Retrieve IEntityLocks from the underlying store. Expiration must not be null.

  Specified by:
    `findUnexpired` in interface `IEntityLockStore`
  Parameters:
    `expiration` - Date
    `entityType` - Class
    `entityKey` - String
    `lockType` - Integer - so we can accept a null value.
    `lockOwner` - String
  Throws:
    `LockingException` - - wraps an Exception specific to the store.

### getAddSql

    private static java.lang.String getAddSql()

  SQL for inserting a row into the lock table.

### getAllLockColumns

    private static java.lang.String getAllLockColumns()

  Returns:
    java.lang.String

### getDeleteLockSql

    private static java.lang.String getDeleteLockSql()

  SQL for deleting a row on the lock table.

### getSelectSql

    private static java.lang.String getSelectSql()

  Returns:
    java.lang.String

### getUpdateSql

    private static java.lang.String getUpdateSql()

  SQL for updating a row on the lock table.

### initialize

    private void initialize()
                     throws LockingException

  Cleanup the store by deleting locks expired an hour ago.

  Throws:
    `LockingException`

### instanceFromResultSet

    private IEntityLock instanceFromResultSet(java.sql.ResultSet rs)
                                       throws java.sql.SQLException,
                                              LockingException

  Extract values from ResultSet and create a new lock.

  Parameters:
    `rs` - java.sql.ResultSet
  Returns:
    org.jasig.portal.groups.IEntityLock
  Throws:
    `java.sql.SQLException`
    `LockingException`

### newInstance

    private IEntityLock newInstance(java.lang.Class entityType,
                                    java.lang.String entityKey,
                                    int lockType,
                                    java.util.Date expirationTime,
                                    java.lang.String lockOwner)
                             throws LockingException

  Returns:
    org.jasig.portal.concurrency.locking.IEntityLock
  Throws:
    `LockingException`

### primAdd

    private void primAdd(IEntityLock lock,
                         java.sql.Connection conn)
                  throws java.sql.SQLException,
                         LockingException

  Add the lock to the underlying store.

  Parameters:
    `lock` - org.jasig.portal.concurrency.locking.IEntityLock
    `conn` - java.sql.Connection
  Throws:
    `java.sql.SQLException`
    `LockingException`

### primDelete

    private void primDelete(IEntityLock lock,
                            java.sql.Connection conn)
                     throws LockingException,
                            java.sql.SQLException

  Delete the IEntityLock from the underlying store.

  Parameters:
    `lock` -
    `conn` - the database connection
  Throws:
    `LockingException`
    `java.sql.SQLException`

### primDeleteExpired

    private void primDeleteExpired(java.util.Date expiration,
                                   java.lang.Class entityType,
                                   java.lang.String entityKey,
                                   java.sql.Connection conn)
                            throws LockingException,
                                   java.sql.SQLException

  Delete IEntityLocks from the underlying store that have expired as of `expiration`. Params `entityType` and `entityKey` are optional.

  Parameters:
    `expiration` - java.util.Date
    `entityType` - Class
    `entityKey` - String
    `conn` - Connection
  Throws:
    `LockingException`
    `java.sql.SQLException`

### primSelect

    private IEntityLock[] primSelect(java.lang.String sql)
                              throws LockingException

  Retrieve IEntityLocks from the underlying store.

  Parameters:
    `sql` - String - the sql string used to select the entity lock rows.
  Throws:
    `LockingException` - - wraps an Exception specific to the store.

### primUpdate

    private void primUpdate(IEntityLock lock,
                            java.util.Date newExpiration,
                            java.lang.Integer newType,
                            java.sql.Connection conn)
                     throws java.sql.SQLException,
                            LockingException

  Updates the lock's `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.

  Parameters:
    `lock` -
    `newExpiration` - java.util.Date
    `newType` - Integer
    `conn` - Connection
  Throws:
    `java.sql.SQLException`
    `LockingException`

### select

    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

  Retrieve IEntityLocks from the underlying store. Any or all of the parameters may be null.

  Parameters:
    `entityType` - Class
    `entityKey` - String
    `lockType` - Integer - so we can accept a null value.
    `expiration` - Date
    `lockOwner` - String
  Throws:
    `LockingException` - - wraps an Exception specific to the store.

### selectUnexpired

    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

  Retrieve IEntityLocks from the underlying store. Expiration must not be null.

  Parameters:
    `entityType` - Class
    `entityKey` - String
    `lockType` - Integer - so we can accept a null value.
    `lockOwner` - String
  Throws:
    `LockingException` - - wraps an Exception specific to the store.

### singleton

    public static IEntityLockStore singleton()
                                      throws LockingException

  Returns:
    org.jasig.portal.concurrency.locking.RDBMEntityLockStore
  Throws:
    `LockingException`

### sqlQuote

    private static java.lang.String sqlQuote(java.lang.Object o)

  Returns:
    java.lang.String

### update

    public void update(IEntityLock lock,
                       java.util.Date newExpiration)
                throws LockingException

  Description copied from interface: `IEntityLockStore`
  Updates the lock's `expiration` in the underlying store.

  Specified by:
    `update` in interface `IEntityLockStore`
  Parameters:
    `lock` - org.jasig.portal.groups.IEntityLock
    `newExpiration` - java.util.Date
  Throws:
    `LockingException`

### update

    public void update(IEntityLock lock,
                       java.util.Date newExpiration,
                       java.lang.Integer newLockType)
                throws LockingException

  Updates the lock's `expiration` and `lockType` in the underlying store. Param `lockType` may be null.

  Specified by:
    `update` in interface `IEntityLockStore`
  Parameters:
    `lock` -
    `newExpiration` - java.util.Date
    `newLockType` - Integer
  Throws:
    `LockingException`

### getTimestampMillis

    private static long getTimestampMillis(java.sql.Timestamp ts)

  Returns:
    long

### printTimestamp

    private static java.lang.String printTimestamp(java.sql.Timestamp ts)

  Returns:
    java.lang.String

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD