package com.sloshydog.eventuate.inmemory;

import com.google.common.base.Predicate;
import com.sloshydog.eventuate.api.Event;
import com.sloshydog.eventuate.api.EventSpecification;
import com.sloshydog.eventuate.api.EventStore;
import com.sloshydog.eventuate.api.EventStream;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Iterator;
import java.util.List;

import static com.google.common.collect.FluentIterable.from;
import static com.google.common.collect.Lists.newArrayList;

public class InMemoryEventStore implements EventStore {

    private static final Logger LOGGER = LoggerFactory.getLogger(InMemoryEventStore.class);

    private final List<Event> events = newArrayList();

    @Override
    public void store(Event applicationEvent) {
        if (LOGGER.isDebugEnabled()) {
            LOGGER.debug("store the event:%s", applicationEvent);
        }
        events.add(applicationEvent);
    }

    @Override
    public EventStream getMatching(final EventSpecification eventSpecification) {
        return new EventStream() {
            @Override
            public Iterator<Event> iterator() {
                return from(events).filter(new EventSpecificationPredicate(eventSpecification)).iterator();
            }
        };
    }

    private static class EventSpecificationPredicate implements Predicate<Event> {

        private final EventSpecification eventSpecification;

        public EventSpecificationPredicate(EventSpecification eventSpecification) {
            this.eventSpecification = eventSpecification;
        }

        @Override
        public boolean apply(final Event event) {
            return eventSpecification.matches(event);
        }
    }
}

@@ -323,24 +323,52 @@
 erFactory;%0A%0A
+import java.io.IOException;%0A
 import java.
@@ -1270,32 +1270,123 @@
 );%0A            %7D
+%0A%0A            @Override%0A            public void close() throws IOException %7B%0A%0A            %7D
 %0A        %7D;%0A    

Fix broken build.