01: /* Copyright 2002 The JA-SIG Collaborative. All rights reserved.
02: * See license distributed with this file and
03: * available online at http://www.uportal.org/license.html
04: */
05:
06: package org.jasig.portal.concurrency.locking;
07:
08: import java.util.Date;
09:
10: import org.jasig.portal.concurrency.IEntityLock;
11: import org.jasig.portal.concurrency.LockingException;
12:
13: /**
14: * Interface for finding and maintaining <code>IEntityLocks</code>.
15: * @author Dan Ellentuck
16: * @version $Revision: 34757 $
17: */
18: public interface IEntityLockStore {
19: /**
20: * Adds this IEntityLock to the store.
21: * @param lock org.jasig.portal.concurrency.locking.IEntityLock
22: */
23: public void add(IEntityLock lock) throws LockingException;
24:
25: /**
26: * Deletes this IEntityLock from the store.
27: * @param lock org.jasig.portal.concurrency.locking.IEntityLock
28: */
29: public void delete(IEntityLock lock) throws LockingException;
30:
31: /**
32: * Delete all IEntityLocks from the store.
33: */
34: public void deleteAll() throws LockingException;
35:
36: /**
37: * Deletes the expired IEntityLocks from the underlying store.
38: * @param expiration java.util.Date
39: */
40: public void deleteExpired(Date expiration) throws LockingException;
41:
42: /**
43: * Returns an IEntityLock[] based on the params, any or all of which may be null.
44: * A null param means any value, so <code>find(myType,myKey,null,null,null)</code>
45: * will return all <code>IEntityLocks</code> for myType and myKey.
46: *
47: * @return org.jasig.portal.groups.IEntityLock[]
48: * @param entityType Class
49: * @param entityKey String
50: * @param lockType Integer - so we can accept a null value.
51: * @param expiration Date
52: * @param lockOwner String
53: * @exception LockingException - wraps an Exception specific to the store.
54: */
55: public IEntityLock[] find(Class entityType, String entityKey,
56: Integer lockType, Date expiration, String lockOwner)
57: throws LockingException;
58:
59: /**
60: * Returns an IEntityLock[] containing unexpired locks, based on the params,
61: * any or all of which may be null EXCEPT FOR <code>expiration</code>. A null
62: * param means any value, so <code> find(expir,myType,myKey,null,null)</code>
63: * will return all <code>IEntityLocks</code> for myType and myKey unexpired
64: * as of <code>expiration</code>.
65: *
66: * @param expiration Date
67: * @param entityType Class
68: * @param entityKey String
69: * @param lockType Integer - so we can accept a null value.
70: * @param lockOwner String
71: * @exception LockingException - wraps an Exception specific to the store.
72: */
73: public IEntityLock[] findUnexpired(Date expiration,
74: Class entityType, String entityKey, Integer lockType,
75: String lockOwner) throws LockingException;
76:
77: /**
78: * Updates the lock's <code>expiration</code> in the underlying store.
79: * @param lock org.jasig.portal.concurrency.locking.IEntityLock
80: * @param newExpiration java.util.Date
81: */
82: public void update(IEntityLock lock, Date newExpiration)
83: throws LockingException;
84:
85: /**
86: * Updates the lock's <code>expiration</code> and <code>lockType</code> in the
87: * underlying store. Param <code>lockType</code> may be null.
88: * @param lock org.jasig.portal.concurrency.locking.IEntityLock
89: * @param newExpiration java.util.Date
90: * @param newLockType Integer
91: */
92: public void update(IEntityLock lock, Date newExpiration,
93: Integer newLockType) throws LockingException;
94:
95: }
|