* Added new method FlowDatabaseOperation.getFlowSourceDpid() that
  can be used to get the Source Switch DPID

* Added a boolean flag to FlowEventHandler and FlowManager to enable/disable
  the new Flow setup mechanism:
    enableOnrc2014MeasurementsFlows

* Create locally the FlowEventHandler.dbHandler instead of
  reusing the dbHandler from the FlowManager.
  Reusing the dbHandler from the FlowManager might not be thread-safe (??)

* Renamed flag FlowEventHandler.accessDBFlag
  to enableOnrc2014MeasurementsTopology
  (for consistency with the Flow setup-related flag)

* Changed the logic when reading the complete topology from the database:
  if there is a topology-related event, we unconditionally assume
  the topology has been modified. Long-term this might be sub-optimal,
  but gives us the bare-bones behavior we want to measure.

* Reverse the change to Topology.readFromDatabase() to exclude the
  compareTopology() call (see above bullet).

* Fix a bug when cheching whether there is any event to process.
diff --git a/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowEventHandler.java b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowEventHandler.java
index 4c801d6..9979664 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowEventHandler.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowEventHandler.java
@@ -45,12 +45,13 @@
  * - Recompute impacted FlowPath using cached Topology.
  */
 class FlowEventHandler extends Thread implements IFlowEventHandlerService {
+
+    private boolean enableOnrc2014MeasurementsFlows = false;
+    private boolean enableOnrc2014MeasurementsTopology = false;
+
     /** The logger. */
     private final static Logger log = LoggerFactory.getLogger(FlowEventHandler.class);
     
-    // Flag to enable feature of acquiring topology information from DB instead of datagrid.
-    private final boolean accessDBFlag = false;
-
     private GraphDBOperation dbHandler;
     private FlowManager flowManager;		// The Flow Manager to use
     private IDatagridService datagridService;	// The Datagrid Service to use
@@ -98,12 +99,10 @@
      * @param datagridService the Datagrid Service to use.
      */
     FlowEventHandler(FlowManager flowManager,
-		     IDatagridService datagridService,
-		     GraphDBOperation dbHandler) {
+		     IDatagridService datagridService) {
 	this.flowManager = flowManager;
 	this.datagridService = datagridService;
 	this.topology = new Topology();
-	this.dbHandler = dbHandler;
     }
 
     /**
@@ -117,6 +116,8 @@
      * Startup processing.
      */
     private void startup() {
+	this.dbHandler = new GraphDBOperation("");
+
 	//
 	// Obtain the initial Topology state
 	//
@@ -240,7 +241,7 @@
 	Collection<FlowEntry> modifiedFlowEntries;
 
 	if (topologyEvents.isEmpty() && flowPathEvents.isEmpty() &&
-	    flowEntryEvents.isEmpty()) {
+	    flowEntryEvents.isEmpty() && flowIdEvents.isEmpty()) {
 	    return;		// Nothing to do
 	}
 
@@ -501,11 +502,10 @@
 	// Process all Topology events and update the appropriate state
 	//
 	boolean isTopologyModified = false;
-	if (accessDBFlag) {
+	if (enableOnrc2014MeasurementsTopology) {
 		log.debug("[BEFORE] {}", topology.toString());
-		if (! topology.readFromDatabase(dbHandler)) {
-			isTopologyModified = true;
-		}
+		topology.readFromDatabase(dbHandler);
+		isTopologyModified = true;
 		log.debug("[AFTER] {}", topology.toString());
 	} else {
 		for (EventEntry<TopologyElement> eventEntry : topologyEvents) {