update javadoc
diff --git a/src/main/java/net/onrc/onos/util/GraphDBConnection.java b/src/main/java/net/onrc/onos/util/GraphDBConnection.java
index 9a50f47..1cc4e5a 100644
--- a/src/main/java/net/onrc/onos/util/GraphDBConnection.java
+++ b/src/main/java/net/onrc/onos/util/GraphDBConnection.java
@@ -43,6 +43,11 @@
}
/* Static 'instance' method */
+ /**
+ * Get the instance of GraphDBConnection class.
+ * @param conf the path to the database configuration file.
+ * @return GraphDBConnection instance.
+ */
public static synchronized GraphDBConnection getInstance(final String conf) {
if (GraphDBConnection.configFile == null
|| GraphDBConnection.configFile.isEmpty()) {
@@ -79,6 +84,9 @@
return singleton;
}
+ /**
+ * Get a FramedGraph instance of the graph.
+ */
public FramedGraph<TitanGraph> getFramedGraph() {
if (isValid()) {
FramedGraph<TitanGraph> fg = new FramedGraph<TitanGraph>(graph);
@@ -89,6 +97,10 @@
}
}
+ /**
+ * Get EventTransactionalGraph of the titan graph.
+ * @return EventTransactionalGraph of the titan graph
+ */
protected EventTransactionalGraph<TitanGraph> getEventGraph() {
if (isValid()) {
return eg;
@@ -97,16 +109,25 @@
}
}
+ /**
+ * Add LocalGraphChangedLister for the graph.
+ */
public void addEventListener(final LocalGraphChangedListener listener) {
EventTransactionalGraph<TitanGraph> eg = this.getEventGraph();
eg.addListener(listener);
log.debug("Registered listener {}", listener.getClass());
}
+ /**
+ * Return whether this connection is valid.
+ */
public Boolean isValid() {
return (graph != null || graph.isOpen());
}
+ /**
+ * Commit changes for the graph operations.
+ */
public void commit() {
try {
graph.commit();
@@ -116,6 +137,9 @@
}
}
+ /**
+ * Rollback changes for the graph operations.
+ */
public void rollback() {
try {
graph.rollback();
@@ -125,6 +149,9 @@
}
}
+ /**
+ * Close this database connection.
+ */
public void close() {
commit();
}
diff --git a/src/main/java/net/onrc/onos/util/GraphDBOperation.java b/src/main/java/net/onrc/onos/util/GraphDBOperation.java
index f939a3d..92157fb 100644
--- a/src/main/java/net/onrc/onos/util/GraphDBOperation.java
+++ b/src/main/java/net/onrc/onos/util/GraphDBOperation.java
@@ -332,18 +332,30 @@
fg.removeVertex(flowEntry.asVertex());
}
+ /**
+ * Get the instance of GraphDBConnection assigned to this class.
+ */
public IDBConnection getDBConnection() {
return conn;
}
+ /**
+ * Commit changes for the graph.
+ */
public void commit() {
conn.commit();
}
-
+
+ /**
+ * Rollback changes for the graph.
+ */
public void rollback() {
conn.rollback();
}
+ /**
+ * Close the connection of the assigned GraphDBConnection.
+ */
public void close() {
conn.close();
}