private void createEventBundle(javax.jcr.observation.EventIterator events, boolean isLocal) { // do not create events when disposed if (disposed) { return; } List<Event> spiEvents = new ArrayList<Event>(); while (events.hasNext()) { try { Event spiEvent = eventFactory.fromJCREvent(events.nextEvent()); spiEvents.add(spiEvent); } catch (Exception ex) { log.warn("Unable to create SPI Event: " + ex); } } EventBundle bundle = new EventBundleImpl(spiEvents, isLocal); synchronized (eventBundles) { eventBundles.add(bundle); eventBundles.notify(); } } }
private void createEventBundle(javax.jcr.observation.EventIterator events, boolean isLocal) { // do not create events when disposed if (disposed) { return; } List<Event> spiEvents = new ArrayList<Event>(); while (events.hasNext()) { try { Event spiEvent = eventFactory.fromJCREvent(events.nextEvent()); spiEvents.add(spiEvent); } catch (Exception ex) { log.warn("Unable to create SPI Event: " + ex); } } EventBundle bundle = new EventBundleImpl(spiEvents, isLocal); synchronized (eventBundles) { eventBundles.add(bundle); eventBundles.notify(); } } }
bundles[i] = new EventBundleImpl(filteredEvents, bundles[i].isLocal());
bundles[i] = new EventBundleImpl(filteredEvents, bundles[i].isLocal());
return new EventBundleImpl(events, false); } catch (Exception ex) { log.error("extracting events from journal feed", ex);
return new EventBundleImpl(events, false); } catch (Exception ex) { log.error("extracting events from journal feed", ex);
isLocal = Boolean.parseBoolean(value); bundles.add(new EventBundleImpl( buildEventList(bundleElement, sessionInfo, uri), isLocal));
isLocal = Boolean.parseBoolean(value); bundles.add(new EventBundleImpl( buildEventList(bundleElement, sessionInfo, uri), isLocal));
/** * {@inheritDoc} */ 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--; } } return new EventBundleImpl(events, false); }
/** * {@inheritDoc} */ 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--; } } return new EventBundleImpl(events, false); }