You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by an...@apache.org on 2014/10/09 17:23:51 UTC

[1/2] git commit: Add Iter.log for debugging usages of Iter.

Repository: jena
Updated Branches:
  refs/heads/master 66c27e45e -> ef1ba7c66


Add Iter.log for debugging usages of Iter.

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

Branch: refs/heads/master
Commit: 2c242b2eb749f151f0bf5c8e0b716178f5d95f9a
Parents: 66c27e4
Author: Andy Seaborne <an...@apache.org>
Authored: Thu Oct 9 10:20:13 2014 +0100
Committer: Andy Seaborne <an...@apache.org>
Committed: Thu Oct 9 10:20:13 2014 +0100

----------------------------------------------------------------------
 .../org/apache/jena/atlas/iterator/Iter.java    | 23 +++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/2c242b2e/jena-arq/src/main/java/org/apache/jena/atlas/iterator/Iter.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/atlas/iterator/Iter.java b/jena-arq/src/main/java/org/apache/jena/atlas/iterator/Iter.java
index 03cd674..52352ea 100644
--- a/jena-arq/src/main/java/org/apache/jena/atlas/iterator/Iter.java
+++ b/jena-arq/src/main/java/org/apache/jena/atlas/iterator/Iter.java
@@ -608,9 +608,30 @@ public class Iter<T> implements Iterable<T>, Iterator<T> {
             ((Closeable)iter).close() ;
     }
 
+
+    /**
+     * Print an iterator to stdout, return a copy of the iterator. Printing
+     * occurs now. See {@linkplain #debug} for an operation to print as the
+     * iterator is used. 
+     */
+    public static <T> Iterator<T> log(Iterator<T> stream) {
+        return log(System.out, stream) ;
+    }
+
+    /**
+     * Print an iterator to stdout, return a copy of the iterator. Printing
+     * occurs when the returned iterator is used
+     */
+    public static <T> Iterator<T> log(final PrintStream out, Iterator<T> stream) {
+        Iterator<T> iter = debug(out, stream) ;
+        // And force it to run.
+        return Iter.toList(iter).iterator();
+    }
+    
     /**
      * Print an iterator to stdout, return a copy of the iterator. Printing
-     * occurs when
+     * occurs when the iterator is used.  See {@linkplain #log} for
+     * an operation to print now. 
      */
     public static <T> Iterator<T> debug(Iterator<T> stream) {
         return debug(System.out, stream) ;


[2/2] git commit: Add method to the NodeTable interface to walk down a NodeTable stack.

Posted by an...@apache.org.
Add method to the NodeTable interface to walk down a NodeTable stack.

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

Branch: refs/heads/master
Commit: ef1ba7c66d61d49f4c44f6a4353999cdcd60be1c
Parents: 2c242b2
Author: Andy Seaborne <an...@apache.org>
Authored: Thu Oct 9 16:23:37 2014 +0100
Committer: Andy Seaborne <an...@apache.org>
Committed: Thu Oct 9 16:23:37 2014 +0100

----------------------------------------------------------------------
 .../java/com/hp/hpl/jena/tdb/store/nodetable/NodeTable.java    | 4 ++++
 .../com/hp/hpl/jena/tdb/store/nodetable/NodeTableCache.java    | 3 ++-
 .../com/hp/hpl/jena/tdb/store/nodetable/NodeTableLogger.java   | 5 +++++
 .../com/hp/hpl/jena/tdb/store/nodetable/NodeTableNative.java   | 5 +++++
 .../com/hp/hpl/jena/tdb/store/nodetable/NodeTableWrapper.java  | 1 +
 .../java/com/hp/hpl/jena/tdb/transaction/NodeTableTrans.java   | 6 ++++++
 6 files changed, 23 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/ef1ba7c6/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/store/nodetable/NodeTable.java
----------------------------------------------------------------------
diff --git a/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/store/nodetable/NodeTable.java b/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/store/nodetable/NodeTable.java
index 23ea998..a6e963a 100644
--- a/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/store/nodetable/NodeTable.java
+++ b/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/store/nodetable/NodeTable.java
@@ -58,4 +58,8 @@ public interface NodeTable extends Sync, Closeable
     /** Anything there? */  
     public boolean isEmpty() ; 
 
+    /** Return a NodeTable if this instance wraps another, else return null */  
+    public NodeTable wrapped() ; 
+
+    
 }

http://git-wip-us.apache.org/repos/asf/jena/blob/ef1ba7c6/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/store/nodetable/NodeTableCache.java
----------------------------------------------------------------------
diff --git a/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/store/nodetable/NodeTableCache.java b/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/store/nodetable/NodeTableCache.java
index a16b889..4c21434 100644
--- a/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/store/nodetable/NodeTableCache.java
+++ b/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/store/nodetable/NodeTableCache.java
@@ -75,7 +75,8 @@ public class NodeTableCache implements NodeTable
             notPresent = CacheFactory.createCacheSet(nodeMissesCacheSize) ;
     }
 
-    public final NodeTable getBaseTable() { return baseTable ; } 
+    @Override
+    public final NodeTable wrapped() { return baseTable ; } 
     
     /** Get the Node for this NodeId, or null if none */
     @Override

http://git-wip-us.apache.org/repos/asf/jena/blob/ef1ba7c6/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/store/nodetable/NodeTableLogger.java
----------------------------------------------------------------------
diff --git a/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/store/nodetable/NodeTableLogger.java b/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/store/nodetable/NodeTableLogger.java
index d3617e1..f61bd68 100644
--- a/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/store/nodetable/NodeTableLogger.java
+++ b/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/store/nodetable/NodeTableLogger.java
@@ -129,4 +129,9 @@ public class NodeTableLogger implements NodeTable
             string = label+": "+string ;
         log.info(string) ; 
     }
+
+    @Override
+    public NodeTable wrapped() {
+        return nodeTable ;
+    }
 }

http://git-wip-us.apache.org/repos/asf/jena/blob/ef1ba7c6/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/store/nodetable/NodeTableNative.java
----------------------------------------------------------------------
diff --git a/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/store/nodetable/NodeTableNative.java b/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/store/nodetable/NodeTableNative.java
index 17162c9..edaa664 100644
--- a/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/store/nodetable/NodeTableNative.java
+++ b/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/store/nodetable/NodeTableNative.java
@@ -275,4 +275,9 @@ public class NodeTableNative implements NodeTable
     {
         return getObjects().isEmpty() ;
     }
+
+    @Override
+    public NodeTable wrapped() {
+        return null ;
+    }
 }

http://git-wip-us.apache.org/repos/asf/jena/blob/ef1ba7c6/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/store/nodetable/NodeTableWrapper.java
----------------------------------------------------------------------
diff --git a/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/store/nodetable/NodeTableWrapper.java b/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/store/nodetable/NodeTableWrapper.java
index a2ef49a..50506ea 100644
--- a/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/store/nodetable/NodeTableWrapper.java
+++ b/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/store/nodetable/NodeTableWrapper.java
@@ -29,6 +29,7 @@ import com.hp.hpl.jena.tdb.store.nodetable.NodeTable ;
 public class NodeTableWrapper implements NodeTable
 {
     protected final NodeTable nodeTable ;
+    @Override
     public final NodeTable wrapped() { return nodeTable ; } 
     
     protected NodeTableWrapper(NodeTable nodeTable)

http://git-wip-us.apache.org/repos/asf/jena/blob/ef1ba7c6/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/transaction/NodeTableTrans.java
----------------------------------------------------------------------
diff --git a/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/transaction/NodeTableTrans.java b/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/transaction/NodeTableTrans.java
index e4542d7..7384857 100644
--- a/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/transaction/NodeTableTrans.java
+++ b/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/transaction/NodeTableTrans.java
@@ -403,4 +403,10 @@ public class NodeTableTrans implements NodeTable, TransactionLifecycle
             log.debug(label+": "+x) ;
         }
     }
+
+    // Return the base table, not the nodeTableJournal
+    @Override
+    public NodeTable wrapped() {
+        return base ;
+    }
 }