first commit
diff --git a/src/main/java/net/onrc/onos/ofcontroller/bgproute/BgpRoute.java b/src/main/java/net/onrc/onos/ofcontroller/bgproute/BgpRoute.java
index 826fd93..52281ac 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/bgproute/BgpRoute.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/bgproute/BgpRoute.java
@@ -272,7 +272,7 @@
 		ScheduledExecutorService executor = Executors.newScheduledThreadPool(1);
 		topologyChangeDetectorTask = new SingletonTask(executor, new TopologyChangeDetector());
 
-		topoRouteService = new TopoRouteService("");
+		topoRouteService = new TopoRouteService("", "");
 		
 		pathsWaitingOnArp = new HashMap<InetAddress, Path>();
 		prefixesWaitingOnArp = Multimaps.synchronizedSetMultimap(
diff --git a/src/main/java/net/onrc/onos/ofcontroller/core/ILinkStorage.java b/src/main/java/net/onrc/onos/ofcontroller/core/ILinkStorage.java
index b56cfef..0ea6fd5 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/core/ILinkStorage.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/core/ILinkStorage.java
@@ -48,6 +48,6 @@
 	/*
 	 * Init with Storage conf
 	 */
-	public void init(String conf);
+	public void init(final String dbStore, final String conf);
 
 }
diff --git a/src/main/java/net/onrc/onos/ofcontroller/core/INetMapStorage.java b/src/main/java/net/onrc/onos/ofcontroller/core/INetMapStorage.java
index b052540..2cf0e18 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/core/INetMapStorage.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/core/INetMapStorage.java
@@ -14,6 +14,6 @@
 		DELETE, // Delete the object
 		UPDATE  // Update the object if exists or CREATE/INSERT if does not exist
 	}
-	public void init(String conf);
+	public void init(final String dbStore, final String conf);
 	public void close();
 }
diff --git a/src/main/java/net/onrc/onos/ofcontroller/core/ISwitchStorage.java b/src/main/java/net/onrc/onos/ofcontroller/core/ISwitchStorage.java
index 4fcebb2..4a62251 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/core/ISwitchStorage.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/core/ISwitchStorage.java
@@ -38,7 +38,7 @@
 	/*
 	 * Initialize
 	 */
-	public void init(String conf);
+	public void init(final String dbStore, final String conf);
 	
 
 }
diff --git a/src/main/java/net/onrc/onos/ofcontroller/core/internal/DeviceStorageImpl.java b/src/main/java/net/onrc/onos/ofcontroller/core/internal/DeviceStorageImpl.java
index 386c1bd..938ebeb 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/core/internal/DeviceStorageImpl.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/core/internal/DeviceStorageImpl.java
@@ -11,254 +11,274 @@
 import net.floodlightcontroller.devicemanager.IDevice;
 import net.floodlightcontroller.devicemanager.SwitchPort;
 import net.floodlightcontroller.packet.IPv4;
-import net.onrc.onos.graph.GraphDBOperation;
+import net.onrc.onos.graph.DBOperation;
+import net.onrc.onos.graph.GraphDBManager;
 import net.onrc.onos.ofcontroller.core.IDeviceStorage;
 import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IDeviceObject;
 import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IPortObject;
-import net.onrc.onos.ofcontroller.core.internal.SwitchStorageImpl;
 
 /**
  * This is the class for storing the information of devices into CassandraDB
+ *
  * @author Pankaj
  */
 public class DeviceStorageImpl implements IDeviceStorage {
-	
-	private GraphDBOperation ope;
-	protected static Logger log = LoggerFactory.getLogger(SwitchStorageImpl.class);
 
-	/***
-	 * Initialize function. Before you use this class, please call this method
-	 * @param conf configuration file for Cassandra DB
-	 */
-	@Override
-	public void init(String conf) {
-		try{
-			ope = new GraphDBOperation(conf);
-		} catch(Exception e) {
-			log.error(e.getMessage());
-		}
-	}	
-	
-	/***
-	 * Finalize/close function. After you use this class, please call this method.
-	 * It will close the DB connection.
-	 */
-	@Override
-	public void close() {
-		ope.close();
-	}
-	
-	/***
-	 * Finalize/close function. After you use this class, please call this method.
-	 * It will close the DB connection. This is for Java garbage collection.
-	 */
-	@Override
-	public void finalize() {
-		close();
-	}
+    private DBOperation ope;
+    protected static Logger log = LoggerFactory.getLogger(SwitchStorageImpl.class);
 
-	/***
-	 * This function is for adding the device into the DB.
-	 * @param device The device you want to add into the DB.
-	 * @return IDeviceObject which was added in the DB. 
-	 */
-	@Override
-	public IDeviceObject addDevice(IDevice device) {
-		IDeviceObject obj = null;
- 		try {
- 			if ((obj = ope.searchDevice(device.getMACAddressString())) != null) {
- 				log.debug("Adding device {}: found existing device",device.getMACAddressString());
-            } else {
-            	obj = ope.newDevice();
-                log.debug("Adding device {}: creating new device",device.getMACAddressString());
-            }
-	            changeDeviceAttachments(device, obj);
-	
-				String multiIntString = "";
-				for(Integer intValue : device.getIPv4Addresses()) {
-				   if (multiIntString == null || multiIntString.isEmpty()){
-				     multiIntString = IPv4.fromIPv4Address(intValue);
-				     multiIntString = "[" + IPv4.fromIPv4Address(intValue);
-				   }else{
-				        multiIntString += "," + IPv4.fromIPv4Address(intValue);
-				   }
-				}
-	 	            
-	            if(multiIntString.toString() != null && !multiIntString.toString().isEmpty()){
-	            	obj.setIPAddress(multiIntString + "]");
-	            }
-	            
-	 			obj.setMACAddress(device.getMACAddressString());
-	 			obj.setType("device");
-	 			obj.setState("ACTIVE");
-	 			ope.commit();
- 			
-	 			log.debug("Adding device {}",device.getMACAddressString());
-		} catch (Exception e) {
-			ope.rollback();
-			log.error(":addDevice mac:{} failed", device.getMACAddressString());
-			obj = null;
-		}	
- 			return obj;		
-	}
+    /**
+     * *
+     * Initialize function. Before you use this class, please call this method
+     *
+     * @param conf configuration file for Cassandra DB
+     */
+    @Override
+    public void init(final String dbStore, final String conf) {
+        try {
+            ope = GraphDBManager.getDBOperation(dbStore, conf);
+        } catch (Exception e) {
+            log.error(e.getMessage());
+        }
+    }
 
-	/***
-	 * This function is for updating the Device properties.
-	 * @param device The device you want to add into the DB.
-	 * @return IDeviceObject which was added in the DB. 
-	 */
-	@Override
-	public IDeviceObject updateDevice(IDevice device) {
-		return addDevice(device);
-	}
+    /**
+     * *
+     * Finalize/close function. After you use this class, please call this
+     * method. It will close the DB connection.
+     */
+    @Override
+    public void close() {
+        ope.close();
+    }
 
-	/***
-	 * This function is for removing the Device from the DB.
-	 * @param device The device you want to delete from the DB.
-	 */
-	@Override
-	public void removeDevice(IDevice device) {
-		IDeviceObject dev;
-		try {
-			if ((dev = ope.searchDevice(device.getMACAddressString())) != null) {
-             	ope.removeDevice(dev);
-             	ope.commit();
-            	log.error("DeviceStorage:removeDevice mac:{} done", device.getMACAddressString());
-            }
-		} catch (Exception e) {
-			ope.rollback();
-			log.error("DeviceStorage:removeDevice mac:{} failed", device.getMACAddressString());
-		}
-	}
+    /**
+     * *
+     * Finalize/close function. After you use this class, please call this
+     * method. It will close the DB connection. This is for Java garbage
+     * collection.
+     */
+    @Override
+    public void finalize() {
+        close();
+    }
 
-	/***
-	 * This function is for getting the Device from the DB by Mac address of the device.
-	 * @param mac The device mac address you want to get from the DB.
-	 * @return IDeviceObject you want to get.
-	 */
-	@Override
-	public IDeviceObject getDeviceByMac(String mac) {
-		return ope.searchDevice(mac);
-	}
-
-	/***
-	 * This function is for getting the Device from the DB by IP address of the device.
-	 * @param ip The device ip address you want to get from the DB.
-	 * @return IDeviceObject you want to get.
-	 */
-	@Override
-	public IDeviceObject getDeviceByIP(String ip) {
-		try
-		{
-			for(IDeviceObject dev : ope.getDevices()){
-				String ips;
-				if((ips = dev.getIPAddress()) != null){
-					String nw_addr_wob = ips.replace("[", "").replace("]", "");
-					ArrayList<String> iplists = Lists.newArrayList(nw_addr_wob.split(","));	
-					if(iplists.contains(ip)){
-						return dev;
-					}
-				}
-			}
-			return null;
-		}
-		catch (Exception e)
-		{
-			log.error("DeviceStorage:getDeviceByIP:{} failed");
-			return null;
-		}
-	}
-
-	/***
-	 * This function is for changing the Device attachment point.
-	 * @param device The device you want change the attachment point
-	 */
-	@Override
-	public void changeDeviceAttachments(IDevice device) {
-		IDeviceObject obj = null;
- 		try {
+    /**
+     * *
+     * This function is for adding the device into the DB.
+     *
+     * @param device The device you want to add into the DB.
+     * @return IDeviceObject which was added in the DB.
+     */
+    @Override
+    public IDeviceObject addDevice(IDevice device) {
+        IDeviceObject obj = null;
+        try {
             if ((obj = ope.searchDevice(device.getMACAddressString())) != null) {
-                log.debug("Changing device ports {}: found existing device",device.getMACAddressString());
+                log.debug("Adding device {}: found existing device", device.getMACAddressString());
+            } else {
+                obj = ope.newDevice();
+                log.debug("Adding device {}: creating new device", device.getMACAddressString());
+            }
+            changeDeviceAttachments(device, obj);
+
+            String multiIntString = "";
+            for (Integer intValue : device.getIPv4Addresses()) {
+                if (multiIntString == null || multiIntString.isEmpty()) {
+                    multiIntString = IPv4.fromIPv4Address(intValue);
+                    multiIntString = "[" + IPv4.fromIPv4Address(intValue);
+                } else {
+                    multiIntString += "," + IPv4.fromIPv4Address(intValue);
+                }
+            }
+
+            if (multiIntString.toString() != null && !multiIntString.toString().isEmpty()) {
+                obj.setIPAddress(multiIntString + "]");
+            }
+
+            obj.setMACAddress(device.getMACAddressString());
+            obj.setType("device");
+            obj.setState("ACTIVE");
+            ope.commit();
+
+            log.debug("Adding device {}", device.getMACAddressString());
+        } catch (Exception e) {
+            ope.rollback();
+            log.error(":addDevice mac:{} failed", device.getMACAddressString());
+            obj = null;
+        }
+        return obj;
+    }
+
+    /**
+     * *
+     * This function is for updating the Device properties.
+     *
+     * @param device The device you want to add into the DB.
+     * @return IDeviceObject which was added in the DB.
+     */
+    @Override
+    public IDeviceObject updateDevice(IDevice device) {
+        return addDevice(device);
+    }
+
+    /**
+     * *
+     * This function is for removing the Device from the DB.
+     *
+     * @param device The device you want to delete from the DB.
+     */
+    @Override
+    public void removeDevice(IDevice device) {
+        IDeviceObject dev;
+        try {
+            if ((dev = ope.searchDevice(device.getMACAddressString())) != null) {
+                ope.removeDevice(dev);
+                ope.commit();
+                log.error("DeviceStorage:removeDevice mac:{} done", device.getMACAddressString());
+            }
+        } catch (Exception e) {
+            ope.rollback();
+            log.error("DeviceStorage:removeDevice mac:{} failed", device.getMACAddressString());
+        }
+    }
+
+    /**
+     * *
+     * This function is for getting the Device from the DB by Mac address of the
+     * device.
+     *
+     * @param mac The device mac address you want to get from the DB.
+     * @return IDeviceObject you want to get.
+     */
+    @Override
+    public IDeviceObject getDeviceByMac(String mac) {
+        return ope.searchDevice(mac);
+    }
+
+    /**
+     * *
+     * This function is for getting the Device from the DB by IP address of the
+     * device.
+     *
+     * @param ip The device ip address you want to get from the DB.
+     * @return IDeviceObject you want to get.
+     */
+    @Override
+    public IDeviceObject getDeviceByIP(String ip) {
+        try {
+            for (IDeviceObject dev : ope.getDevices()) {
+                String ips;
+                if ((ips = dev.getIPAddress()) != null) {
+                    String nw_addr_wob = ips.replace("[", "").replace("]", "");
+                    ArrayList<String> iplists = Lists.newArrayList(nw_addr_wob.split(","));
+                    if (iplists.contains(ip)) {
+                        return dev;
+                    }
+                }
+            }
+            return null;
+        } catch (Exception e) {
+            log.error("DeviceStorage:getDeviceByIP:{} failed");
+            return null;
+        }
+    }
+
+    /**
+     * *
+     * This function is for changing the Device attachment point.
+     *
+     * @param device The device you want change the attachment point
+     */
+    @Override
+    public void changeDeviceAttachments(IDevice device) {
+        IDeviceObject obj = null;
+        try {
+            if ((obj = ope.searchDevice(device.getMACAddressString())) != null) {
+                log.debug("Changing device ports {}: found existing device", device.getMACAddressString());
                 changeDeviceAttachments(device, obj);
                 ope.commit();
             } else {
-   				log.debug("failed to search device...now adding {}",device.getMACAddressString());
-   				addDevice(device);
-            }            			
-		} catch (Exception e) {
-			ope.rollback();
-			log.error(":addDevice mac:{} failed", device.getMACAddressString());
-		}	
-	}
-	
-	/***
-	 * This function is for changing the Device attachment point.
-	 * @param device The new device you want change the attachment point
-	 * @param obj The old device IDeviceObject that is going to change the attachment point.
-	 */
-	public void changeDeviceAttachments(IDevice device, IDeviceObject obj) {
-		SwitchPort[] attachmentPoints = device.getAttachmentPoints();
-		List<IPortObject> attachedPorts = Lists.newArrayList(obj.getAttachedPorts());
-		
-        for (SwitchPort ap : attachmentPoints) {
-        	//Check weather there is the port
-          	 IPortObject port = ope.searchPort( HexString.toHexString(ap.getSwitchDPID()),
-												(short) ap.getPort());
-          	 log.debug("New Switch Port is {},{}", HexString.toHexString(ap.getSwitchDPID()),(short) ap.getPort());
-	       	 
-	       	 if(port != null){
-	   			if(attachedPorts.contains(port))
-	       		{
-		       		log.debug("This is the port you already attached {}: do nothing",device.getMACAddressString());
-		       		//This port will be remained, so remove from the removed port lists.
-		       		attachedPorts.remove(port);
-		       	} else {
-	     		   log.debug("Adding device {}: attaching to port",device.getMACAddressString());
-		       		port.setDevice(obj);  
-		        }
-	    	
-		       	log.debug("port number is {}", port.getNumber().toString());
-		        log.debug("port desc is {}", port.getDesc());  
-	       	 }
-        }      		 
-	            
-	    for (IPortObject port: attachedPorts) {
-            log.debug("Detouching the device {}: detouching from port",device.getMACAddressString());
-       		port.removeDevice(obj);
+                log.debug("failed to search device...now adding {}", device.getMACAddressString());
+                addDevice(device);
+            }
+        } catch (Exception e) {
+            ope.rollback();
+            log.error(":addDevice mac:{} failed", device.getMACAddressString());
         }
-	}
+    }
 
-	/***
-	 * This function is for changing the Device IPv4 address.
-	 * @param device The new device you want change the ipaddress
-	 */
-	@Override
-	public void changeDeviceIPv4Address(IDevice device) {
-		IDeviceObject obj;
-  		try {
-  			if ((obj = ope.searchDevice(device.getMACAddressString())) != null) {
+    /**
+     * *
+     * This function is for changing the Device attachment point.
+     *
+     * @param device The new device you want change the attachment point
+     * @param obj The old device IDeviceObject that is going to change the
+     * attachment point.
+     */
+    public void changeDeviceAttachments(IDevice device, IDeviceObject obj) {
+        SwitchPort[] attachmentPoints = device.getAttachmentPoints();
+        List<IPortObject> attachedPorts = Lists.newArrayList(obj.getAttachedPorts());
 
-  				String multiIntString = "";
-  				for(Integer intValue : device.getIPv4Addresses()){
-  				   if (multiIntString == null || multiIntString.isEmpty()){
-  				     multiIntString = "[" + IPv4.fromIPv4Address(intValue);
-  				   } else {
-  				        multiIntString += "," + IPv4.fromIPv4Address(intValue);
-  				   }
-  				}
-  				
-  	            if(multiIntString != null && !multiIntString.isEmpty()){
-  	            	obj.setIPAddress(multiIntString + "]");
-  	            }
-  	            
-              	ope.commit();
-  			} else {
-            	log.error(":changeDeviceIPv4Address mac:{} failed", device.getMACAddressString());
-            }		
-  		} catch (TitanException e) {
-  			ope.rollback();
-			log.error(":changeDeviceIPv4Address mac:{} failed due to exception {}", device.getMACAddressString(),e);
-		}
-	}
+        for (SwitchPort ap : attachmentPoints) {
+            //Check weather there is the port
+            IPortObject port = ope.searchPort(HexString.toHexString(ap.getSwitchDPID()),
+                    (short) ap.getPort());
+            log.debug("New Switch Port is {},{}", HexString.toHexString(ap.getSwitchDPID()), (short) ap.getPort());
 
+            if (port != null) {
+                if (attachedPorts.contains(port)) {
+                    log.debug("This is the port you already attached {}: do nothing", device.getMACAddressString());
+                    //This port will be remained, so remove from the removed port lists.
+                    attachedPorts.remove(port);
+                } else {
+                    log.debug("Adding device {}: attaching to port", device.getMACAddressString());
+                    port.setDevice(obj);
+                }
+
+                log.debug("port number is {}", port.getNumber().toString());
+                log.debug("port desc is {}", port.getDesc());
+            }
+        }
+
+        for (IPortObject port : attachedPorts) {
+            log.debug("Detouching the device {}: detouching from port", device.getMACAddressString());
+            port.removeDevice(obj);
+        }
+    }
+
+    /**
+     * *
+     * This function is for changing the Device IPv4 address.
+     *
+     * @param device The new device you want change the ipaddress
+     */
+    @Override
+    public void changeDeviceIPv4Address(IDevice device) {
+        IDeviceObject obj;
+        try {
+            if ((obj = ope.searchDevice(device.getMACAddressString())) != null) {
+
+                String multiIntString = "";
+                for (Integer intValue : device.getIPv4Addresses()) {
+                    if (multiIntString == null || multiIntString.isEmpty()) {
+                        multiIntString = "[" + IPv4.fromIPv4Address(intValue);
+                    } else {
+                        multiIntString += "," + IPv4.fromIPv4Address(intValue);
+                    }
+                }
+
+                if (multiIntString != null && !multiIntString.isEmpty()) {
+                    obj.setIPAddress(multiIntString + "]");
+                }
+
+                ope.commit();
+            } else {
+                log.error(":changeDeviceIPv4Address mac:{} failed", device.getMACAddressString());
+            }
+        } catch (TitanException e) {
+            ope.rollback();
+            log.error(":changeDeviceIPv4Address mac:{} failed due to exception {}", device.getMACAddressString(), e);
+        }
+    }
 }
diff --git a/src/main/java/net/onrc/onos/ofcontroller/core/internal/LinkStorageImpl.java b/src/main/java/net/onrc/onos/ofcontroller/core/internal/LinkStorageImpl.java
index e5f2f58..6516bf7 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/core/internal/LinkStorageImpl.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/core/internal/LinkStorageImpl.java
@@ -4,7 +4,7 @@
 import java.util.List;
 
 import net.floodlightcontroller.routing.Link;
-import net.onrc.onos.graph.GraphDBOperation;
+import net.onrc.onos.graph.DBOperation;
 import net.onrc.onos.ofcontroller.core.ILinkStorage;
 import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IPortObject;
 import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.ISwitchObject;
@@ -18,330 +18,342 @@
 import com.tinkerpop.blueprints.Vertex;
 import com.tinkerpop.pipes.PipeFunction;
 import com.tinkerpop.pipes.transform.PathPipe;
+import net.onrc.onos.graph.GraphDBManager;
 
 /**
  * This is the class for storing the information of links into CassandraDB
  */
 public class LinkStorageImpl implements ILinkStorage {
-	
-	protected static Logger log = LoggerFactory.getLogger(LinkStorageImpl.class);
-	protected GraphDBOperation dbop;
 
-	/**
-	 * Update a record in the LinkStorage in a way provided by op.
-	 * @param link Record of a link to be updated.
-	 * @param op Operation to be done.
-	 */
-	@Override
-	public void update(Link link, DM_OPERATION op) {
-		update(link, (LinkInfo)null, op);
-	}
+    protected static Logger log = LoggerFactory.getLogger(LinkStorageImpl.class);
+    protected DBOperation dbop;
 
-	/**
-	 * Update multiple records in the LinkStorage in a way provided by op.
-	 * @param links List of records to be updated.
-	 * @param op Operation to be done.
-	 */
-	@Override
-	public void update(List<Link> links, DM_OPERATION op) {
-		for (Link lt: links) {
-			update(lt, (LinkInfo)null, op);
-		}
-	}
+    /**
+     * Update a record in the LinkStorage in a way provided by op.
+     *
+     * @param link Record of a link to be updated.
+     * @param op Operation to be done.
+     */
+    @Override
+    public void update(Link link, DM_OPERATION op) {
+        update(link, (LinkInfo) null, op);
+    }
 
-	/**
-	 * Update a record of link with meta-information in the LinkStorage in a way provided by op.
-	 * @param link Record of a link to update.
-	 * @param linkinfo Meta-information of a link to be updated.
-	 * @param op Operation to be done.
-	 */
-	@Override
-	public void update(Link link, LinkInfo linkinfo, DM_OPERATION op) {
-		switch (op) {
-		case UPDATE:
-		case CREATE:
-		case INSERT:
-			updateLink(link, linkinfo, op);
-			break;
-		case DELETE:
-			deleteLink(link);
-			break;
-		}
-	}
-	
-	/**
-	 * Perform INSERT/CREATE/UPDATE operation to update the LinkStorage.
-	 * @param lt Record of a link to be updated.
-	 * @param linkinfo Meta-information of a link to be updated.
-	 * @param op Operation to be done. (only INSERT/CREATE/UPDATE is acceptable)
-	 */
-	public void updateLink(Link lt, LinkInfo linkinfo, DM_OPERATION op) {
-		IPortObject vportSrc = null, vportDst = null;
-	
-		log.trace("updateLink(): op {} {} {}", new Object[]{op, lt, linkinfo});
-		
+    /**
+     * Update multiple records in the LinkStorage in a way provided by op.
+     *
+     * @param links List of records to be updated.
+     * @param op Operation to be done.
+     */
+    @Override
+    public void update(List<Link> links, DM_OPERATION op) {
+        for (Link lt : links) {
+            update(lt, (LinkInfo) null, op);
+        }
+    }
+
+    /**
+     * Update a record of link with meta-information in the LinkStorage in a way
+     * provided by op.
+     *
+     * @param link Record of a link to update.
+     * @param linkinfo Meta-information of a link to be updated.
+     * @param op Operation to be done.
+     */
+    @Override
+    public void update(Link link, LinkInfo linkinfo, DM_OPERATION op) {
+        switch (op) {
+            case UPDATE:
+            case CREATE:
+            case INSERT:
+                updateLink(link, linkinfo, op);
+                break;
+            case DELETE:
+                deleteLink(link);
+                break;
+        }
+    }
+
+    /**
+     * Perform INSERT/CREATE/UPDATE operation to update the LinkStorage.
+     *
+     * @param lt Record of a link to be updated.
+     * @param linkinfo Meta-information of a link to be updated.
+     * @param op Operation to be done. (only INSERT/CREATE/UPDATE is acceptable)
+     */
+    public void updateLink(Link lt, LinkInfo linkinfo, DM_OPERATION op) {
+        IPortObject vportSrc = null, vportDst = null;
+
+        log.trace("updateLink(): op {} {} {}", new Object[]{op, lt, linkinfo});
+
         try {
             // get source port vertex
-        	String dpid = HexString.toHexString(lt.getSrc());
-        	short port = lt.getSrcPort();
-        	vportSrc = dbop.searchPort(dpid, port);
-            
+            String dpid = HexString.toHexString(lt.getSrc());
+            short port = lt.getSrcPort();
+            vportSrc = dbop.searchPort(dpid, port);
+
             // get dest port vertex
             dpid = HexString.toHexString(lt.getDst());
             port = lt.getDstPort();
             vportDst = dbop.searchPort(dpid, port);
-                        
+
             if (vportSrc != null && vportDst != null) {
-            	// check if the link exists
-            	
-            	Iterable<IPortObject> currPorts = vportSrc.getLinkedPorts();
-            	List<IPortObject> currLinks = new ArrayList<IPortObject>();
-            	for (IPortObject V : currPorts) {
-            		currLinks.add(V);
-            	}
+                // check if the link exists
 
-            	if (currLinks.contains(vportDst)) {
-            		// TODO: update linkinfo
-            		if (op.equals(DM_OPERATION.INSERT) || op.equals(DM_OPERATION.CREATE)) {
-            			log.debug("addOrUpdateLink(): failed link exists {} {} src {} dst {}", 
-            					new Object[]{op, lt, vportSrc, vportDst});
-            		}
-            	} else {
-            		vportSrc.setLinkPort(vportDst);
+                Iterable<IPortObject> currPorts = vportSrc.getLinkedPorts();
+                List<IPortObject> currLinks = new ArrayList<IPortObject>();
+                for (IPortObject V : currPorts) {
+                    currLinks.add(V);
+                }
 
-            		dbop.commit();
-            		log.debug("updateLink(): link added {} {} src {} dst {}", new Object[]{op, lt, vportSrc, vportDst});
-            	}
+                if (currLinks.contains(vportDst)) {
+                    // TODO: update linkinfo
+                    if (op.equals(DM_OPERATION.INSERT) || op.equals(DM_OPERATION.CREATE)) {
+                        log.debug("addOrUpdateLink(): failed link exists {} {} src {} dst {}",
+                                new Object[]{op, lt, vportSrc, vportDst});
+                    }
+                } else {
+                    vportSrc.setLinkPort(vportDst);
+
+                    dbop.commit();
+                    log.debug("updateLink(): link added {} {} src {} dst {}", new Object[]{op, lt, vportSrc, vportDst});
+                }
             } else {
-            	log.error("updateLink(): failed invalid vertices {} {} src {} dst {}", new Object[]{op, lt, vportSrc, vportDst});
-            	dbop.rollback();
+                log.error("updateLink(): failed invalid vertices {} {} src {} dst {}", new Object[]{op, lt, vportSrc, vportDst});
+                dbop.rollback();
             }
         } catch (TitanException e) {
             /*
              * retry till we succeed?
              */
-        	e.printStackTrace();
-        	log.error("updateLink(): titan exception {} {} {}", new Object[]{op, lt, e.toString()});
+            e.printStackTrace();
+            log.error("updateLink(): titan exception {} {} {}", new Object[]{op, lt, e.toString()});
         }
-	}
-	
-	/**
-	 * Delete multiple records in LinkStorage.
-	 * @param links List of records to be deleted.
-	 */
-	@Override
-	public void deleteLinks(List<Link> links) {
+    }
 
-		for (Link lt : links) {
-			deleteLink(lt);
-		}
-	}
-	
-	/**
-	 * Delete a record in the LinkStorage.
-	 * @param lt Record to be deleted.
-	 */
-	@Override
-	public void deleteLink(Link lt) {
-		IPortObject vportSrc = null, vportDst = null;
-		int count = 0;
-		
-		log.debug("deleteLink(): {}", lt);
-		
+    /**
+     * Delete multiple records in LinkStorage.
+     *
+     * @param links List of records to be deleted.
+     */
+    @Override
+    public void deleteLinks(List<Link> links) {
+
+        for (Link lt : links) {
+            deleteLink(lt);
+        }
+    }
+
+    /**
+     * Delete a record in the LinkStorage.
+     *
+     * @param lt Record to be deleted.
+     */
+    @Override
+    public void deleteLink(Link lt) {
+        IPortObject vportSrc = null, vportDst = null;
+        int count = 0;
+
+        log.debug("deleteLink(): {}", lt);
+
         try {
             // get source port vertex
-         	String dpid = HexString.toHexString(lt.getSrc());
-         	short port = lt.getSrcPort();
-         	vportSrc = dbop.searchPort(dpid, port);
-            
-            // get dst port vertex
-         	dpid = HexString.toHexString(lt.getDst());
-         	port = lt.getDstPort();
-         	vportDst = dbop.searchPort(dpid, port);
-     		// FIXME: This needs to remove all edges
-         	
-         	if (vportSrc != null && vportDst != null) {
+            String dpid = HexString.toHexString(lt.getSrc());
+            short port = lt.getSrcPort();
+            vportSrc = dbop.searchPort(dpid, port);
 
-   /*      		for (Edge e : vportSrc.asVertex().getEdges(Direction.OUT)) {
-         			log.debug("deleteLink(): {} in {} out {}", 
-         					new Object[]{e.getLabel(), e.getVertex(Direction.IN), e.getVertex(Direction.OUT)});
-         			if (e.getLabel().equals("link") && e.getVertex(Direction.IN).equals(vportDst)) {
-         				graph.removeEdge(e);
-         				count++;
-         			}
-         		}*/
-         		vportSrc.removeLink(vportDst);
-        		dbop.commit();
-            	log.debug("deleteLink(): deleted edges src {} dst {}", new Object[]{
-            			lt, vportSrc, vportDst});
-            	
+            // get dst port vertex
+            dpid = HexString.toHexString(lt.getDst());
+            port = lt.getDstPort();
+            vportDst = dbop.searchPort(dpid, port);
+            // FIXME: This needs to remove all edges
+
+            if (vportSrc != null && vportDst != null) {
+
+                /*      		for (Edge e : vportSrc.asVertex().getEdges(Direction.OUT)) {
+                 log.debug("deleteLink(): {} in {} out {}", 
+                 new Object[]{e.getLabel(), e.getVertex(Direction.IN), e.getVertex(Direction.OUT)});
+                 if (e.getLabel().equals("link") && e.getVertex(Direction.IN).equals(vportDst)) {
+                 graph.removeEdge(e);
+                 count++;
+                 }
+                 }*/
+                vportSrc.removeLink(vportDst);
+                dbop.commit();
+                log.debug("deleteLink(): deleted edges src {} dst {}", new Object[]{
+                    lt, vportSrc, vportDst});
+
             } else {
-            	log.error("deleteLink(): failed invalid vertices {} src {} dst {}", new Object[]{lt, vportSrc, vportDst});
-            	dbop.rollback();
+                log.error("deleteLink(): failed invalid vertices {} src {} dst {}", new Object[]{lt, vportSrc, vportDst});
+                dbop.rollback();
             }
-         	
+
         } catch (TitanException e) {
             /*
              * retry till we succeed?
              */
-        	log.error("deleteLink(): titan exception {} {}", new Object[]{lt, e.toString()});
-        	dbop.rollback();
-        	e.printStackTrace();
+            log.error("deleteLink(): titan exception {} {}", new Object[]{lt, e.toString()});
+            dbop.rollback();
+            e.printStackTrace();
         }
-	}
+    }
 
-	/**
-	 * Get list of all links connected to the port specified by given DPID and port number.
-	 * @param dpid DPID of desired port.
-	 * @param port Port number of desired port.
-	 * @return List of links. Empty list if no port was found.
-	 */
-	// TODO: Fix me
-	@Override
-	public List<Link> getLinks(Long dpid, short port) {
-    	List<Link> links = new ArrayList<Link>();
-    	
-    	IPortObject srcPort = dbop.searchPort(HexString.toHexString(dpid), port);
-    	ISwitchObject srcSw = srcPort.getSwitch();
-    	
-    	if(srcSw != null && srcPort != null) {
-        	for(IPortObject dstPort : srcPort.getLinkedPorts()) {
-        		ISwitchObject dstSw = dstPort.getSwitch();
-        		Link link = new Link(HexString.toLong(srcSw.getDPID()),
-        				srcPort.getNumber(),
-        				HexString.toLong(dstSw.getDPID()),
-        				dstPort.getNumber());
-    		
-        		links.add(link);
-        	}
-    	}
-    	
-     	return links;
-	}
-	
-	/**
-	 * Initialize the object. Open LinkStorage using given configuration file.
-	 * @param conf Path (absolute path for now) to configuration file.
-	 */
-	@Override
-	public void init(String conf) {
-		//TODO extract the DB location from properties
-		this.dbop = new GraphDBOperation(conf);
-	}
+    /**
+     * Get list of all links connected to the port specified by given DPID and
+     * port number.
+     *
+     * @param dpid DPID of desired port.
+     * @param port Port number of desired port.
+     * @return List of links. Empty list if no port was found.
+     */
+    // TODO: Fix me
+    @Override
+    public List<Link> getLinks(Long dpid, short port) {
+        List<Link> links = new ArrayList<Link>();
 
-	/**
-	 * Delete records of the links connected to the port specified by given DPID and port number.
-	 * @param dpid DPID of desired port.
-	 * @param port Port number of desired port.
-	 */
-	// TODO: Fix me
-	@Override
-	public void deleteLinksOnPort(Long dpid, short port) {
-		List<Link> linksToDelete = getLinks(dpid,port);
-		
-		for(Link l : linksToDelete) {
-			deleteLink(l);
-		}
-	}
+        IPortObject srcPort = dbop.searchPort(HexString.toHexString(dpid), port);
+        ISwitchObject srcSw = srcPort.getSwitch();
 
-	/**
-	 * Get list of all links connected to the switch specified by given DPID.
-	 * @param dpid DPID of desired switch.
-	 * @return List of links. Empty list if no port was found.
-	 */
-	// TODO: Fix me
-	@Override
-	public List<Link> getLinks(String dpid) {
-		List<Link> links = new ArrayList<Link>();
+        if (srcSw != null && srcPort != null) {
+            for (IPortObject dstPort : srcPort.getLinkedPorts()) {
+                ISwitchObject dstSw = dstPort.getSwitch();
+                Link link = new Link(HexString.toLong(srcSw.getDPID()),
+                        srcPort.getNumber(),
+                        HexString.toLong(dstSw.getDPID()),
+                        dstPort.getNumber());
 
-		ISwitchObject srcSw = dbop.searchSwitch(dpid);
-		
-		if(srcSw != null) {
-			for(IPortObject srcPort : srcSw.getPorts()) {
-				for(IPortObject dstPort : srcPort.getLinkedPorts()) {
-					ISwitchObject dstSw = dstPort.getSwitch();
-					if(dstSw != null) {
-		        		Link link = new Link(HexString.toLong(srcSw.getDPID()),
-		        				srcPort.getNumber(),
-		        				HexString.toLong(dstSw.getDPID()),
-		        				dstPort.getNumber());
-		        		links.add(link);
-					}
-				}
-			}
-		}
-		
-		return links;
-	}
+                links.add(link);
+            }
+        }
 
-	/**
-	 * Get list of all links whose state is ACTIVE.
-	 * @return List of active links. Empty list if no port was found.
-	 */
-	public List<Link> getActiveLinks() {
-		Iterable<ISwitchObject> switches = dbop.getActiveSwitches();
+        return links;
+    }
 
-		List<Link> links = new ArrayList<Link>(); 
-		
-		for (ISwitchObject srcSw : switches) {
-			for(IPortObject srcPort : srcSw.getPorts()) {
-				for(IPortObject dstPort : srcPort.getLinkedPorts()) {
-					ISwitchObject dstSw = dstPort.getSwitch();
-					
-					if(dstSw != null && dstSw.getState().equals("ACTIVE")) {
-						links.add(new Link(HexString.toLong(srcSw.getDPID()),
-								srcPort.getNumber(),
-								HexString.toLong(dstSw.getDPID()),
-								dstPort.getNumber()));
-					}
-				}
-			}
-		}
-		
-		return links;
-	}
-	
-	static class ExtractLink implements PipeFunction<PathPipe<Vertex>, Link> {
-	
-		@Override
-		public Link compute(PathPipe<Vertex> pipe ) {
-			// TODO Auto-generated method stub
-			long s_dpid = 0;
-			long d_dpid = 0;
-			short s_port = 0;
-			short d_port = 0;
-			List<Vertex> V = new ArrayList<Vertex>();
-			V = pipe.next();
-			Vertex src_sw = V.get(0);
-			Vertex dest_sw = V.get(3);
-			Vertex src_port = V.get(1);
-			Vertex dest_port = V.get(2);
-			s_dpid = HexString.toLong((String) src_sw.getProperty("dpid"));
-			d_dpid = HexString.toLong((String) dest_sw.getProperty("dpid"));
-			s_port = (Short) src_port.getProperty("number");
-			d_port = (Short) dest_port.getProperty("number");
-			
-			Link l = new Link(s_dpid,s_port,d_dpid,d_port);
-			
-			return l;
-		}
-	}
-	
-	/**
-	 * Finalize the object.
-	 */
-	public void finalize() {
-		close();
-	}
+    /**
+     * Initialize the object. Open LinkStorage using given configuration file.
+     *
+     * @param conf Path (absolute path for now) to configuration file.
+     */
+    @Override
+    public void init(final String dbStore, final String conf) {
+        this.dbop = GraphDBManager.getDBOperation(dbStore, conf);
+    }
 
-	/**
-	 * Close LinkStorage.
-	 */
-	@Override
-	public void close() {
-		// TODO Auto-generated method stub
+    /**
+     * Delete records of the links connected to the port specified by given DPID
+     * and port number.
+     *
+     * @param dpid DPID of desired port.
+     * @param port Port number of desired port.
+     */
+    // TODO: Fix me
+    @Override
+    public void deleteLinksOnPort(Long dpid, short port) {
+        List<Link> linksToDelete = getLinks(dpid, port);
+
+        for (Link l : linksToDelete) {
+            deleteLink(l);
+        }
+    }
+
+    /**
+     * Get list of all links connected to the switch specified by given DPID.
+     *
+     * @param dpid DPID of desired switch.
+     * @return List of links. Empty list if no port was found.
+     */
+    // TODO: Fix me
+    @Override
+    public List<Link> getLinks(String dpid) {
+        List<Link> links = new ArrayList<Link>();
+
+        ISwitchObject srcSw = dbop.searchSwitch(dpid);
+
+        if (srcSw != null) {
+            for (IPortObject srcPort : srcSw.getPorts()) {
+                for (IPortObject dstPort : srcPort.getLinkedPorts()) {
+                    ISwitchObject dstSw = dstPort.getSwitch();
+                    if (dstSw != null) {
+                        Link link = new Link(HexString.toLong(srcSw.getDPID()),
+                                srcPort.getNumber(),
+                                HexString.toLong(dstSw.getDPID()),
+                                dstPort.getNumber());
+                        links.add(link);
+                    }
+                }
+            }
+        }
+
+        return links;
+    }
+
+    /**
+     * Get list of all links whose state is ACTIVE.
+     *
+     * @return List of active links. Empty list if no port was found.
+     */
+    public List<Link> getActiveLinks() {
+        Iterable<ISwitchObject> switches = dbop.getActiveSwitches();
+
+        List<Link> links = new ArrayList<Link>();
+
+        for (ISwitchObject srcSw : switches) {
+            for (IPortObject srcPort : srcSw.getPorts()) {
+                for (IPortObject dstPort : srcPort.getLinkedPorts()) {
+                    ISwitchObject dstSw = dstPort.getSwitch();
+
+                    if (dstSw != null && dstSw.getState().equals("ACTIVE")) {
+                        links.add(new Link(HexString.toLong(srcSw.getDPID()),
+                                srcPort.getNumber(),
+                                HexString.toLong(dstSw.getDPID()),
+                                dstPort.getNumber()));
+                    }
+                }
+            }
+        }
+
+        return links;
+    }
+
+    static class ExtractLink implements PipeFunction<PathPipe<Vertex>, Link> {
+
+        @Override
+        public Link compute(PathPipe<Vertex> pipe) {
+            // TODO Auto-generated method stub
+            long s_dpid = 0;
+            long d_dpid = 0;
+            short s_port = 0;
+            short d_port = 0;
+            List<Vertex> V = new ArrayList<Vertex>();
+            V = pipe.next();
+            Vertex src_sw = V.get(0);
+            Vertex dest_sw = V.get(3);
+            Vertex src_port = V.get(1);
+            Vertex dest_port = V.get(2);
+            s_dpid = HexString.toLong((String) src_sw.getProperty("dpid"));
+            d_dpid = HexString.toLong((String) dest_sw.getProperty("dpid"));
+            s_port = (Short) src_port.getProperty("number");
+            d_port = (Short) dest_port.getProperty("number");
+
+            Link l = new Link(s_dpid, s_port, d_dpid, d_port);
+
+            return l;
+        }
+    }
+
+    /**
+     * Finalize the object.
+     */
+    public void finalize() {
+        close();
+    }
+
+    /**
+     * Close LinkStorage.
+     */
+    @Override
+    public void close() {
+        // TODO Auto-generated method stub
 //		graph.shutdown();		
-	}
-
-
+    }
 }
diff --git a/src/main/java/net/onrc/onos/ofcontroller/core/internal/SwitchStorageImpl.java b/src/main/java/net/onrc/onos/ofcontroller/core/internal/SwitchStorageImpl.java
index b7c97f8..b990157 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/core/internal/SwitchStorageImpl.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/core/internal/SwitchStorageImpl.java
@@ -1,8 +1,8 @@
 package net.onrc.onos.ofcontroller.core.internal;
 
 import net.floodlightcontroller.core.IOFSwitch;
-import net.onrc.onos.graph.GraphDBConnection;
-import net.onrc.onos.graph.GraphDBOperation;
+import net.onrc.onos.graph.DBOperation;
+import net.onrc.onos.graph.GraphDBManager;
 import net.onrc.onos.ofcontroller.core.ISwitchStorage;
 import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IPortObject;
 import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.ISwitchObject;
@@ -17,233 +17,250 @@
  * This is the class for storing the information of switches into CassandraDB
  */
 public class SwitchStorageImpl implements ISwitchStorage {
-	protected GraphDBOperation op;
-	protected static Logger log = LoggerFactory.getLogger(SwitchStorageImpl.class);
-	
-	/***
-	 * Initialize function. Before you use this class, please call this method
-	 * @param conf configuration file for Cassandra DB
-	 */
-	@Override
-	public void init(String conf) {
-		GraphDBConnection conn = GraphDBConnection.getInstance(conf);
-		op = new GraphDBOperation(conn);
-	}
 
-	/***
-	 * Finalize/close function. After you use this class, please call this method.
-	 * It will close the DB connection.
-	 */
-	public void finalize() {
-		close();
-	}
-	
-	/***
-	 * Finalize/close function. After you use this class, please call this method.
-	 * It will close the DB connection. This is for Java garbage collection.
-	 */
-	@Override
-	public void close() {
-		op.close();		
-	}
-	
-	private void setStatus(String dpid, SwitchState state) {
-		ISwitchObject sw = op.searchSwitch(dpid);
-		
-		try {
-			if (sw != null) {
-				sw.setState(state.toString());
-				op.commit();
-				log.info("SwitchStorage:setStatus dpid:{} state: {} done", dpid, state);
-			}
-		} catch(Exception e) {
-			e.printStackTrace();
-			op.rollback();
-			log.info("SwitchStorage:setStatus dpid:{} state: {} failed: switch not found", dpid, state);	
-		}
-	}
+    protected DBOperation op;
+    protected static Logger log = LoggerFactory.getLogger(SwitchStorageImpl.class);
 
-	/***
-	 * This function is for adding the switch into the DB.
-	 * @param dpid The switch dpid you want to add into the DB.
-	 */
-	@Override
-	public void addSwitch(String dpid) {
-		
-		log.info("SwitchStorage:addSwitch(): dpid {} ", dpid);
-		try {
-			ISwitchObject sw = newSwitch(dpid);
-			if ( sw == null ) throw new RuntimeException();
+    /**
+     * *
+     * Initialize function. Before you use this class, please call this method
+     *
+     * @param conf configuration file for Cassandra DB
+     */
+    @Override
+    public void init(final String dbStore, final String conf) {
+        op = GraphDBManager.getDBOperation(dbStore, conf);
+    }
+
+    /**
+     * *
+     * Finalize/close function. After you use this class, please call this
+     * method. It will close the DB connection.
+     */
+    public void finalize() {
+        close();
+    }
+
+    /**
+     * *
+     * Finalize/close function. After you use this class, please call this
+     * method. It will close the DB connection. This is for Java garbage
+     * collection.
+     */
+    @Override
+    public void close() {
+        op.close();
+    }
+
+    private void setStatus(String dpid, SwitchState state) {
+        ISwitchObject sw = op.searchSwitch(dpid);
+
+        try {
+            if (sw != null) {
+                sw.setState(state.toString());
+                op.commit();
+                log.info("SwitchStorage:setStatus dpid:{} state: {} done", dpid, state);
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            op.rollback();
+            log.info("SwitchStorage:setStatus dpid:{} state: {} failed: switch not found", dpid, state);
+        }
+    }
+
+    /**
+     * *
+     * This function is for adding the switch into the DB.
+     *
+     * @param dpid The switch dpid you want to add into the DB.
+     */
+    @Override
+    public void addSwitch(String dpid) {
+
+        log.info("SwitchStorage:addSwitch(): dpid {} ", dpid);
+        try {
+            ISwitchObject sw = newSwitch(dpid);
+            if (sw == null) {
+                throw new RuntimeException();
+            }
             op.commit();
-		} catch (Exception e) {
-			e.printStackTrace();
-			op.rollback();
-			log.info("SwitchStorage:addSwitch dpid:{} failed", dpid);
-		}
-	}
-	
-	private ISwitchObject newSwitch(String dpid) {
-		ISwitchObject sw = op.searchSwitch(dpid);
-		if (sw != null) {
-			//If existing the switch. set The SW state ACTIVE. 
-			log.info("SwitchStorage:newSwitch dpid:{} already exists", dpid);
-			sw.setState(SwitchState.ACTIVE.toString());
-		} else {
-			sw = op.newSwitch(dpid);
-			if (sw != null) {
-				sw.setState(SwitchState.ACTIVE.toString());
-				log.info("SwitchStorage:newSwitch dpid:{} added", dpid);
-			} else {
-				log.error("switchStorage:newSwitch dpid:{} failed -> newSwitch failed", dpid);
-			}
-		}
-		return sw;
-	}
-	
-	/***
-	 * This function is for updating the switch into the DB.
-	 * @param dpid The switch dpid you want to update from the DB
-	 * @param state The state of the switch like ACTIVE, INACTIVE
-	 * @param dmope	The DM_OPERATION of the switch
-	 */
-	@Override
-	public void update(String dpid, SwitchState state, DM_OPERATION dmope) {
-		log.info("SwitchStorage:update dpid:{} state: {} ", dpid, state);
-        switch(dmope) {
-        	case UPDATE:
-        	case INSERT:
-        	case CREATE:
+        } catch (Exception e) {
+            e.printStackTrace();
+            op.rollback();
+            log.info("SwitchStorage:addSwitch dpid:{} failed", dpid);
+        }
+    }
+
+    private ISwitchObject newSwitch(String dpid) {
+        ISwitchObject sw = op.searchSwitch(dpid);
+        if (sw != null) {
+            //If existing the switch. set The SW state ACTIVE. 
+            log.info("SwitchStorage:newSwitch dpid:{} already exists", dpid);
+            sw.setState(SwitchState.ACTIVE.toString());
+        } else {
+            sw = op.newSwitch(dpid);
+            if (sw != null) {
+                sw.setState(SwitchState.ACTIVE.toString());
+                log.info("SwitchStorage:newSwitch dpid:{} added", dpid);
+            } else {
+                log.error("switchStorage:newSwitch dpid:{} failed -> newSwitch failed", dpid);
+            }
+        }
+        return sw;
+    }
+
+    /**
+     * *
+     * This function is for updating the switch into the DB.
+     *
+     * @param dpid The switch dpid you want to update from the DB
+     * @param state The state of the switch like ACTIVE, INACTIVE
+     * @param dmope	The DM_OPERATION of the switch
+     */
+    @Override
+    public void update(String dpid, SwitchState state, DM_OPERATION dmope) {
+        log.info("SwitchStorage:update dpid:{} state: {} ", dpid, state);
+        switch (dmope) {
+            case UPDATE:
+            case INSERT:
+            case CREATE:
                 addSwitch(dpid);
                 if (state != SwitchState.ACTIVE) {
-                	setStatus(dpid, state);
+                    setStatus(dpid, state);
                 }
                 break;
-        	case DELETE:
+            case DELETE:
                 deleteSwitch(dpid);
                 break;
-        	default:
+            default:
         }
-	}
+    }
 
-	/***
-	 * This function is for deleting the switch into the DB.
-	 * @param dpid The switch dpid you want to delete from the DB.
-	 */
-	@Override
-	public void deleteSwitch(String dpid) {
-		try {
-			ISwitchObject sw = op.searchSwitch(dpid);
-            if (sw  != null) {
-            	op.removeSwitch(sw);
-            	op.commit();
-            	log.info("SwitchStorage:DeleteSwitch dpid:{} done", dpid);
+    /**
+     * *
+     * This function is for deleting the switch into the DB.
+     *
+     * @param dpid The switch dpid you want to delete from the DB.
+     */
+    @Override
+    public void deleteSwitch(String dpid) {
+        try {
+            ISwitchObject sw = op.searchSwitch(dpid);
+            if (sw != null) {
+                op.removeSwitch(sw);
+                op.commit();
+                log.info("SwitchStorage:DeleteSwitch dpid:{} done", dpid);
             }
-		} catch (Exception e) {
-			e.printStackTrace();
-			op.rollback();			
-			log.error("SwitchStorage:deleteSwitch {} failed", dpid);
-		}
+        } catch (Exception e) {
+            e.printStackTrace();
+            op.rollback();
+            log.error("SwitchStorage:deleteSwitch {} failed", dpid);
+        }
 
-	}
+    }
 
-	/***
-	 * This function is for adding the switch port into the DB.
-	 * @param dpid The switch dpid that has the port.
-	 * @param port The port you want to add the switch.
-	 */
-	@Override
-	public void addPort(String dpid, OFPhysicalPort port) {
-		
-       if(((OFPortConfig.OFPPC_PORT_DOWN.getValue() & port.getConfig()) > 0) ||
-        					((OFPortState.OFPPS_LINK_DOWN.getValue() & port.getState()) > 0)) {
-    	     deletePort(dpid, port.getPortNumber());
-             return;  
-       }
+    /**
+     * *
+     * This function is for adding the switch port into the DB.
+     *
+     * @param dpid The switch dpid that has the port.
+     * @param port The port you want to add the switch.
+     */
+    @Override
+    public void addPort(String dpid, OFPhysicalPort port) {
 
-		try {
-			ISwitchObject sw = op.searchSwitch(dpid);
+        if (((OFPortConfig.OFPPC_PORT_DOWN.getValue() & port.getConfig()) > 0)
+                || ((OFPortState.OFPPS_LINK_DOWN.getValue() & port.getState()) > 0)) {
+            deletePort(dpid, port.getPortNumber());
+            return;
+        }
+
+        try {
+            ISwitchObject sw = op.searchSwitch(dpid);
 
             if (sw != null) {
-            	IPortObject p = op.searchPort(dpid, port.getPortNumber());
-            	log.info("SwitchStorage:addPort dpid:{} port:{}", dpid, port.getPortNumber());
-            	if (p != null) {
-            		log.error("SwitchStorage:addPort dpid:{} port:{} exists setting as ACTIVE", dpid, port.getPortNumber());
-            		p.setState("ACTIVE");
-            		p.setPortState(port.getState());
-            		p.setDesc(port.getName());
-            		op.commit();
-            	} else {
-            		p = op.newPort(dpid, port.getPortNumber());
-            		p.setState("ACTIVE");
-            		p.setPortState(port.getState());
-            		p.setDesc(port.getName());
-            		sw.addPort(p);
-            		op.commit();
-            	}
-            } else {
-        		log.error("SwitchStorage:addPort dpid:{} port:{} : failed switch does not exist", dpid, port.getPortNumber());
-            }
-		} catch (Exception e) {
-			e.printStackTrace();
-			op.rollback();
-			log.error("SwitchStorage:addPort dpid:{} port:{} failed", dpid, port.getPortNumber());
-		}	
-
-	}
-	
-	/***
-	 * This function is for deleting the switch port from the DB.
-	 * @param dpid The switch dpid that has the port.
-	 * @param port The port you want to delete the switch.
-	 */
-	@Override
-	public void deletePort(String dpid, short port) {
-		try {
-			ISwitchObject sw = op.searchSwitch(dpid);
-
-            if (sw != null) {
-            	IPortObject p = op.searchPort(dpid, port);
+                IPortObject p = op.searchPort(dpid, port.getPortNumber());
+                log.info("SwitchStorage:addPort dpid:{} port:{}", dpid, port.getPortNumber());
                 if (p != null) {
-            		log.info("SwitchStorage:deletePort dpid:{} port:{} found and set INACTIVE", dpid, port);
-            		p.setState("INACTIVE");
-            		op.commit();
-            	}
+                    log.error("SwitchStorage:addPort dpid:{} port:{} exists setting as ACTIVE", dpid, port.getPortNumber());
+                    p.setState("ACTIVE");
+                    p.setPortState(port.getState());
+                    p.setDesc(port.getName());
+                    op.commit();
+                } else {
+                    p = op.newPort(dpid, port.getPortNumber());
+                    p.setState("ACTIVE");
+                    p.setPortState(port.getState());
+                    p.setDesc(port.getName());
+                    sw.addPort(p);
+                    op.commit();
+                }
+            } else {
+                log.error("SwitchStorage:addPort dpid:{} port:{} : failed switch does not exist", dpid, port.getPortNumber());
             }
-		} catch (Exception e) {
-			e.printStackTrace();
-			op.rollback();
-			log.info("SwitchStorage:deletePort dpid:{} port:{} failed", dpid, port);
-		}	
-	}
+        } catch (Exception e) {
+            e.printStackTrace();
+            op.rollback();
+            log.error("SwitchStorage:addPort dpid:{} port:{} failed", dpid, port.getPortNumber());
+        }
 
-	@Override
-	public void addSwitch(IOFSwitch sw) {
-		// TODO Auto-generated method stub
-		String dpid = sw.getStringId();
-		log.info("SwitchStorage:addSwitch(): dpid {} ", dpid);
-		try {
-			ISwitchObject switchObject = newSwitch(dpid);
-        	for (OFPhysicalPort port: sw.getPorts()) {
-        		IPortObject p = op.searchPort(dpid, port.getPortNumber());
-        		if (p != null) {
-            		log.error("SwitchStorage:addPort dpid:{} port:{} exists", dpid, port.getPortNumber());
-            		p.setState("ACTIVE");
-            		p.setPortState(port.getState());
-            		p.setDesc(port.getName());
-            	} else {
-            		p = op.newPort(dpid, port.getPortNumber());
-            		p.setState("ACTIVE");
-            		p.setPortState(port.getState());
-            		p.setDesc(port.getName());           		
-            		switchObject.addPort(p);
-            	}         		
-        	}
+    }
+
+    /**
+     * *
+     * This function is for deleting the switch port from the DB.
+     *
+     * @param dpid The switch dpid that has the port.
+     * @param port The port you want to delete the switch.
+     */
+    @Override
+    public void deletePort(String dpid, short port) {
+        try {
+            ISwitchObject sw = op.searchSwitch(dpid);
+
+            if (sw != null) {
+                IPortObject p = op.searchPort(dpid, port);
+                if (p != null) {
+                    log.info("SwitchStorage:deletePort dpid:{} port:{} found and set INACTIVE", dpid, port);
+                    p.setState("INACTIVE");
+                    op.commit();
+                }
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            op.rollback();
+            log.info("SwitchStorage:deletePort dpid:{} port:{} failed", dpid, port);
+        }
+    }
+
+    @Override
+    public void addSwitch(IOFSwitch sw) {
+        // TODO Auto-generated method stub
+        String dpid = sw.getStringId();
+        log.info("SwitchStorage:addSwitch(): dpid {} ", dpid);
+        try {
+            ISwitchObject switchObject = newSwitch(dpid);
+            for (OFPhysicalPort port : sw.getPorts()) {
+                IPortObject p = op.searchPort(dpid, port.getPortNumber());
+                if (p != null) {
+                    log.error("SwitchStorage:addPort dpid:{} port:{} exists", dpid, port.getPortNumber());
+                    p.setState("ACTIVE");
+                    p.setPortState(port.getState());
+                    p.setDesc(port.getName());
+                } else {
+                    p = op.newPort(dpid, port.getPortNumber());
+                    p.setState("ACTIVE");
+                    p.setPortState(port.getState());
+                    p.setDesc(port.getName());
+                    switchObject.addPort(p);
+                }
+            }
             op.commit();
-		} catch (Exception e) {
-			e.printStackTrace();
-			op.rollback();
-			log.info("SwitchStorage:addSwitch dpid:{} failed", dpid);
-		}		
-		
-	}
+        } catch (Exception e) {
+            e.printStackTrace();
+            op.rollback();
+            log.info("SwitchStorage:addSwitch dpid:{} failed", dpid);
+        }
+
+    }
 }
\ No newline at end of file
diff --git a/src/main/java/net/onrc/onos/ofcontroller/floodlightlistener/NetworkGraphPublisher.java b/src/main/java/net/onrc/onos/ofcontroller/floodlightlistener/NetworkGraphPublisher.java
index e0ac4e1..5c372fb 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/floodlightlistener/NetworkGraphPublisher.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/floodlightlistener/NetworkGraphPublisher.java
@@ -24,8 +24,9 @@
 import net.floodlightcontroller.devicemanager.IDeviceService;
 import net.floodlightcontroller.routing.Link;
 import net.floodlightcontroller.threadpool.IThreadPoolService;
-import net.onrc.onos.graph.GraphDBConnection;
-import net.onrc.onos.graph.GraphDBOperation;
+import net.onrc.onos.graph.DBOperation;
+import net.onrc.onos.graph.DBConnection;
+import net.onrc.onos.graph.GraphDBManager;
 import net.onrc.onos.graph.IDBConnection;
 import net.onrc.onos.graph.LocalTopologyEventListener;
 import net.onrc.onos.ofcontroller.core.IDeviceStorage;
@@ -53,9 +54,10 @@
 	protected static Logger log;
 	protected IDeviceService deviceService;
 	protected IControllerRegistryService registryService;
-	protected GraphDBOperation op;
+	protected DBOperation op;
 	
 	protected static final String DBConfigFile = "dbconf";
+        protected static final String GraphDBStore = "graph_db_store";
 	protected static final String CleanupEnabled = "EnableCleanup";
 	protected IThreadPoolService threadPool;
 	protected IFloodlightProviderService floodlightProvider;
@@ -252,7 +254,8 @@
 		// TODO Auto-generated method stub
 		Map<String, String> configMap = context.getConfigParams(this);
 		String conf = configMap.get(DBConfigFile);
-		op = new GraphDBOperation(conf);
+                String dbStore = configMap.get(GraphDBStore);
+		op = GraphDBManager.getDBOperation(dbStore, conf);
 		
 		log = LoggerFactory.getLogger(NetworkGraphPublisher.class);
 		floodlightProvider =
@@ -263,13 +266,13 @@
 		registryService = context.getServiceImpl(IControllerRegistryService.class);
 		
 		devStore = new DeviceStorageImpl();
-		devStore.init(conf);
+		devStore.init(dbStore, conf);
 		
 		swStore = new SwitchStorageImpl();
-		swStore.init(conf);
+		swStore.init(dbStore, conf);
 		
 		linkStore = new LinkStorageImpl();
-		linkStore.init(conf);
+		linkStore.init(dbStore, conf);
 				
 		log.debug("Initializing NetworkGraphPublisher module with {}", conf);
 		
@@ -287,7 +290,7 @@
 		
 		log.debug("Adding EventListener");
 		IDBConnection conn = op.getDBConnection();
-		conn.addEventListener(new LocalTopologyEventListener((GraphDBConnection) conn));
+		conn.addEventListener(new LocalTopologyEventListener((DBConnection) conn));
 	       // Setup the Cleanup task. 
 		if (cleanupNeeded == null || !cleanupNeeded.equals("False")) {
 				ScheduledExecutorService ses = threadPool.getScheduledExecutor();
diff --git a/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowManager.java b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowManager.java
index ce9941e..cd6f5eb 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowManager.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowManager.java
@@ -27,7 +27,8 @@
 import net.floodlightcontroller.restserver.IRestApiService;
 import net.floodlightcontroller.util.MACAddress;
 import net.floodlightcontroller.util.OFMessageDamper;
-import net.onrc.onos.graph.GraphDBOperation;
+import net.onrc.onos.graph.DBOperation;
+import net.onrc.onos.graph.GraphDBManager;
 import net.onrc.onos.ofcontroller.core.INetMapStorage;
 import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IFlowEntry;
 import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IFlowPath;
@@ -69,7 +70,7 @@
  */
 public class FlowManager implements IFloodlightModule, IFlowService, INetMapStorage {
 
-    protected GraphDBOperation op;
+    protected DBOperation op;
 
     protected IRestApiService restApi;
     protected volatile IFloodlightProviderService floodlightProvider;
@@ -431,9 +432,9 @@
      * @param conf the Graph Database configuration string.
      */
     @Override
-    public void init(String conf) {
-    	op = new GraphDBOperation(conf);
-	topoRouteService = new TopoRouteService(conf);
+    public void init(final String dbStore, final String conf) {
+    	op = GraphDBManager.getDBOperation(dbStore, conf);
+	topoRouteService = new TopoRouteService(dbStore, conf);
     }
 
     /**
@@ -512,7 +513,7 @@
 
 	// TODO: An ugly hack!
 	String conf = "/tmp/cassandra.titan";
-	this.init(conf);
+	this.init("titan", conf);
 	
 	mapReaderScheduler = Executors.newScheduledThreadPool(1);
 	shortestPathReconcileScheduler = Executors.newScheduledThreadPool(1);
diff --git a/src/main/java/net/onrc/onos/ofcontroller/routing/TopoRouteService.java b/src/main/java/net/onrc/onos/ofcontroller/routing/TopoRouteService.java
index 21381d9..0aa5f2e 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/routing/TopoRouteService.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/routing/TopoRouteService.java
@@ -9,7 +9,7 @@
 import java.util.Queue;
 import java.util.Set;
 
-import net.onrc.onos.graph.GraphDBOperation;
+import net.onrc.onos.graph.DBOperation;
 import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.ISwitchObject;
 import net.onrc.onos.ofcontroller.core.INetMapTopologyService.ITopoRouteService;
 import net.onrc.onos.ofcontroller.core.ISwitchStorage.SwitchState;
@@ -25,6 +25,7 @@
 
 import com.tinkerpop.blueprints.Direction;
 import com.tinkerpop.blueprints.Vertex;
+import net.onrc.onos.graph.GraphDBManager;
 
 
 /**
@@ -48,7 +49,7 @@
 	 * @param me the node this link originates from.
 	 * @param the neighbor node on the other side of the link.
 	 * @param myPort local port number for the link.
-	 * @param neighborPort neighrobr port number for the link.
+	 * @param neighborPort neighbor port number for the link.
 	 */
 	public Link(Node me, Node neighbor, short myPort, short neighborPort) {
 	    this.me = me;
@@ -95,7 +96,7 @@
     private static Logger log =
 	LoggerFactory.getLogger(TopoRouteService.class);
     
-    protected GraphDBOperation op;
+    protected DBOperation op;
 
 
     /**
@@ -110,8 +111,8 @@
      * @param config the database configuration file to use for
      * the initialization.
      */
-    public TopoRouteService(String config) {
-	this.init(config);
+    public TopoRouteService(final String dbStore, final String config) {
+	this.init(dbStore, config);
     }
 
     /**
@@ -120,9 +121,9 @@
      * @param config the database configuration file to use for
      * the initialization.
      */
-    public void init(String config) {
+    public void init(final String dbStore, final String config) {
 	try {
-	    op = new GraphDBOperation(config);
+	    op = GraphDBManager.getDBOperation(dbStore, config);
 	} catch (Exception e) {
 	    log.error(e.getMessage());
 	}
@@ -141,7 +142,7 @@
      * @param init_op the database operation handler to use for the
      * initialization.
      */
-    public void setDbOperationHandler(GraphDBOperation init_op) {
+    public void setDbOperationHandler(DBOperation init_op) {
     	op = init_op;
     }
 
diff --git a/src/main/java/net/onrc/onos/ofcontroller/topology/web/RouteResource.java b/src/main/java/net/onrc/onos/ofcontroller/topology/web/RouteResource.java
index 659609d..ee7ffce 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/topology/web/RouteResource.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/topology/web/RouteResource.java
@@ -18,7 +18,7 @@
 
     @Get("json")
     public DataPath retrieve() {
-        ITopoRouteService topoRouteService = new TopoRouteService("");
+        ITopoRouteService topoRouteService = new TopoRouteService("titan", "");
 	if (topoRouteService == null) {
 	    log.debug("Topology Route Service not found");
 	    return null;