--- /dev/null
+package org.opendaylight.openflowplugin.openflow.md.core;
+
+import java.util.List;
+
+import org.opendaylight.openflowplugin.openflow.md.core.session.OFSessionUtil;
+import org.opendaylight.openflowplugin.openflow.md.queue.PopListener;
+import org.opendaylight.yangtools.yang.binding.Notification;
+
+public class NotificationPopListener<T> implements PopListener<T> {
+
+
+ @Override
+ public void onPop(List<T> processedMessage) {
+ OFSessionUtil.getSessionManager().getTranslatorMapping();
+ for ( T message : processedMessage ) {
+ if(message instanceof Notification) {
+ OFSessionUtil.getSessionManager().getNotificationProviderService().publish((Notification) message);
+ }
+ }
+
+ }
+
+}
import org.opendaylight.openflowjava.protocol.api.connection.ConnectionAdapter;
import org.opendaylight.openflowjava.protocol.api.connection.SwitchConnectionHandler;
import org.opendaylight.openflowplugin.openflow.md.core.session.OFSessionUtil;
+import org.opendaylight.openflowplugin.openflow.md.queue.PopListener;
import org.opendaylight.openflowplugin.openflow.md.queue.QueueKeeperLightImpl;
/**
*
*/
public class SwitchConnectionHandlerImpl implements SwitchConnectionHandler {
-
+
private QueueKeeperLightImpl queueKeeper;
private ErrorHandler errorHandler;
/**
- *
+ *
*/
public SwitchConnectionHandlerImpl() {
queueKeeper = new QueueKeeperLightImpl();
queueKeeper.init();
// TODO: add pop-listeners consuming object processed via queue
//queueKeeper.addPopListener(listener);
-
+ queueKeeper.addPopListener(new NotificationPopListener());
+
errorHandler = new ErrorHandlerQueueImpl();
new Thread(errorHandler).start();
}