package org.opennms.netmgt.queued;

import java.util.Set;

import org.opennms.netmgt.capsd.EventUtils;
import org.opennms.netmgt.daemon.AbstractServiceDaemon;
import org.opennms.netmgt.eventd.EventIpcManager;
import org.opennms.netmgt.eventd.EventListener;
import org.opennms.netmgt.rrd.RrdStrategy;
import org.opennms.netmgt.xml.event.Event;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;

public class Queued extends AbstractServiceDaemon implements EventListener {
    
    private EventIpcManager m_eventMgr; 
    private RrdStrategy m_rrdStrategy;

    public Queued() {
        super("Queued");
    }
    
    public void setEventIpcManager(EventIpcManager eventMgr) {
        m_eventMgr = eventMgr;
    }
    
    public void setRrdStrategy(RrdStrategy rrdStrategy) {
        m_rrdStrategy = rrdStrategy;
    }
    
    
    @Override
    protected void onInit() {
        Assert.state(m_eventMgr != null, "setEventIpcManager must be set");
        Assert.state(m_rrdStrategy != null, "rrdStrategy must be set");
        
        m_eventMgr.addEventListener(this, "uei.opennms.org/internal/promoteQueueData");
    }

    public void onEvent(Event e) {
        String fileList = EventUtils.getParm(e, "filesToPromote");
        Set<String> files = StringUtils.commaDelimitedListToSet(fileList);
        
        m_rrdStrategy.promoteEnqueuedFiles(files);
    }

}

@@ -1331,16 +1331,50 @@
 leList);
+%0A%0A        logFilePromotion(files);
 %0A       
@@ -1431,12 +1431,415 @@
 );%0A    %7D
+%0A    %0A    private void logFilePromotion(Set%3CString%3E files) %7B%0A        if (!log().isDebugEnabled()) %7B%0A            return;%0A        %7D%0A        %0A        for(String file : files) %7B%0A            debugf(%22Promoting file: %25s%22, file);%0A        %7D%0A    %7D%0A%0A    private void debugf(String format, Object... args) %7B%0A        if (log().isDebugEnabled()) %7B%0A            log().debug(String.format(format, args));%0A        %7D%0A    %7D
 %0A%0A%7D%0A

Add logging messages for file promotion