@Override public void addEvent(Event event) { m_events.addEvent(event); m_events.initialize(m_partition, new EventOrdering()); }
@Override public void reload() throws DataAccessException { InputStream is = null; InputStreamReader isr = null; try { is = m_resource.getInputStream(); isr = new InputStreamReader(is); final Reader reader = isr; m_events = JaxbUtils.unmarshal(Events.class, reader); m_events.loadEventFiles(m_resource); m_events.initialize(new EnterpriseIdPartition(), new EventOrdering()); } catch (final IOException e) { throw new DataRetrievalFailureException("Failed to read from " + m_resource.toString(), e); } finally { IOUtils.closeQuietly(isr); IOUtils.closeQuietly(is); } }
public void initialize(final Partition partition, final EventOrdering eventOrdering) { m_ordering = eventOrdering; for (final Event event : m_events) { event.initialize(m_ordering.next()); } partitionEvents(partition); for (final Events events : m_loadedEventFiles.values()) { events.initialize(partition, m_ordering.subsequence()); } // roll up all prioritized events and sort all events by priority // must be done after event.initialize() has been called to set the event.index List<Event> prioritizedEvents = getPrioritizedEvents(); m_events.addAll(prioritizedEvents); m_events.sort(Comparator.naturalOrder()); // Also add to unpartitioned events for first crack when not using a UEI match m_nullPartitionedEvents.addAll(prioritizedEvents); m_nullPartitionedEvents.sort(Comparator.naturalOrder()); indexEventsByUei(); }
@Override public void reload() throws DataAccessException { InputStream is = null; InputStreamReader isr = null; try { is = m_resource.getInputStream(); isr = new InputStreamReader(is); final Reader reader = isr; m_events = JaxbUtils.unmarshal(Events.class, reader); m_events.loadEventFiles(m_resource); m_events.initialize(new EnterpriseIdPartition(), new EventOrdering()); } catch (final IOException e) { throw new DataRetrievalFailureException("Failed to read from " + m_resource.toString(), e); } finally { IOUtils.closeQuietly(isr); IOUtils.closeQuietly(is); } }
@Override public boolean removeEventFromProgrammaticStore(Event event) { Events programmaticEvents = m_events.getLoadEventsByFile(m_programmaticStoreRelativePath); if (programmaticEvents == null) return false; programmaticEvents.removeEvent(event); if (programmaticEvents.getEvents().size() <= 0) { m_events.removeLoadedEventFile(m_programmaticStoreRelativePath); } m_events.initialize(m_partition, new EventOrdering()); return true; }
events.initialize(m_partition, new EventOrdering());
@Override public void addEventToProgrammaticStore(Event event) { Events programmaticEvents = m_events.getLoadEventsByFile(m_programmaticStoreRelativePath); if (programmaticEvents == null) { programmaticEvents = new Events(); m_events.addLoadedEventFile(m_programmaticStoreRelativePath, programmaticEvents); } programmaticEvents.addEvent(event); m_events.initialize(m_partition, new EventOrdering()); }
private synchronized void loadConfig() throws DataAccessException { try { Events events = JaxbUtils.unmarshal(Events.class, m_configResource); m_lastModifiedEventFiles = events.loadEventFiles(m_configResource); m_partition = new EnterpriseIdPartition(); events.initialize(m_partition, new EventOrdering()); m_events = events; } catch (Exception e) { throw new DataRetrievalFailureException("Unabled to load " + m_configResource, e); } }