clerezza-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From enrid...@apache.org
Subject [2/2] git commit: CLEREZZA-912 Implemented
Date Fri, 18 Apr 2014 18:04:17 GMT
CLEREZZA-912 Implemented


Project: http://git-wip-us.apache.org/repos/asf/clerezza/repo
Commit: http://git-wip-us.apache.org/repos/asf/clerezza/commit/ff0badfd
Tree: http://git-wip-us.apache.org/repos/asf/clerezza/tree/ff0badfd
Diff: http://git-wip-us.apache.org/repos/asf/clerezza/diff/ff0badfd

Branch: refs/heads/master
Commit: ff0badfda9aee1a8fe6312645137c64ab5c78a77
Parents: c0abf9f
Author: enridaga <enridaga@apache.org>
Authored: Fri Apr 18 18:55:51 2014 +0100
Committer: enridaga <enridaga@apache.org>
Committed: Fri Apr 18 18:55:51 2014 +0100

----------------------------------------------------------------------
 .../rdf/virtuoso/storage/VirtuosoMGraph.java    | 68 +++++++++++---------
 1 file changed, 38 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/clerezza/blob/ff0badfd/rdf.virtuoso.storage/src/main/java/org/apache/clerezza/rdf/virtuoso/storage/VirtuosoMGraph.java
----------------------------------------------------------------------
diff --git a/rdf.virtuoso.storage/src/main/java/org/apache/clerezza/rdf/virtuoso/storage/VirtuosoMGraph.java
b/rdf.virtuoso.storage/src/main/java/org/apache/clerezza/rdf/virtuoso/storage/VirtuosoMGraph.java
index 68a646f..ebe8bf8 100644
--- a/rdf.virtuoso.storage/src/main/java/org/apache/clerezza/rdf/virtuoso/storage/VirtuosoMGraph.java
+++ b/rdf.virtuoso.storage/src/main/java/org/apache/clerezza/rdf/virtuoso/storage/VirtuosoMGraph.java
@@ -70,7 +70,7 @@ public class VirtuosoMGraph extends AbstractMGraph implements MGraph,
 	 * @param connection
 	 */
 	public VirtuosoMGraph(String name, DataAccess dataAccess) {
-		logger.debug("VirtuosoMGraph(String {}, DataAccess {})", name,
+		logger.trace("VirtuosoMGraph(String {}, DataAccess {})", name,
 				dataAccess);
 		this.name = name;
 		// this.provider = provider;
@@ -79,20 +79,20 @@ public class VirtuosoMGraph extends AbstractMGraph implements MGraph,
 
 	@Override
 	public ReadWriteLock getLock() {
-		logger.debug("getLock()");
+		logger.trace("getLock()");
 		return lock;
 	}
 
 	@Override
 	public Graph getGraph() {
-		logger.debug("getGraph()");
+		logger.trace("getGraph()");
 		return asVirtuosoGraph();
 	}
 
 	public VirtuosoGraph asVirtuosoGraph() {
-		logger.debug("asVirtuosoGraph()");
+		logger.trace("asVirtuosoGraph()");
 		if (this.readOnly == null) {
-			logger.debug("create embedded singleton read-only instance");
+			logger.trace("create embedded singleton read-only instance");
 			this.readOnly = new VirtuosoGraph(name, getDataAccess());
 		}
 		return readOnly;
@@ -106,10 +106,12 @@ public class VirtuosoMGraph extends AbstractMGraph implements MGraph,
 	protected Iterator<Triple> performFilter(NonLiteral subject,
 			UriRef predicate, Resource object) {
 		readLock.lock();
-		Iterator<Triple> tit = getDataAccess().filter(getName(), subject,
+		try{
+			return getDataAccess().filter(getName(), subject,
 				predicate, object);
-		readLock.unlock();
-		return tit;
+		}finally{
+			readLock.unlock();
+		}
 	}
 
 	/**
@@ -117,39 +119,45 @@ public class VirtuosoMGraph extends AbstractMGraph implements MGraph,
 	 */
 	@Override
 	public int size() {
-		logger.debug("size()");
+		logger.trace("size()");
 		readLock.lock();
-		int size = getDataAccess().size(getName());
-		readLock.unlock();
-		return size;
+		try{
+			return getDataAccess().size(getName());
+		}finally{
+			readLock.unlock();
+		}
 	}
 
 	@Override
 	public void clear() {
-		logger.debug("clear()");
+		logger.trace("clear()");
 		writeLock.lock();
-		getDataAccess().clearGraph(getName());
-		writeLock.unlock();
+		try{
+			getDataAccess().clearGraph(getName());
+		}finally{
+			writeLock.unlock();
+		}
 	}
 
 	protected boolean performAdd(Triple triple) {
-		logger.debug("performAdd(Triple {})", triple);
+		logger.trace("performAdd(Triple {})", triple);
 		writeLock.lock();
-		// XXX This is disabled because of CLEREZZA-908
-//		if (triple.getObject() instanceof Literal && false) {
-//			getDataAccess().performAddPlanB(getName(), triple);
-//		}else{
-		getDataAccess().insertQuad(getName(), triple);
-//		}
-		writeLock.unlock();
+		try{
+			getDataAccess().insertQuad(getName(), triple);
+		}finally{
+			writeLock.unlock();
+		}
 		return true;
 	}
 
 	protected boolean performRemove(Triple triple) {
-		logger.debug("performRemove(Triple triple)", triple);
+		logger.trace("performRemove(Triple triple)", triple);
 		writeLock.lock();
-		getDataAccess().deleteQuad(getName(), triple);
-		writeLock.unlock();
+		try{
+			getDataAccess().deleteQuad(getName(), triple);
+		}finally{
+			writeLock.unlock();
+		}
 		return true;
 	}
 
@@ -159,7 +167,7 @@ public class VirtuosoMGraph extends AbstractMGraph implements MGraph,
 	 * @return
 	 */
 	public String getName() {
-		logger.debug("getName()");
+		logger.trace("getName()");
 		return name;
 	}
 
@@ -168,16 +176,16 @@ public class VirtuosoMGraph extends AbstractMGraph implements MGraph,
 	 * to be equals (VirtuosoGraph is not the same as VirtuosoMGraph)
 	 */
 	public boolean equals(Object o) {
-		logger.debug("equals({})", o.getClass());
+		logger.trace("equals({})", o);
 		// It must be an instance of VirtuosoMGraph
 		if (o.getClass().equals(VirtuosoMGraph.class)) {
-			logger.debug("{} is a VirtuosoMGraph)", o);
+			logger.trace("{} is a VirtuosoMGraph)", o);
 			if (((VirtuosoMGraph) o).getName().equals(this.getName())) {
 				logger.debug("Names are equal! They are equal!");
 				return true;
 			}
 		} else {
-			logger.debug("Not a VirtuosoMGraph instance: {}", o.getClass());
+			logger.trace("Not a VirtuosoMGraph instance: {}", o.getClass());
 		}
 		return false;
 	}


Mime
View raw message