Your browser does not support JavaScript and this site utilizes JavaScript to build content and provide links to additional information. You should either enable JavaScript in your browser settings or use a browser that supports JavaScript in order to take full advantage of this site.
1 46 package org.bsf.remoteIterator.client; 47 48 import org.bsf.remoteIterator.common.RemoteIteratorResultTable; 49 import org.bsf.remoteIterator.server.RemoteIterator; 50 51 import javax.ejb.RemoveException ; 52 import java.io.Serializable ; 53 import java.rmi.RemoteException ; 54 import java.util.Iterator ; 55 import java.util.List ; 56 57 63 public class RemoteIteratorClient implements Serializable { 64 68 private boolean _isLast = false; 69 private boolean _isFirst = true; 70 71 74 private int _rowCount = -1; 75 76 private RemoteIterator _remote = null; 77 78 82 public RemoteIteratorClient( RemoteIterator p_remoteIteratorProxy ) throws IllegalArgumentException { 83 _remote = p_remoteIteratorProxy; 84 } 85 86 90 public synchronized Iterator absolute( int p_position ) throws RemoteException { 91 if ( _remote == null ) return null; 92 return getResult( _remote.absolute( p_position ) ).iterator(); 93 } 94 95 public synchronized Iterator absolute( int p_position, int p_nbRecords ) throws RemoteException { 96 if ( _remote == null ) return null; 97 return getResult( _remote.absolute( p_position, p_nbRecords ) ).iterator(); 98 } 99 103 public synchronized Iterator next() throws RemoteException { 104 if ( _remote == null ) return null; 105 return getResult( _remote.next() ).iterator(); 106 } 107 108 public synchronized Iterator next( int p_nbRecords ) throws RemoteException { 109 if ( _remote == null ) return null; 110 return getResult( _remote.next( p_nbRecords ) ).iterator(); 111 } 112 113 117 public synchronized Iterator previous() throws RemoteException { 118 if ( _remote == null ) return null; 119 return getResult( _remote.previous() ).iterator(); 120 } 121 122 public synchronized Iterator previous( int p_nbRecords ) throws RemoteException { 123 if ( _remote == null ) return null; 124 return getResult( _remote.previous( p_nbRecords ) ).iterator(); 125 } 126 127 131 private synchronized List getResult( RemoteIteratorResultTable p_riResult ) { 132 _isLast = p_riResult.isLast(); 133 _isFirst = p_riResult.isFirst(); 134 135 return p_riResult.getRows(); 136 } 137 138 143 public synchronized void remove() throws RemoteException { 144 try { 145 if ( _remote != null ) { 146 _remote.remove(); 148 } 149 } catch( RemoveException e ) { 150 throw new RemoteException ( e.getLocalizedMessage() ); 151 } finally { 152 _remote = null; 154 } 155 } 156 157 164 public synchronized boolean hasRemoteReference() { 165 if ( _remote != null ) { 166 return true; 167 } 168 169 return false; 170 } 171 172 176 179 public synchronized List getColumnMetatData() throws RemoteException { 180 if ( _remote == null ) { 181 return null; 182 } 183 184 return _remote.getColumnMetaData(); 185 } 186 187 191 public synchronized int getRecordCount() throws RemoteException { 192 if ( _rowCount == -1 && _remote != null ) { 193 _rowCount = _remote.getRowCount().intValue(); 195 } 196 197 return _rowCount; 198 } 199 200 public synchronized boolean isLast() { 201 return _isLast; 202 } 203 204 public synchronized boolean isFirst() { 205 return _isFirst; 206 } 207 } 208 209
| Popular Tags
|