use of org.apache.jackrabbit.rmi.client.RemoteRuntimeException in project jackrabbit by apache.
the class ClientIterator method skip.
/**
* Skips the given number of elements in this iteration.
* <p>
* The elements in the local element buffer are skipped first, and
* a remote skip method call is made only if more elements are being
* skipped than remain in the local buffer.
*
* @param skipNum the number of elements to skip
* @throws NoSuchElementException if skipped past the last element
* @throws RemoteRuntimeException on RMI errors
* @see RangeIterator#skip(long)
*/
public void skip(long skipNum) throws NoSuchElementException, RemoteRuntimeException {
if (skipNum < 0) {
throw new IllegalArgumentException("Negative skip is not allowed");
} else if (buffer == null && skipNum > 0) {
throw new NoSuchElementException("Skipped past the last element");
} else if (positionInBuffer + skipNum <= buffer.length) {
positionInBuffer += skipNum;
} else {
try {
skipNum -= buffer.length - positionInBuffer;
remote.skip(skipNum);
positionInBuffer = buffer.length;
positionOfBuffer += skipNum;
} catch (RemoteException e) {
throw new RemoteRuntimeException(e);
} catch (NoSuchElementException e) {
// End of iterator reached
buffer = null;
throw e;
}
}
}
use of org.apache.jackrabbit.rmi.client.RemoteRuntimeException in project jackrabbit by apache.
the class ClientGroup method members.
public Enumeration<? extends Principal> members() {
try {
final RemoteIterator remote = ((RemoteGroup) getRemotePrincipal()).members();
final Iterator<Principal> pi = factory.getPrincipalIterator(remote);
return new Enumeration<Principal>() {
public boolean hasMoreElements() {
return pi.hasNext();
}
public Principal nextElement() {
return pi.next();
}
};
} catch (RemoteException re) {
throw new RemoteRuntimeException(re);
}
}
Aggregations