Salome HOME
Copyrights update 2015.
[tools/siman.git] / Workspace / Siman-Common / src / org / splat / service / LockService.java
1 /*****************************************************************************
2  * Company         OPEN CASCADE
3  * Application     SIMAN
4  * File            Id: 
5  * Creation date   02.10.2012
6  * @author         Author: Maria KRUCHININA
7  * @version        Revision: 
8  *****************************************************************************/
9
10 package org.splat.service; 
11
12 import org.splat.exception.LockAlreadyExistsException;
13 import org.splat.exception.LockNotExistsException;
14 import org.splat.exception.LockOutdatedException;
15 import org.splat.exception.LockProtectedException;
16
17 /**
18  * Service interface class for lock management.
19  * @author mka
20  *
21  */
22 public interface LockService {
23
24         /**
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
30          */
31         void lock(final String rowUid, final String tableUid, final String userUid) throws LockAlreadyExistsException;
32         
33         /**
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
40          */
41         void unlock(final String rowUid, final String tableUid, final String userUid) throws LockNotExistsException, LockProtectedException;
42
43         /**
44          * Unlock all datas rox for one user.
45          * @param userUid User uid
46          */
47         void unlockAll(final String userUid);
48         
49         /**
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
58          */
59         void check(final String rowUid, final String tableUid, final String userUid) throws LockNotExistsException, LockProtectedException, LockOutdatedException;
60
61 }