1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.directory.api.ldap.model.cursor;
20
21
22 import java.util.Iterator;
23
24 import org.apache.directory.api.i18n.I18n;
25
26
27
28
29
30
31
32
33 public abstract class AbstractCursor<E> implements Cursor<E>
34 {
35
36 private ClosureMonitor monitor = new DefaultClosureMonitor();
37
38
39
40
41
42 public void setClosureMonitor( ClosureMonitor monitor )
43 {
44 if ( monitor == null )
45 {
46 throw new IllegalArgumentException( I18n.err( I18n.ERR_02001_MONITOR ) );
47 }
48
49 this.monitor = monitor;
50 }
51
52
53
54
55
56
57
58
59 public final void checkNotClosed( String operation ) throws CursorClosedException
60 {
61 monitor.checkNotClosed();
62 }
63
64
65
66
67
68 public boolean isClosed()
69 {
70 return monitor.isClosed();
71 }
72
73
74
75
76
77 public void close( Exception cause )
78 {
79 monitor.close( cause );
80 }
81
82
83
84
85
86 public void close()
87 {
88 monitor.close();
89 }
90
91
92
93
94
95 public Iterator<E> iterator()
96 {
97 return new CursorIterator<E>( this );
98 }
99
100
101
102
103
104 public boolean isAfterLast()
105 {
106 throw new UnsupportedOperationException( I18n.err( I18n.ERR_02014_UNSUPPORTED_OPERATION, getClass().getName()
107 .concat( "." ).concat( "isAfterLast()" ) ) );
108 }
109
110
111
112
113
114 public boolean isBeforeFirst()
115 {
116 throw new UnsupportedOperationException( I18n.err( I18n.ERR_02014_UNSUPPORTED_OPERATION, getClass().getName()
117 .concat( "." ).concat( "isBeforeFirst()" ) ) );
118 }
119
120
121
122
123
124 public boolean isFirst()
125 {
126 throw new UnsupportedOperationException( I18n.err( I18n.ERR_02014_UNSUPPORTED_OPERATION, getClass().getName()
127 .concat( "." ).concat( "isFirst()" ) ) );
128 }
129
130
131
132
133
134 public boolean isLast()
135 {
136 throw new UnsupportedOperationException( I18n.err( I18n.ERR_02014_UNSUPPORTED_OPERATION, getClass().getName()
137 .concat( "." ).concat( "isLast()" ) ) );
138 }
139
140
141
142
143
144 public String toString( String tabs )
145 {
146 return tabs;
147 }
148 }