package org.helioviewer.jhv.plugins.swek.receive;

import java.util.ArrayList;
import java.util.List;

import org.helioviewer.jhv.data.container.JHVEventHandler;
import org.helioviewer.jhv.data.datatype.JHVEvent;

public class SWEKEventHandler implements JHVEventHandler {
    /** Singleton instance of the SWEKEventHandler */
    private static SWEKEventHandler instance;

    /** the listeners */
    private final List<SWEKEventHandlerListener> listeners;

    /**
     * Private default constructor
     */
    private SWEKEventHandler() {
        listeners = new ArrayList<SWEKEventHandlerListener>();
    }

    /**
     * Gets the singleton instance of the SWEKEventHandler
     * 
     * @return the singleton instance
     */
    public static SWEKEventHandler getSingletonInstace() {
        if (instance == null) {
            instance = new SWEKEventHandler();
        }
        return instance;
    }

    /**
     * Adds a SWEKEventHandlerListener to the SWEKEventHandler
     * 
     * @param listener
     *            the listener to add
     */
    public void addSWEKEventHandlerListener(SWEKEventHandlerListener listener) {
        listeners.add(listener);
    }

    /**
     * Removes the SWEKEventHandlerListener from the SWEKEventHandler
     * 
     * @param listener
     *            the listener to remove
     */
    public void removeSWEKEventHandkerListener(SWEKEventHandlerListener listener) {
        listeners.remove(listener);
    }

    @Override
    public void newEventsReceived(List<JHVEvent> eventList) {

    }

}

@@ -96,16 +96,57 @@
 .List;%0A%0A
+import org.helioviewer.base.logging.Log;%0A
 import o
@@ -1579,16 +1579,337 @@
 List) %7B%0A
+        Log.info(%22New events received.%22);%0A        for (JHVEvent event : eventList) %7B%0A            Log.info(event.getName() + %22 %22 + event.getDisplayName() + %22 %22 + event.getStartDate() + %22-%22 + event.getEndDate());%0A        %7D%0A    %7D%0A%0A    @Override%0A    public void cacheUpdated() %7B%0A        Log.info(%22New Cache update received%22);
 %0A    %7D%0A%0A

Implement the new added interface methods