public EventBundle getEvents(SessionInfo sessionInfo,
EventFilter filter,
long after)
throws RepositoryException, UnsupportedRepositoryOperationException {
SessionInfoImpl sInfo = getSessionInfoImpl(sessionInfo);
EventJournal journal = sInfo.getSession().getWorkspace().getObservationManager().getEventJournal();
if (journal == null) {
throw new UnsupportedRepositoryOperationException();
}
EventFactory factory = new EventFactory(sInfo.getSession(),
sInfo.getNamePathResolver(), idFactory, qValueFactory);
journal.skipTo(after);
List<Event> events = new ArrayList<Event>();
int batchSize = 1024;
boolean distinctDates = true;
long lastDate = Long.MIN_VALUE;
while (journal.hasNext() && (batchSize > 0 || !distinctDates)) {
Event e = factory.fromJCREvent(journal.nextEvent());
if (filter.accept(e, false)) {
distinctDates = lastDate != e.getDate();
lastDate = e.getDate();
events.add(e);
batchSize--;