1 /*****************************************************************************
5 * Creation date 02.10.2012
6 * @author Author: Maria KRUCHININA
8 *****************************************************************************/
10 package org.splat.service;
12 import org.splat.exception.LockAlreadyExistsException;
13 import org.splat.exception.LockNotExistsException;
14 import org.splat.exception.LockOutdatedException;
15 import org.splat.exception.LockProtectedException;
18 * Service interface class for lock management.
22 public interface LockService {
25 * Lock a data row or update lock on a data row for one user.
26 * @param rowUid Row uid
27 * @param tableUid Table uid
28 * @param userUid User uid
29 * @throws LockAlreadyExistsException when a lock already exists for row uid and another user id
31 void lock(final String rowUid, final String tableUid, final String userUid) throws LockAlreadyExistsException;
34 * Unlock a data row for one user.
35 * @param rowUid Row uid
36 * @param tableUid Table uid
37 * @param userUid User uid
38 * @throws LockNotExistsException when lock does not exist
39 * @throws LockProtectedException lock exists for another user
41 void unlock(final String rowUid, final String tableUid, final String userUid) throws LockNotExistsException, LockProtectedException;
44 * Unlock all datas rox for one user.
45 * @param userUid User uid
47 void unlockAll(final String userUid);
50 * Check lock on a data row in a table for a user.
51 * @param rowUid Row uid
52 * @param tableUid Table uid
53 * @param userUid User uid
54 * @throws LockNotExistsException when lock does not exist
55 * @throws LockProtectedException lock exists for another user
56 * @throws LockOutdatedException when lock on object is in timeout but the
57 * owner of lock is another user
59 void check(final String rowUid, final String tableUid, final String userUid) throws LockNotExistsException, LockProtectedException, LockOutdatedException;