01: /*
02: * All content copyright (c) 2003-2007 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
03: */
04: package org.terracotta.dso.views;
05:
06: import com.terracottatech.config.Autolock;
07: import com.terracottatech.config.DsoApplication;
08: import com.terracottatech.config.Locks;
09: import com.terracottatech.config.NamedLock;
10:
11: public class LocksWrapper {
12: private DsoApplication fApp;
13:
14: LocksWrapper(DsoApplication app) {
15: fApp = app;
16: }
17:
18: int sizeOfLocksArray() {
19: Locks locks = fApp.getLocks();
20: return locks != null ? locks.sizeOfAutolockArray()
21: + locks.sizeOfNamedLockArray() : 0;
22: }
23:
24: int sizeOfAutolockArray() {
25: Locks locks = fApp.getLocks();
26: return locks != null ? locks.sizeOfAutolockArray() : 0;
27: }
28:
29: Autolock getAutolockArray(int i) {
30: Locks locks = fApp.getLocks();
31: return locks != null ? locks.getAutolockArray(i) : null;
32: }
33:
34: void removeAutolock(int i) {
35: Locks locks = fApp.getLocks();
36: if (locks != null) {
37: locks.removeAutolock(i);
38: }
39: if (sizeOfLocksArray() == 0) {
40: fApp.unsetLocks();
41: }
42: }
43:
44: int sizeOfNamedLockArray() {
45: Locks locks = fApp.getLocks();
46: return locks != null ? locks.sizeOfNamedLockArray() : 0;
47: }
48:
49: NamedLock getNamedLockArray(int i) {
50: Locks locks = fApp.getLocks();
51: return locks != null ? locks.getNamedLockArray(i) : null;
52: }
53:
54: void removeNamedLock(int i) {
55: Locks locks = fApp.getLocks();
56: if (locks != null) {
57: locks.removeNamedLock(i);
58: }
59: if (sizeOfLocksArray() == 0) {
60: fApp.unsetLocks();
61: }
62: }
63: }
|