blob: 26e6181b675a801aa611c5e0314094ab2636eb88 [file] [log] [blame]
Pankaj Berde85016ab2013-06-21 11:34:53 -07001package net.onrc.onos.graph;
2
3import java.util.ArrayList;
Jonathan Hartd6ed62b2013-11-01 13:18:25 -07004import java.util.Iterator;
Pankaj Berde85016ab2013-06-21 11:34:53 -07005import java.util.List;
6
Jonathan Hartd6ed62b2013-11-01 13:18:25 -07007import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IBaseObject;
Pankaj Berde85016ab2013-06-21 11:34:53 -07008import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IDeviceObject;
9import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IFlowEntry;
10import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IFlowPath;
Jonathan Hartd6ed62b2013-11-01 13:18:25 -070011import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IIpv4Address;
Pankaj Berde85016ab2013-06-21 11:34:53 -070012import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IPortObject;
13import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.ISwitchObject;
14import net.onrc.onos.ofcontroller.core.ISwitchStorage.SwitchState;
15import net.onrc.onos.ofcontroller.util.FlowEntryId;
16import net.onrc.onos.ofcontroller.util.FlowId;
17
18import com.thinkaurelius.titan.core.TitanGraph;
19import com.tinkerpop.blueprints.Vertex;
20import com.tinkerpop.frames.FramedGraph;
21import com.tinkerpop.frames.structures.FramedVertexIterable;
22import com.tinkerpop.gremlin.java.GremlinPipeline;
23
24public class GraphDBOperation implements IDBOperation {
25 private GraphDBConnection conn;
26
27 /**
28 * Create a GraphDBOperation instance from specified GraphDBConnection's instance.
29 * @param dbConnection an instance of GraphDBConnection
30 */
31 public GraphDBOperation(GraphDBConnection dbConnection) {
32 this.conn = dbConnection;
33 }
34
35 /**
36 * Create a GraphDBOperation instance from database configuration path.
37 * @param dbConfPath a path for database configuration file.
38 */
39 public GraphDBOperation(final String dbConfPath) {
40 this.conn = GraphDBConnection.getInstance(dbConfPath);
41 }
42
43 /**
44 * Create a new switch and return the created switch object.
45 * @param dpid DPID of the switch
46 */
Yuta HIGUCHIba98be32013-12-11 17:01:08 -080047 @Override
Pankaj Berde85016ab2013-06-21 11:34:53 -070048 public ISwitchObject newSwitch(String dpid) {
Yuta HIGUCHIba98be32013-12-11 17:01:08 -080049 FramedGraph<TitanGraph> fg = conn.getFramedGraph();
Pankaj Berde85016ab2013-06-21 11:34:53 -070050 ISwitchObject obj = fg.addVertex(null,ISwitchObject.class);
51 if (obj != null) {
52 obj.setType("switch");
53 obj.setDPID(dpid);
54 }
55 return obj;
56 }
57
58 /**
59 * Search and get a switch object with DPID.
Yuta HIGUCHIba98be32013-12-11 17:01:08 -080060 * @param dpid DPID of the switch
Pankaj Berde85016ab2013-06-21 11:34:53 -070061 */
Yuta HIGUCHIba98be32013-12-11 17:01:08 -080062 @Override
Pankaj Berde85016ab2013-06-21 11:34:53 -070063 public ISwitchObject searchSwitch(String dpid) {
Pankaj Berdebbd38612013-06-22 05:59:12 -070064
Pankaj Berde85016ab2013-06-21 11:34:53 -070065 FramedGraph<TitanGraph> fg = conn.getFramedGraph();
Yuta HIGUCHI701a5eb2013-12-14 09:02:43 -080066 if ( fg == null ) return null;
67 Iterator<ISwitchObject> it = fg.getVertices("dpid",dpid,ISwitchObject.class).iterator();
68 return (it.hasNext()) ? it.next() : null;
69
Pankaj Berde85016ab2013-06-21 11:34:53 -070070 }
71
72 /**
73 * Search and get an active switch object with DPID.
Yuta HIGUCHIba98be32013-12-11 17:01:08 -080074 * @param dpid DPID of the switch
Pankaj Berde85016ab2013-06-21 11:34:53 -070075 */
Yuta HIGUCHIba98be32013-12-11 17:01:08 -080076 @Override
Pankaj Berde85016ab2013-06-21 11:34:53 -070077 public ISwitchObject searchActiveSwitch(String dpid) {
Yuta HIGUCHIba98be32013-12-11 17:01:08 -080078
Pankaj Berde85016ab2013-06-21 11:34:53 -070079 ISwitchObject sw = searchSwitch(dpid);
80 if ((sw != null) &&
81 sw.getState().equals(SwitchState.ACTIVE.toString())) {
82 return sw;
83 }
84 return null;
85 }
Naoki Shiotaf74d5f32014-01-09 21:29:38 -080086
87 /**
88 * Get all switch objects.
89 */
90 @Override
91 public Iterable<IPortObject> getAllPorts() {
92 FramedGraph<TitanGraph> fg = conn.getFramedGraph();
93 Iterable<IPortObject> ports = fg.getVertices("type","port",IPortObject.class);
94 return ports;
95 }
96
Pankaj Berde85016ab2013-06-21 11:34:53 -070097 /**
98 * Get all switch objects.
99 */
Yuta HIGUCHIba98be32013-12-11 17:01:08 -0800100 @Override
Pankaj Berde85016ab2013-06-21 11:34:53 -0700101 public Iterable<ISwitchObject> getAllSwitches() {
102 FramedGraph<TitanGraph> fg = conn.getFramedGraph();
103 Iterable<ISwitchObject> switches = fg.getVertices("type","switch",ISwitchObject.class);
104 return switches;
105 }
106
107 /**
108 * Get all active switch objects.
109 */
Yuta HIGUCHIba98be32013-12-11 17:01:08 -0800110 @Override
Pankaj Berde85016ab2013-06-21 11:34:53 -0700111 public Iterable<ISwitchObject> getActiveSwitches() {
112 FramedGraph<TitanGraph> fg = conn.getFramedGraph();
113 Iterable<ISwitchObject> switches = fg.getVertices("type","switch",ISwitchObject.class);
114 List<ISwitchObject> activeSwitches = new ArrayList<ISwitchObject>();
Yuta HIGUCHIba98be32013-12-11 17:01:08 -0800115
Pankaj Berde85016ab2013-06-21 11:34:53 -0700116 for (ISwitchObject sw: switches) {
117 if(sw.getState().equals(SwitchState.ACTIVE.toString())) {
118 activeSwitches.add(sw);
119 }
120 }
121 return activeSwitches;
122 }
123
124 /**
125 * Get all inactive switch objects.
126 */
Yuta HIGUCHIba98be32013-12-11 17:01:08 -0800127 @Override
Pankaj Berde85016ab2013-06-21 11:34:53 -0700128 public Iterable<ISwitchObject> getInactiveSwitches() {
129 FramedGraph<TitanGraph> fg = conn.getFramedGraph();
130 Iterable<ISwitchObject> switches = fg.getVertices("type","switch",ISwitchObject.class);
131 List<ISwitchObject> inactiveSwitches = new ArrayList<ISwitchObject>();
Yuta HIGUCHIba98be32013-12-11 17:01:08 -0800132
Pankaj Berde85016ab2013-06-21 11:34:53 -0700133 for (ISwitchObject sw: switches) {
134 if(sw.getState().equals(SwitchState.INACTIVE.toString())) {
135 inactiveSwitches.add(sw);
136 }
137 }
138 return inactiveSwitches;
139 }
140
141 /**
142 * Get all flow entries' objects where their switches are not updated.
143 */
Yuta HIGUCHIba98be32013-12-11 17:01:08 -0800144 @Override
Pankaj Berde85016ab2013-06-21 11:34:53 -0700145 public Iterable<IFlowEntry> getAllSwitchNotUpdatedFlowEntries() {
146 FramedGraph<TitanGraph> fg = conn.getFramedGraph();
147 //TODO: Should use an enum for flow_switch_state
148 return fg.getVertices("switch_state", "FE_SWITCH_NOT_UPDATED", IFlowEntry.class);
149 }
150
151 /**
152 * Remove specified switch.
153 * @param sw switch object to remove
154 */
Yuta HIGUCHIba98be32013-12-11 17:01:08 -0800155 @Override
Pankaj Berde85016ab2013-06-21 11:34:53 -0700156 public void removeSwitch(ISwitchObject sw) {
Yuta HIGUCHIba98be32013-12-11 17:01:08 -0800157 FramedGraph<TitanGraph> fg = conn.getFramedGraph();
158 fg.removeVertex(sw.asVertex());
Pankaj Berde85016ab2013-06-21 11:34:53 -0700159 }
Yuta HIGUCHIba98be32013-12-11 17:01:08 -0800160
Pankaj Berdebbd38612013-06-22 05:59:12 -0700161 @Override
162 public IPortObject newPort(String dpid, Short portNumber) {
Yuta HIGUCHIba98be32013-12-11 17:01:08 -0800163 FramedGraph<TitanGraph> fg = conn.getFramedGraph();
Pankaj Berdebbd38612013-06-22 05:59:12 -0700164 IPortObject obj = fg.addVertex(null,IPortObject.class);
165 if (obj != null) {
166 obj.setType("port");
Naoki Shiotaf74d5f32014-01-09 21:29:38 -0800167 String id = dpid + PORT_ID_DELIM + portNumber.toString();
Pankaj Berdebbd38612013-06-22 05:59:12 -0700168 obj.setPortId(id);
169 obj.setNumber(portNumber);
170 }
Yuta HIGUCHIba98be32013-12-11 17:01:08 -0800171 return obj;
172
Pankaj Berdebbd38612013-06-22 05:59:12 -0700173 }
Pankaj Berde85016ab2013-06-21 11:34:53 -0700174
175 /**
176 * Create a port having specified port number.
177 * @param portNumber port number
178 */
Yuta HIGUCHIba98be32013-12-11 17:01:08 -0800179 @Override
Pankaj Berdebbd38612013-06-22 05:59:12 -0700180 @Deprecated
Pankaj Berde85016ab2013-06-21 11:34:53 -0700181 public IPortObject newPort(Short portNumber) {
Yuta HIGUCHIba98be32013-12-11 17:01:08 -0800182 FramedGraph<TitanGraph> fg = conn.getFramedGraph();
Pankaj Berde85016ab2013-06-21 11:34:53 -0700183 IPortObject obj = fg.addVertex(null,IPortObject.class);
184 if (obj != null) {
185 obj.setType("port");
186 obj.setNumber(portNumber);
187 }
188 return obj;
189 }
190
191 /**
192 * Search and get a port object of specified switch and port number.
193 * @param dpid DPID of a switch
194 * @param number port number of the switch's port
195 */
Yuta HIGUCHIba98be32013-12-11 17:01:08 -0800196 @Override
Pankaj Berdebbd38612013-06-22 05:59:12 -0700197 public IPortObject searchPort(String dpid, Short number) {
198 FramedGraph<TitanGraph> fg = conn.getFramedGraph();
Yuta HIGUCHI6039faf2013-12-11 16:28:11 -0800199 if ( fg == null ) return null;
Naoki Shiotaf74d5f32014-01-09 21:29:38 -0800200 String id = dpid + IDBOperation.PORT_ID_DELIM + number.toString();
Yuta HIGUCHI6039faf2013-12-11 16:28:11 -0800201 Iterator<IPortObject> ports = fg.getVertices("port_id",id,IPortObject.class).iterator();
202 if ( ports.hasNext() ) {
203 return ports.next();
204 } else {
205 return null;
206 }
Pankaj Berde85016ab2013-06-21 11:34:53 -0700207 }
208
209 /**
210 * Remove the specified switch port.
211 * @param port switch port object to remove
212 */
Yuta HIGUCHIba98be32013-12-11 17:01:08 -0800213 @Override
Pankaj Berde85016ab2013-06-21 11:34:53 -0700214 public void removePort(IPortObject port) {
Yuta HIGUCHIba98be32013-12-11 17:01:08 -0800215 FramedGraph<TitanGraph> fg = conn.getFramedGraph();
Pankaj Berde85016ab2013-06-21 11:34:53 -0700216// EventGraph<TitanGraph> eg = conn.getEventGraph();
Yuta HIGUCHIba98be32013-12-11 17:01:08 -0800217 if (fg != null) fg.removeVertex(port.asVertex());
Pankaj Berde85016ab2013-06-21 11:34:53 -0700218 }
219
220 /**
221 * Create and return a device object.
222 */
Yuta HIGUCHIba98be32013-12-11 17:01:08 -0800223 @Override
Pankaj Berde85016ab2013-06-21 11:34:53 -0700224 public IDeviceObject newDevice() {
Yuta HIGUCHIba98be32013-12-11 17:01:08 -0800225 FramedGraph<TitanGraph> fg = conn.getFramedGraph();
Pankaj Berde85016ab2013-06-21 11:34:53 -0700226 IDeviceObject obj = fg.addVertex(null,IDeviceObject.class);
227 if (obj != null) obj.setType("device");
228 return obj;
229 }
230
231 /**
232 * Search and get a device object having specified MAC address.
233 * @param macAddr MAC address to search and get
234 */
Yuta HIGUCHIba98be32013-12-11 17:01:08 -0800235 @Override
Pankaj Berde85016ab2013-06-21 11:34:53 -0700236 public IDeviceObject searchDevice(String macAddr) {
Yuta HIGUCHI6039faf2013-12-11 16:28:11 -0800237 FramedGraph<TitanGraph> fg = conn.getFramedGraph();
238 if ( fg == null ) return null;
239 Iterator<IDeviceObject> devices = fg.getVertices("dl_addr",macAddr, IDeviceObject.class).iterator();
240 if ( devices.hasNext() ) {
241 return devices.next();
242 } else {
243 return null;
244 }
Pankaj Berde85016ab2013-06-21 11:34:53 -0700245 }
246
247 /**
248 * Get all devices.
249 */
Yuta HIGUCHIba98be32013-12-11 17:01:08 -0800250 @Override
Pankaj Berde85016ab2013-06-21 11:34:53 -0700251 public Iterable<IDeviceObject> getDevices() {
Yuta HIGUCHIba98be32013-12-11 17:01:08 -0800252 FramedGraph<TitanGraph> fg = conn.getFramedGraph();
Pankaj Berde85016ab2013-06-21 11:34:53 -0700253 return fg != null ? fg.getVertices("type","device",IDeviceObject.class) : null;
254 }
255
256 /**
257 * Remove the specified device.
258 * @param dev a device object to remove
259 */
Yuta HIGUCHIba98be32013-12-11 17:01:08 -0800260 @Override
Pankaj Berde85016ab2013-06-21 11:34:53 -0700261 public void removeDevice(IDeviceObject dev) {
Yuta HIGUCHIba98be32013-12-11 17:01:08 -0800262 FramedGraph<TitanGraph> fg = conn.getFramedGraph();
263 if (fg != null) fg.removeVertex(dev.asVertex());
Pankaj Berde85016ab2013-06-21 11:34:53 -0700264 }
Yuta HIGUCHIba98be32013-12-11 17:01:08 -0800265
Jonathan Hartd6ed62b2013-11-01 13:18:25 -0700266 public IIpv4Address newIpv4Address() {
267 return newVertex("ipv4Address", IIpv4Address.class);
268 }
Yuta HIGUCHIba98be32013-12-11 17:01:08 -0800269
Jonathan Hartd6ed62b2013-11-01 13:18:25 -0700270 private <T extends IBaseObject> T newVertex(String type, Class<T> vertexType) {
271 FramedGraph<TitanGraph> fg = conn.getFramedGraph();
272 T newVertex = fg.addVertex(null, vertexType);
273 if (newVertex != null) {
274 newVertex.setType(type);
275 }
276 return newVertex;
277 }
Yuta HIGUCHIba98be32013-12-11 17:01:08 -0800278
Jonathan Hartd6ed62b2013-11-01 13:18:25 -0700279 public IIpv4Address searchIpv4Address(int intIpv4Address) {
280 return searchForVertex("ipv4_address", intIpv4Address, IIpv4Address.class);
281 }
Yuta HIGUCHIba98be32013-12-11 17:01:08 -0800282
Jonathan Hartd6ed62b2013-11-01 13:18:25 -0700283 private <T> T searchForVertex(String propertyName, Object propertyValue, Class<T> vertexType) {
284 FramedGraph<TitanGraph> fg = conn.getFramedGraph();
285 if (fg != null) {
Yuta HIGUCHIba98be32013-12-11 17:01:08 -0800286 Iterator<T> it =
Jonathan Hartd6ed62b2013-11-01 13:18:25 -0700287 fg.getVertices(propertyName, propertyValue, vertexType).iterator();
288 if (it.hasNext()) {
289 return it.next();
290 }
291 }
292 return null;
293 }
Yuta HIGUCHIba98be32013-12-11 17:01:08 -0800294
Jonathan Hartd6ed62b2013-11-01 13:18:25 -0700295 public IIpv4Address ensureIpv4Address(int intIpv4Address) {
296 IIpv4Address ipv4Vertex = searchIpv4Address(intIpv4Address);
297 if (ipv4Vertex == null) {
298 ipv4Vertex = newIpv4Address();
299 ipv4Vertex.setIpv4Address(intIpv4Address);
300 }
301 return ipv4Vertex;
302 }
Yuta HIGUCHIba98be32013-12-11 17:01:08 -0800303
Jonathan Hart4fce4ed2013-11-01 21:29:21 -0700304 public void removeIpv4Address(IIpv4Address ipv4Address) {
305 FramedGraph<TitanGraph> fg = conn.getFramedGraph();
306 fg.removeVertex(ipv4Address.asVertex());
307 }
Pankaj Berde85016ab2013-06-21 11:34:53 -0700308
309 /**
310 * Create and return a flow path object.
311 */
Yuta HIGUCHIba98be32013-12-11 17:01:08 -0800312 @Override
Pankaj Berde85016ab2013-06-21 11:34:53 -0700313 public IFlowPath newFlowPath() {
Yuta HIGUCHIba98be32013-12-11 17:01:08 -0800314 FramedGraph<TitanGraph> fg = conn.getFramedGraph();
Pankaj Berde85016ab2013-06-21 11:34:53 -0700315 IFlowPath flowPath = fg.addVertex(null, IFlowPath.class);
316 if (flowPath != null) flowPath.setType("flow");
317 return flowPath;
318 }
319
320 /**
321 * Search and get a flow path object with specified flow ID.
322 * @param flowId flow ID to search
323 */
Yuta HIGUCHIba98be32013-12-11 17:01:08 -0800324 @Override
Pankaj Berde85016ab2013-06-21 11:34:53 -0700325 public IFlowPath searchFlowPath(FlowId flowId) {
326 FramedGraph<TitanGraph> fg = conn.getFramedGraph();
Yuta HIGUCHI6039faf2013-12-11 16:28:11 -0800327 if ( fg == null ) return null;
328 Iterator<IFlowPath> flowpaths = fg.getVertices("flow_id", flowId.toString(), IFlowPath.class).iterator();
329 if ( flowpaths.hasNext() ) {
330 return flowpaths.next();
331 } else {
332 return null;
333 }
Pankaj Berde85016ab2013-06-21 11:34:53 -0700334 }
335
336 /**
337 * Get a flow path object with a flow entry.
338 * @param flowEntry flow entry object
339 */
Yuta HIGUCHIba98be32013-12-11 17:01:08 -0800340 @Override
Pankaj Berde85016ab2013-06-21 11:34:53 -0700341 public IFlowPath getFlowPathByFlowEntry(IFlowEntry flowEntry) {
Naoki Shiota991093a2013-12-10 14:47:18 -0800342 GremlinPipeline<Vertex, Vertex> pipe = new GremlinPipeline<Vertex, Vertex>();
343 pipe.start(flowEntry.asVertex()).out("flow");
Naoki Shiotae2f4da72013-12-09 16:34:17 -0800344 FramedVertexIterable<IFlowPath> r = new FramedVertexIterable<IFlowPath>(conn.getFramedGraph(),
Yuta HIGUCHIba98be32013-12-11 17:01:08 -0800345 pipe, IFlowPath.class);
Pankaj Berde85016ab2013-06-21 11:34:53 -0700346 return r.iterator().hasNext() ? r.iterator().next() : null;
347 }
348
349 /**
350 * Get all flow path objects.
351 */
Yuta HIGUCHIba98be32013-12-11 17:01:08 -0800352 @Override
353 public Iterable<IFlowPath> getAllFlowPaths() {
Pankaj Berde85016ab2013-06-21 11:34:53 -0700354 FramedGraph<TitanGraph> fg = conn.getFramedGraph();
355 Iterable<IFlowPath> flowPaths = fg.getVertices("type", "flow", IFlowPath.class);
Yuta HIGUCHIba98be32013-12-11 17:01:08 -0800356
Pankaj Berde85016ab2013-06-21 11:34:53 -0700357 List<IFlowPath> nonNullFlows = new ArrayList<IFlowPath>();
358
359 for (IFlowPath fp: flowPaths) {
360 if (fp.getFlowId() != null) {
361 nonNullFlows.add(fp);
362 }
363 }
364 return nonNullFlows;
365 }
366
367 /**
368 * Remove the specified flow path.
369 * @param flowPath flow path object to remove
370 */
Yuta HIGUCHIba98be32013-12-11 17:01:08 -0800371 @Override
Pankaj Berde85016ab2013-06-21 11:34:53 -0700372 public void removeFlowPath(IFlowPath flowPath) {
373 FramedGraph<TitanGraph> fg = conn.getFramedGraph();
374 fg.removeVertex(flowPath.asVertex());
375 }
376
377 /**
378 * Create and return a flow entry object.
379 */
Yuta HIGUCHIba98be32013-12-11 17:01:08 -0800380 @Override
Pankaj Berde85016ab2013-06-21 11:34:53 -0700381 public IFlowEntry newFlowEntry() {
Yuta HIGUCHIba98be32013-12-11 17:01:08 -0800382 FramedGraph<TitanGraph> fg = conn.getFramedGraph();
Pankaj Berde85016ab2013-06-21 11:34:53 -0700383 IFlowEntry flowEntry = fg.addVertex(null, IFlowEntry.class);
384 if (flowEntry != null) flowEntry.setType("flow_entry");
385 return flowEntry;
386 }
387
388 /**
389 * Search and get a flow entry object with flow entry ID.
390 * @param flowEntryId flow entry ID to search
391 */
Yuta HIGUCHIba98be32013-12-11 17:01:08 -0800392 @Override
Pankaj Berde85016ab2013-06-21 11:34:53 -0700393 public IFlowEntry searchFlowEntry(FlowEntryId flowEntryId) {
394 FramedGraph<TitanGraph> fg = conn.getFramedGraph();
Yuta HIGUCHI6039faf2013-12-11 16:28:11 -0800395 if ( fg == null ) return null;
396 Iterator<IFlowEntry> flowentries = fg.getVertices("flow_entry_id", flowEntryId.toString(), IFlowEntry.class).iterator();
397 if ( flowentries.hasNext() ) {
398 return flowentries.next();
399 } else {
400 return null;
401 }
Pankaj Berde85016ab2013-06-21 11:34:53 -0700402 }
403
404 /**
405 * Get all flow entry objects.
406 */
Yuta HIGUCHIba98be32013-12-11 17:01:08 -0800407 @Override
Pankaj Berde85016ab2013-06-21 11:34:53 -0700408 public Iterable<IFlowEntry> getAllFlowEntries() {
409 FramedGraph<TitanGraph> fg = conn.getFramedGraph();
Yuta HIGUCHIba98be32013-12-11 17:01:08 -0800410
Pankaj Berde85016ab2013-06-21 11:34:53 -0700411 return fg.getVertices("type", "flow_entry", IFlowEntry.class);
412 }
413
414 /**
415 * Remove the specified flow entry.
416 * @param flowEntry flow entry object to remove
417 */
Yuta HIGUCHIba98be32013-12-11 17:01:08 -0800418 @Override
Pankaj Berde85016ab2013-06-21 11:34:53 -0700419 public void removeFlowEntry(IFlowEntry flowEntry) {
420 FramedGraph<TitanGraph> fg = conn.getFramedGraph();
421 fg.removeVertex(flowEntry.asVertex());
422 }
Yuta HIGUCHIba98be32013-12-11 17:01:08 -0800423
Pankaj Berde85016ab2013-06-21 11:34:53 -0700424 /**
425 * Get the instance of GraphDBConnection assigned to this class.
426 */
Yuta HIGUCHIba98be32013-12-11 17:01:08 -0800427 @Override
Pankaj Berde85016ab2013-06-21 11:34:53 -0700428 public IDBConnection getDBConnection() {
429 return conn;
430 }
Yuta HIGUCHIba98be32013-12-11 17:01:08 -0800431
Pankaj Berde85016ab2013-06-21 11:34:53 -0700432 /**
433 * Commit changes for the graph.
434 */
Yuta HIGUCHIba98be32013-12-11 17:01:08 -0800435 @Override
Pankaj Berde85016ab2013-06-21 11:34:53 -0700436 public void commit() {
437 conn.commit();
438 }
439
440 /**
441 * Rollback changes for the graph.
442 */
Yuta HIGUCHIba98be32013-12-11 17:01:08 -0800443 @Override
Pankaj Berde85016ab2013-06-21 11:34:53 -0700444 public void rollback() {
445 conn.rollback();
446 }
447
448 /**
449 * Close the connection of the assigned GraphDBConnection.
450 */
Yuta HIGUCHIba98be32013-12-11 17:01:08 -0800451 @Override
Pankaj Berde85016ab2013-06-21 11:34:53 -0700452 public void close() {
453 conn.close();
454 }
Pankaj Berdebbd38612013-06-22 05:59:12 -0700455
456
Pankaj Berde85016ab2013-06-21 11:34:53 -0700457}