Merge "BUG 3057 - notify added event source by topics created before"
authorTony Tkacik <ttkacik@cisco.com>
Mon, 4 May 2015 12:04:58 +0000 (12:04 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Mon, 4 May 2015 12:04:58 +0000 (12:04 +0000)
1  2 
opendaylight/md-sal/messagebus-impl/src/main/java/org/opendaylight/controller/messagebus/app/impl/EventSourceTopology.java

index b879eacda015b5d810ce535234dcbf1396f8d78c,7771b82491f61f90207ac737742538bf370323d0..6140a78ba586a7beaa89a92ae0ab9cc5fb109016
@@@ -78,10 -78,10 +78,10 @@@ public class EventSourceTopology implem
                      .child(TopologyTypes.class)
                      .augmentation(TopologyTypes1.class);
  
-     private final Map<DataChangeListener, ListenerRegistration<DataChangeListener>> topicListenerRegistrations =
+     private final Map<EventSourceTopic, ListenerRegistration<DataChangeListener>> topicListenerRegistrations =
              new ConcurrentHashMap<>();
      private final Map<NodeKey, RoutedRpcRegistration<EventSourceService>> routedRpcRegistrations =
-             new ConcurrentHashMap<>();;
+             new ConcurrentHashMap<>();
  
      private final DataBroker dataBroker;
      private final RpcRegistration<EventAggregatorService> aggregatorRpcReg;
  
          final NotificationPattern notificationPattern = new NotificationPattern(input.getNotificationPattern());
          final String nodeIdPattern = input.getNodeIdPattern().getValue();
 -        final Pattern nodeIdPatternRegex = Pattern.compile(Util.wildcardToRegex(nodeIdPattern));
 +        final Pattern nodeIdPatternRegex = Pattern.compile(nodeIdPattern);
          final EventSourceTopic eventSourceTopic = new EventSourceTopic(notificationPattern, nodeIdPattern, eventSourceService);
  
          registerTopic(eventSourceTopic);
      }
  
      public void register(final EventSource eventSource){
-     NodeKey nodeKey = eventSource.getSourceNodeKey();
+         NodeKey nodeKey = eventSource.getSourceNodeKey();
          final KeyedInstanceIdentifier<Node, NodeKey> sourcePath = EVENT_SOURCE_TOPOLOGY_PATH.child(Node.class, nodeKey);
          RoutedRpcRegistration<EventSourceService> reg = rpcRegistry.addRoutedRpcImplementation(EventSourceService.class, eventSource);
          reg.registerPath(NodeContext.class, sourcePath);
          routedRpcRegistrations.put(nodeKey,reg);
          insert(sourcePath);
+         for(EventSourceTopic est : topicListenerRegistrations.keySet()){
+             est.notifyNode(EVENT_SOURCE_TOPOLOGY_PATH.child(Node.class, nodeKey));
+         }
      }
  
      public void unRegister(final EventSource eventSource){